ci(rust): improve workflow

This commit is contained in:
EdJoPaTo
2022-11-06 13:58:05 +01:00
parent 0f19c0f2ae
commit 9bf2644c69
3 changed files with 43 additions and 48 deletions
+16 -5
View File
@@ -6,17 +6,28 @@ on:
jobs: jobs:
tarpaulin: tarpaulin:
name: Tarpaulin
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Setup Rust - name: Setup Rust
uses: actions-rs/toolchain@v1 shell: bash -eux {0}
with: run: |
override: true rustup --version
toolchain: stable rustup show
rustup toolchain install stable --profile minimal
rustup default stable
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/cache@v3
with:
key: tarpaulin-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Run cargo-tarpaulin - name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1 uses: actions-rs/tarpaulin@v0.1
with: with:
+27 -17
View File
@@ -8,6 +8,19 @@ on:
- cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC - cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC
jobs: jobs:
rustfmt:
runs-on: ubuntu-22.04
steps:
- name: Setup Rust
shell: bash -eux {0}
run: |
rustup --version
rustup show
rustup toolchain install stable --profile minimal --component rustfmt
rustup default stable
- uses: actions/checkout@v3
- run: cargo fmt --check --verbose
test: test:
name: Test ${{ matrix.toolchain }} ${{ matrix.os }} name: Test ${{ matrix.toolchain }} ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -45,12 +58,12 @@ jobs:
features: --all-features features: --all-features
steps: steps:
- name: Setup Rust - name: Setup Rust
uses: actions-rs/toolchain@v1 shell: bash -eux {0}
with: run: |
components: clippy rustup --version
override: true rustup show
profile: minimal rustup toolchain install ${{ matrix.toolchain }} --profile minimal --component clippy
toolchain: ${{ matrix.toolchain }} rustup default ${{ matrix.toolchain }}
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -108,24 +121,21 @@ jobs:
os: windows-2022 os: windows-2022
steps: steps:
- name: Setup Rust - name: Setup Rust
uses: actions-rs/toolchain@v1 shell: bash -eux {0}
with: run: |
override: true rustup --version
profile: minimal rustup show
target: ${{ matrix.triple }} rustup toolchain install stable --profile minimal --target ${{ matrix.triple }}
toolchain: stable rustup default stable
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Fetch dependencies - name: Fetch dependencies
uses: actions-rs/cargo@v1 run: cargo fetch --verbose
with:
command: fetch
args: --verbose
- name: Build - name: Build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --release --verbose --all-features --target ${{ matrix.triple }} args: --release --verbose --all-features --target ${{ matrix.triple }}
use-cross: ${{ runner.os == 'Linux' && matrix.triple != 'x86_64-unknown-linux-gnu' }} use-cross: ${{ runner.os == 'Linux' }}
-26
View File
@@ -1,26 +0,0 @@
name: Rust Code Formatting
on:
push:
pull_request:
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-22.04
steps:
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- uses: actions/checkout@v3
- name: Check format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check --verbose