ci(rust): improve workflow
This commit is contained in:
@@ -9,6 +9,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
@@ -20,15 +21,11 @@ jobs:
|
|||||||
tool: cargo-llvm-cov
|
tool: cargo-llvm-cov
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- run: cargo fetch
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
key: coverage-${{ hashFiles('**/Cargo.lock') }}
|
key: coverage-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||||
path: |
|
path: target/
|
||||||
~/.cargo/registry/index/
|
|
||||||
~/.cargo/registry/cache/
|
|
||||||
~/.cargo/git/db/
|
|
||||||
target/
|
|
||||||
|
|
||||||
- name: Run cargo-llvm-cov
|
- name: Run cargo-llvm-cov
|
||||||
run: cargo llvm-cov --all-features --html
|
run: cargo llvm-cov --all-features --html
|
||||||
|
|||||||
+93
-40
@@ -9,7 +9,8 @@ on:
|
|||||||
- cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC
|
- cron: '42 2 * * 6' # weekly on Saturday 2:42 UTC
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUSTFLAGS: --deny warnings
|
CARGO_INCREMENTAL: 0
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rustfmt:
|
rustfmt:
|
||||||
@@ -23,61 +24,108 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: cargo fmt --check --verbose
|
- run: cargo fmt --check --verbose
|
||||||
|
|
||||||
test:
|
clippy:
|
||||||
name: Test ${{ matrix.toolchain }} ${{ matrix.os }} ${{ matrix.features }}
|
name: Clippy ${{ matrix.toolchain }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
|
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
toolchain:
|
toolchain:
|
||||||
- stable
|
- stable
|
||||||
os:
|
- beta
|
||||||
- ubuntu-latest
|
- nightly
|
||||||
- macos-latest
|
env:
|
||||||
- windows-latest
|
RUSTFLAGS: --deny warnings
|
||||||
clippyargs:
|
|
||||||
- -D clippy::pedantic
|
|
||||||
features:
|
|
||||||
- "" # default features
|
|
||||||
include:
|
|
||||||
# Check future versions and maybe get some glances on soon to be lints
|
|
||||||
- toolchain: beta
|
|
||||||
os: ubuntu-latest
|
|
||||||
features: --all-features
|
|
||||||
clippyargs: -D clippy::pedantic -D clippy::nursery -D clippy::cargo
|
|
||||||
- toolchain: nightly
|
|
||||||
os: ubuntu-latest
|
|
||||||
features: --all-features
|
|
||||||
clippyargs: -D clippy::pedantic
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
components: clippy
|
components: clippy
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: cargo fetch
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: clippy-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||||
|
path: target/
|
||||||
|
- run: cargo clippy --offline --all-features --all-targets
|
||||||
|
- run: cargo doc --offline --all-features --no-deps
|
||||||
|
|
||||||
|
features:
|
||||||
|
name: Features ${{ matrix.toolchain }} ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
- beta
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-latest
|
||||||
|
- windows-latest
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: --allow unknown-lints --deny warnings
|
||||||
|
steps:
|
||||||
|
- name: Setup Rust
|
||||||
|
id: rust
|
||||||
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
|
||||||
|
- name: Install cargo-hack
|
||||||
|
uses: taiki-e/install-action@v2
|
||||||
|
with:
|
||||||
|
tool: cargo-hack
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- run: cargo fetch
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: features-${{ matrix.os }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||||
|
path: target/
|
||||||
|
|
||||||
- name: Fetch dependencies
|
- name: Check all targets
|
||||||
run: cargo fetch --verbose
|
run: cargo hack --keep-going --feature-powerset check --all-targets --offline
|
||||||
|
|
||||||
- name: Check clippy
|
- name: Check without dev dependencies
|
||||||
run: cargo clippy --verbose --all-targets ${{ matrix.features }} -- ${{ matrix.clippyargs }}
|
run: cargo hack --keep-going --feature-powerset --no-dev-deps check --offline
|
||||||
|
|
||||||
- name: Check docs
|
test:
|
||||||
run: cargo doc --verbose --no-deps ${{ matrix.features }}
|
name: Test ${{ matrix.toolchain }} ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
- beta
|
||||||
|
- nightly
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-latest
|
||||||
|
- windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Rust
|
||||||
|
id: rust
|
||||||
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: cargo fetch
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: test-${{ matrix.os }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||||
|
path: target/
|
||||||
|
- run: cargo build --offline --all-features --all-targets
|
||||||
|
- run: cargo test --offline --all-features --no-fail-fast
|
||||||
|
|
||||||
- name: Build
|
release:
|
||||||
run: cargo build --verbose --all-targets ${{ matrix.features }}
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: cargo test --verbose ${{ matrix.features }}
|
|
||||||
|
|
||||||
github-release:
|
|
||||||
name: Release ${{ matrix.triple }}
|
name: Release ${{ matrix.triple }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: test
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -102,8 +150,11 @@ jobs:
|
|||||||
os: windows-latest
|
os: windows-latest
|
||||||
- triple: aarch64-pc-windows-msvc
|
- triple: aarch64-pc-windows-msvc
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: --deny warnings
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- name: Setup Rust
|
||||||
|
id: rust
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
@@ -116,9 +167,11 @@ jobs:
|
|||||||
tool: cross
|
tool: cross
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- run: cargo fetch
|
||||||
- name: Fetch dependencies
|
- uses: actions/cache@v4
|
||||||
run: cargo fetch --verbose
|
with:
|
||||||
|
key: release-${{ matrix.triple }}-${{ steps.rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.*') }}
|
||||||
|
path: target/
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --verbose --target ${{ matrix.triple }}
|
run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --all-features --target ${{ matrix.triple }}
|
||||||
|
|||||||
Reference in New Issue
Block a user