Skip to content

Commit 5a1b746

Browse files
committed
Split linting and formatting CI jobs
Using nightly for the linting job prevents the cache being effective as the rust version forms part of the cache key. Splitting the jobs in two allows the formatting job to use nightly (where the cache is not required as third party crates are not used) while letting the clippy job re-use a stable cache to improve build times.
1 parent 395c09b commit 5a1b746

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,29 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
lint:
13+
format:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: dtolnay/rust-toolchain@stable
1818
with:
1919
toolchain: nightly
20-
components: rustfmt, clippy
21-
- uses: Swatinem/rust-cache@v2
20+
components: rustfmt
2221
- name: Check formatting
2322
# Use nightly for formatting to enable unstable formatting styles
2423
# * group imports
2524
# * import_granularity
2625
run: cargo +nightly fmt -- --check
26+
27+
lint:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: dtolnay/rust-toolchain@stable
32+
with:
33+
toolchain: stable
34+
components: clippy
35+
- uses: Swatinem/rust-cache@v2
2736
- name: Clippy
2837
run: |
2938
cargo --version
@@ -45,4 +54,4 @@ jobs:
4554
run: cargo test --all-targets --verbose
4655
# Ensure that no files (most likely the Cargo.lock file) have changed
4756
- name: Unstaged Changes
48-
run: git diff --exit-code
57+
run: git diff --exit-code

0 commit comments

Comments
 (0)