-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (64 loc) · 1.98 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
# This workflow runs whenever a PR is opened or updated, or a commit is pushed to master.
# It runs several checks:
# - fmt: checks that the code is formatted according to rustfmt
# - clippy: checks that the code does not contain any clippy warnings
# - doc: checks that the code can be documented without errors (including OpenAPI)
name: static analysis
permissions:
contents: read
on:
push:
branches: ['master']
pull_request:
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR.
# This Ensures that we don't waste CI time, and returns results quicker.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: 'always'
SQLX_OFFLINE: '1'
jobs:
clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: cargo clippy
run: |
cargo clippy --workspace --all-features --no-deps -- -Dwarnings
cargo clippy --workspace --tests --no-deps -- -Dwarnings
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: cargo fmt
run: cargo +nightly fmt --all --check
docs:
name: rustdoc / OpenAPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo doc
run: |
cargo doc --all-features --document-private-items --no-deps
cargo run generate-schema --check api-spec.json