1212
1313jobs :
1414 # ==========================================================================
15- # Build & Test
15+ # Lint (runs once, not per-platform)
16+ # ==========================================================================
17+ lint :
18+ runs-on : macos-latest
19+ name : Lint
20+ steps :
21+ - uses : actions/checkout@v4
22+ - name : Setup Rust
23+ uses : dtolnay/rust-toolchain@stable
24+ with :
25+ components : clippy, rustfmt
26+ - name : Cache cargo
27+ uses : actions/cache@v4
28+ with :
29+ path : |
30+ ~/.cargo/registry
31+ ~/.cargo/git
32+ target
33+ key : ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.lock') }}
34+ restore-keys : |
35+ ${{ runner.os }}-lint-cargo-
36+ - name : Run clippy
37+ run : cargo clippy --all-features -- -D warnings
38+ - name : Check formatting
39+ run : cargo fmt --check
40+
41+ # ==========================================================================
42+ # Build & Test (per-platform)
1643 # ==========================================================================
1744 build :
1845 strategy :
@@ -47,17 +74,13 @@ jobs:
4774 run : cargo build --verbose --all-features
4875 - name : Run tests
4976 run : cargo test --verbose
50- - name : Run clippy
51- run : cargo clippy --all-features -- -D warnings
52- - name : Check formatting
53- run : cargo fmt --check
5477
5578 # ==========================================================================
5679 # Documentation (only on main)
5780 # ==========================================================================
5881 docs :
5982 runs-on : macos-latest
60- needs : build
83+ needs : [lint, build]
6184 if : github.ref == 'refs/heads/main' && github.event_name == 'push'
6285 permissions :
6386 contents : read
89112 # ==========================================================================
90113 release-pr :
91114 runs-on : macos-latest
92- needs : build
115+ needs : [lint, build]
93116 if : github.ref == 'refs/heads/main' && github.event_name == 'push'
94117 environment : release
95118 concurrency :
@@ -114,7 +137,7 @@ jobs:
114137
115138 release :
116139 runs-on : macos-latest
117- needs : build
140+ needs : [lint, build]
118141 if : github.ref == 'refs/heads/main' && github.event_name == 'push'
119142 environment : release
120143 permissions :
0 commit comments