From 14eea06c2f67663bc7b0083894231da3a124a5bc Mon Sep 17 00:00:00 2001 From: John Kastner Date: Wed, 10 Jan 2024 10:29:15 -0500 Subject: [PATCH] tweak --- .github/workflows/build_and_test.yml | 50 ++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1261e9e56..04327a060 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -10,24 +10,60 @@ jobs: matrix: toolchain: - stable + + # Set `RUSTFLAGS` once for all cargo commands so that changing these flags + # doesn't trigger a fresh build. + env: + RUSTFLAGS:'-D warnings -F unsafe-code' + steps: - uses: actions/checkout@v3 - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - run: ./panic_safety.sh - - run: cargo fmt --all --check - - run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --all-features --verbose - run: cargo doc --all-features --no-deps - # Clippy is configured by `.cargo/config.toml` to deny on lints like - # `unwrap_used`. They aren't detected by `panic_safety.sh` which only - # looks for comments where we've added an `allow` directive for clippy. - - run: cargo clippy --all-features + + # All targets are run with the same `RUSTFLAGS + - run: cargo build --verbose - run: cargo test --verbose - run: cargo test --verbose -- --ignored - run: cargo bench --no-run --profile=dev - - run: cargo test --verbose --features "experimental" - run: cargo test --verbose --no-default-features + - run: cargo build --verbose --features "experimental" + - run: cargo test --verbose --features "experimental" - run: cargo audit --deny warnings # For some reason this hangs if you don't cargo build first + # Clippy in its own job so that the `RUSTFLAGS` set for `build_and_test` + # don't effect it. As a side effect, this will run in parallel, saving some + # time. + clippy: + runs-on: ubuntu-latest + strategy: + matrix: + toolchain: + - stable + + steps: + - uses: actions/checkout@v3 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + # Clippy is configured by `.cargo/config.toml` to deny on lints like + # `unwrap_used`. They aren't detected by `panic_safety.sh` which only + # looks for comments where we've added an `allow` directive for clippy. + - run: cargo clippy --all-features + + # Run `cargo fmt` independently so that tests are executed even if you forgot + # to format before pushing. + format: + runs-on: ubuntu-latest + strategy: + matrix: + toolchain: + - stable + + steps: + - uses: actions/checkout@v3 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + - run: cargo fmt --all --check + cargo-deny: name: cargo deny runs-on: ubuntu-22.04