Skip to content

Commit bde4b06

Browse files
committed
Move clippy and cargo-shear to a dedicated job
1 parent 83002d7 commit bde4b06

1 file changed

Lines changed: 67 additions & 12 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ jobs:
9292
persist-credentials: false
9393

9494
- uses: dtolnay/rust-toolchain@stable
95-
with:
96-
components: clippy
9795

9896
- name: Restore cache
9997
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -112,9 +110,6 @@ jobs:
112110
- name: Install macOS dependencies
113111
uses: ./.github/actions/install-macos-deps
114112

115-
- name: run clippy
116-
run: cargo clippy --keep-going ${{ env.CARGO_ARGS }} --workspace --all-targets ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings
117-
118113
- name: run rust tests
119114
run: cargo test --workspace ${{ env.WORKSPACE_EXCLUDES }} --verbose --features threading ${{ env.CARGO_ARGS }}
120115

@@ -432,6 +427,73 @@ jobs:
432427
shell: bash
433428
run: python -I scripts/whats_left.py ${{ env.CARGO_ARGS }} --features jit
434429

430+
clippy:
431+
name: clippy
432+
runs-on: ${{ matrix.os }}
433+
needs:
434+
- determine_changes
435+
permissions:
436+
contents: read
437+
if: |
438+
needs.determine_changes.outputs.rust_code == 'true' ||
439+
github.ref == 'refs/heads/main'
440+
strategy:
441+
fail-fast: false
442+
matrix:
443+
os:
444+
- macos-latest
445+
- ubuntu-latest
446+
- windows-latest
447+
steps:
448+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
449+
with:
450+
persist-credentials: false
451+
452+
- uses: dtolnay/rust-toolchain@stable
453+
with:
454+
components: clippy
455+
456+
- name: Restore cache
457+
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
458+
with:
459+
path: |
460+
~/.cargo/bin/
461+
~/.cargo/registry/index/
462+
~/.cargo/registry/cache/
463+
~/.cargo/git/db/
464+
target/
465+
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-
466+
restore-keys: |
467+
${{ runner.os }}-stable--${{ hashFiles('**/Cargo.toml') }}-
468+
${{ runner.os }}-stable--
469+
470+
- name: Clippy
471+
run: cargo clippy --keep-going ${{ env.CARGO_ARGS }} --workspace --all-targets ${{ env.WORKSPACE_EXCLUDES }} -- -Dwarnings
472+
473+
cargo_shear:
474+
name: cargo shear
475+
runs-on: ubuntu-latest
476+
needs:
477+
- determine_changes
478+
permissions:
479+
contents: read
480+
if: |
481+
needs.determine_changes.outputs.rust_code == 'true' ||
482+
github.ref == 'refs/heads/main'
483+
steps:
484+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
485+
with:
486+
persist-credentials: false
487+
488+
- uses: dtolnay/rust-toolchain@stable
489+
490+
- uses: cargo-bins/cargo-binstall@dc19f1e48450eefe5a29b8da6c6b00a87d730b37 # v1.18.1
491+
492+
- name: cargo shear
493+
run: |
494+
cargo binstall --no-confirm cargo-shear
495+
cargo shear
496+
435497
lint:
436498
name: Lint
437499
runs-on: ubuntu-latest
@@ -450,13 +512,6 @@ jobs:
450512
with:
451513
components: rustfmt
452514

453-
- uses: cargo-bins/cargo-binstall@dc19f1e48450eefe5a29b8da6c6b00a87d730b37 # v1.18.1
454-
455-
- name: cargo shear
456-
run: |
457-
cargo binstall --no-confirm cargo-shear
458-
cargo shear
459-
460515
- name: actionlint
461516
uses: reviewdog/action-actionlint@6fb7acc99f4a1008869fa8a0f09cfca740837d9d # v1.72.0
462517

0 commit comments

Comments
 (0)