From 42da5f166c9c8c49520751bb63155dafceb7d11c Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 14 Mar 2026 23:13:12 +0800 Subject: [PATCH 1/5] ci: extract clippy into its own job and remove redundant compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each test matrix entry was running `cargo check`, `cargo clippy`, and `cargo test` — effectively compiling 3x per platform. Clippy (a lint) also ran identically on all 4 platforms when once is sufficient. - Add dedicated `clippy` job on ubuntu-latest, parallel to test jobs - Remove `cargo check` and `cargo clippy` steps from test matrix - Move `-D warnings` into `.cargo/config.toml` rustflags so all compilations enforce warnings-as-errors consistently without env overrides (which would clobber config.toml rustflags for musl targets) Co-Authored-By: Claude Opus 4.6 (1M context) --- .cargo/config.toml | 2 +- .github/workflows/ci.yml | 34 ++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f5f5d8b7..b52768ea 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,5 @@ [build] -rustflags = ["--cfg", "tokio_unstable"] # also update .github/workflows/ci.yml +rustflags = ["--cfg", "tokio_unstable", "-D", "warnings"] [unstable] bindeps = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7dec59f..ea85da4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,25 @@ jobs: code: - '!**/*.md' + clippy: + needs: detect-changes + if: needs.detect-changes.outputs.code-changed == 'true' + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + submodules: true + + - uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0 + with: + save-cache: ${{ github.ref_name == 'main' }} + cache-key: clippy + components: clippy + + - run: cargo clippy --all-targets --all-features -- -D warnings + test: needs: detect-changes if: needs.detect-changes.outputs.code-changed == 'true' @@ -75,7 +94,6 @@ jobs: with: save-cache: ${{ github.ref_name == 'main' }} cache-key: test - components: clippy - run: rustup target add ${{ matrix.target }} @@ -85,15 +103,6 @@ jobs: - run: pip install cargo-zigbuild if: ${{ matrix.os == 'ubuntu-latest' }} - - run: cargo check --locked --all-targets --all-features --target ${{ matrix.target }} - env: - RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml - - - name: Clippy - id: clippy - continue-on-error: true - run: cargo clippy --all-targets --all-features -- -D warnings - # For x86_64-apple-darwin on arm64 runner, install x64 node so fspy preload dylib # (compiled for x86_64) can be injected into node processes running under Rosetta. # oxc-project/setup-node doesn't support the architecture input, so use @@ -120,10 +129,6 @@ jobs: - run: cargo-zigbuild test --target x86_64-unknown-linux-gnu.2.17 if: ${{ matrix.os == 'ubuntu-latest' }} - - name: Check clippy result - if: ${{ steps.clippy.outcome == 'failure' }} - run: exit 1 - fmt: name: Format and Check Deps runs-on: ubuntu-latest @@ -157,6 +162,7 @@ jobs: runs-on: ubuntu-latest if: always() needs: + - clippy - test - fmt steps: From 841b54345f4e143889cd5d20574027c129276974 Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 14 Mar 2026 23:16:04 +0800 Subject: [PATCH 2/5] ci: add --locked to clippy to verify lockfile The removed `cargo check --locked` was the only step verifying Cargo.lock is up to date. Add --locked to clippy which serves the same purpose. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea85da4c..95210794 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: cache-key: clippy components: clippy - - run: cargo clippy --all-targets --all-features -- -D warnings + - run: cargo clippy --locked --all-targets --all-features -- -D warnings test: needs: detect-changes From 53fd1fa01e5e807be145789f1924617e65ab6b6a Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 14 Mar 2026 23:18:01 +0800 Subject: [PATCH 3/5] ci: add comment explaining --locked flag on clippy Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95210794..9ad021cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,7 @@ jobs: cache-key: clippy components: clippy + # --locked: verify Cargo.lock is up to date (replaces the removed `cargo check --locked`) - run: cargo clippy --locked --all-targets --all-features -- -D warnings test: From 1ee35dd309be70031ff6ddab1d081af2702e394b Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 14 Mar 2026 23:21:29 +0800 Subject: [PATCH 4/5] ci: add musl target to clippy job The bindep crate (fspy_test_bin) requires the x86_64-unknown-linux-musl target when building with --all-targets. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ad021cb..c0f1df41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,8 @@ jobs: cache-key: clippy components: clippy + - run: rustup target add x86_64-unknown-linux-musl + # --locked: verify Cargo.lock is up to date (replaces the removed `cargo check --locked`) - run: cargo clippy --locked --all-targets --all-features -- -D warnings From 0a8301b6b454bed92a671e23d87f7b5966ac6a10 Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 14 Mar 2026 23:28:36 +0800 Subject: [PATCH 5/5] ci: install cargo-zigbuild in clippy job The musl linker wrapper for the fspy_test_bin bindep invokes cargo-zigbuild, so it must be available. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0f1df41..e3f48649 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,6 +57,7 @@ jobs: components: clippy - run: rustup target add x86_64-unknown-linux-musl + - run: pip install cargo-zigbuild # --locked: verify Cargo.lock is up to date (replaces the removed `cargo check --locked`) - run: cargo clippy --locked --all-targets --all-features -- -D warnings