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:
tarpaulin:
name: Tarpaulin
runs-on: ubuntu-22.04
steps:
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable
shell: bash -eux {0}
run: |
rustup --version
rustup show
rustup toolchain install stable --profile minimal
rustup default stable
- 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
uses: actions-rs/tarpaulin@v0.1
with:
+27 -17
View File
@@ -8,6 +8,19 @@ on:
- cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC
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:
name: Test ${{ matrix.toolchain }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
@@ -45,12 +58,12 @@ jobs:
features: --all-features
steps:
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
components: clippy
override: true
profile: minimal
toolchain: ${{ matrix.toolchain }}
shell: bash -eux {0}
run: |
rustup --version
rustup show
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --component clippy
rustup default ${{ matrix.toolchain }}
- uses: actions/checkout@v3
@@ -108,24 +121,21 @@ jobs:
os: windows-2022
steps:
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
target: ${{ matrix.triple }}
toolchain: stable
shell: bash -eux {0}
run: |
rustup --version
rustup show
rustup toolchain install stable --profile minimal --target ${{ matrix.triple }}
rustup default stable
- uses: actions/checkout@v3
- name: Fetch dependencies
uses: actions-rs/cargo@v1
with:
command: fetch
args: --verbose
run: cargo fetch --verbose
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
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