Skip to content

Commit 3e8e24d

Browse files
Boshenclaude
andauthored
ci: extract clippy into its own job and remove redundant compilation (#250)
## Summary - **Extract clippy into a dedicated job** running once on `ubuntu-latest` in parallel with all test jobs, instead of running identically on all 4 platforms - **Remove `cargo check` and `cargo clippy` from test matrix entries** — each was compiling the codebase ~3x per platform (check + clippy + test) - **Move `-D warnings` into `.cargo/config.toml` rustflags** so warnings-as-errors is enforced consistently without env `RUSTFLAGS` overrides (which clobber config.toml rustflags, breaking musl linker settings) Expected critical path improvement: ~30-40% faster (Windows drops from ~10min to ~6-7min). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5995a45 commit 3e8e24d

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build]
2-
rustflags = ["--cfg", "tokio_unstable"] # also update .github/workflows/ci.yml
2+
rustflags = ["--cfg", "tokio_unstable", "-D", "warnings"]
33

44
[unstable]
55
bindeps = true

.github/workflows/ci.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,29 @@ jobs:
3939
code:
4040
- '!**/*.md'
4141
42+
clippy:
43+
needs: detect-changes
44+
if: needs.detect-changes.outputs.code-changed == 'true'
45+
name: Clippy
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49+
with:
50+
persist-credentials: false
51+
submodules: true
52+
53+
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
54+
with:
55+
save-cache: ${{ github.ref_name == 'main' }}
56+
cache-key: clippy
57+
components: clippy
58+
59+
- run: rustup target add x86_64-unknown-linux-musl
60+
- run: pip install cargo-zigbuild
61+
62+
# --locked: verify Cargo.lock is up to date (replaces the removed `cargo check --locked`)
63+
- run: cargo clippy --locked --all-targets --all-features -- -D warnings
64+
4265
test:
4366
needs: detect-changes
4467
if: needs.detect-changes.outputs.code-changed == 'true'
@@ -75,7 +98,6 @@ jobs:
7598
with:
7699
save-cache: ${{ github.ref_name == 'main' }}
77100
cache-key: test
78-
components: clippy
79101

80102
- run: rustup target add ${{ matrix.target }}
81103

@@ -85,15 +107,6 @@ jobs:
85107
- run: pip install cargo-zigbuild
86108
if: ${{ matrix.os == 'ubuntu-latest' }}
87109

88-
- run: cargo check --locked --all-targets --all-features --target ${{ matrix.target }}
89-
env:
90-
RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml
91-
92-
- name: Clippy
93-
id: clippy
94-
continue-on-error: true
95-
run: cargo clippy --all-targets --all-features -- -D warnings
96-
97110
# For x86_64-apple-darwin on arm64 runner, install x64 node so fspy preload dylib
98111
# (compiled for x86_64) can be injected into node processes running under Rosetta.
99112
# oxc-project/setup-node doesn't support the architecture input, so use
@@ -120,10 +133,6 @@ jobs:
120133
- run: cargo-zigbuild test --target x86_64-unknown-linux-gnu.2.17
121134
if: ${{ matrix.os == 'ubuntu-latest' }}
122135

123-
- name: Check clippy result
124-
if: ${{ steps.clippy.outcome == 'failure' }}
125-
run: exit 1
126-
127136
fmt:
128137
name: Format and Check Deps
129138
runs-on: ubuntu-latest
@@ -157,6 +166,7 @@ jobs:
157166
runs-on: ubuntu-latest
158167
if: always()
159168
needs:
169+
- clippy
160170
- test
161171
- fmt
162172
steps:

0 commit comments

Comments
 (0)