Skip to content

Commit 08bf8ac

Browse files
committed
Split format and clippy into separate CI jobs
Improve CI performance by making cache more effective. The format check requires a nightly toolchain to support unstable formatting options but does not need to compile anything - this means the cache doesn't really affect the runtime and can be skipped. The clippy job needs to compile the project and therefore needs all the dependencies available. The cache uses the version of rust as part of the key so a nightly build guarantees a cache miss for the first job each day. Using the stable toolchain for the clippy check allows it to use the same cache from previous runs reducing the need to download crates twice for each PR.
1 parent f557718 commit 08bf8ac

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 3 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

0 commit comments

Comments
 (0)