-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (68 loc) · 1.81 KB
/
static-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: static analysis
on: pull_request
# Run checkers independently, so you see errors from each.
jobs:
# Linting
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D warnings
# Formatting
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
- run: cargo fmt
- run: git diff --exit-code
# Ensure db is migrated
db-migrated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: sqlx-cli
- run: '! make migration-status | grep -q pending'
# Ensure all deps are used
unused-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-machete
# If you're here because CI is flagging a dependency as unused,
# but it really is used, you can add an exception!
#
# https://github.com/bnjbvr/cargo-machete#false-positives
#
# If it is unused, you can fix it by installing and running machete:
#
# cargo binstall cargo-machete
# cargo machete --fix
- run: cargo machete