Skip to content

Commit e952bd3

Browse files
committed
ci: separate lint job from per-platform build matrix
- Add independent 'lint' job for clippy and fmt checks (runs once) - Build job now only runs build and tests per platform - Downstream jobs (docs, release) now depend on both lint and build
1 parent 23ec472 commit e952bd3

1 file changed

Lines changed: 31 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,34 @@ env:
1212

1313
jobs:
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
@@ -89,7 +112,7 @@ jobs:
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

Comments
 (0)