Skip to content

Commit b3b50ff

Browse files
committed
ci: Add clippy task, forbidding warnings
See also slog-rs/slog#4060ea9
1 parent 4c92434 commit b3b50ff

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/clippy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# We use `actions-rs` for most of our actions
2+
on: [push, pull_request]
3+
name: Clippy
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
# has a history of occasional bugs (especially on old versions)
8+
#
9+
# the ci is free so we might as well use it ;)
10+
CARGO_INCREMENTAL: 0
11+
12+
13+
jobs:
14+
clippy:
15+
# Only run on PRs if the source branch is on someone else's repo
16+
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
17+
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
rust:
23+
# in hardcoded versions, warnings will fail the build
24+
- 1.89
25+
# in auto-updated versions, warnings will not fail the build
26+
- stable
27+
- nightly
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: dtolnay/rust-toolchain@master
32+
with:
33+
toolchain: ${{ matrix.rust }}
34+
components: clippy
35+
- name: Clippy
36+
run: |
37+
cargo clippy --all --all-targets --verbose --all-features -- -D warnings
38+
# When using hardcoded/pinned versions, warnings are forbidden.
39+
#
40+
# On automatically updated versions of rust (both stable & nightly) we allow clippy to fail.
41+
# This is because automatic updates can introduce new lints or change existing lints.
42+
continue-on-error: ${{ !contains(matrix.rust, '1.') }}

0 commit comments

Comments
 (0)