Skip to content

Commit 8eb6e56

Browse files
committed
ci: Fail on clippy warnings
Workflow copied from main repo
1 parent 88aca95 commit 8eb6e56

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

.github/workflows/clippy.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# This is the clippy workflow, separate from the main 'Rust' workflow
2-
#
3-
# This will fail if clippy fails (if we encounter any of its "correctness" lints)
4-
#
5-
# Clippy warnings won't fail the build. They may or may not turn into Github warnings.
6-
#
7-
# TODO: Test clippy with different feature combos?
8-
# TODO: Should we fail on clippy warnings?
91
on: [push, pull_request]
102
name: Clippy
113

@@ -21,17 +13,29 @@ jobs:
2113
clippy:
2214
# Only run on PRs if the source branch is on someone else's repo
2315
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
16+
2417
runs-on: ubuntu-latest
2518
strategy:
19+
fail-fast: false
2620
matrix:
2721
rust:
22+
# in hardcoded versions, warnings will fail the build
23+
- 1.89
24+
# in auto-updated versions, warnings will not fail the build
2825
- stable
26+
- nightly
27+
2928
steps:
30-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
3130
- uses: dtolnay/rust-toolchain@master
3231
with:
3332
toolchain: ${{ matrix.rust }}
3433
components: clippy
35-
- shell: bash
34+
- name: Clippy
3635
run: |
37-
cargo clippy
36+
cargo clippy --all --all-targets --verbose --all-features -- -D warnings
37+
# When using hardcoded/pinned versions, warnings are forbidden.
38+
#
39+
# On automatically updated versions of rust (both stable & nightly) we allow clippy to fail.
40+
# This is because automatic updates can introduce new lints or change existing lints.
41+
continue-on-error: ${{ !contains(matrix.rust, '1.') }}

0 commit comments

Comments
 (0)