-
Notifications
You must be signed in to change notification settings - Fork 171
77 lines (64 loc) · 1.87 KB
/
rust-lint.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
77
name: Rust Lint
on:
push:
branches:
- main
paths:
- 'rust/**'
- '.github/workflows/rust-lint.yml'
pull_request:
paths:
- 'rust/**'
- '.github/workflows/rust-lint.yml'
- "openapi.json"
# When pushing to a PR, cancel any jobs still running for the previous head commit of the PR
concurrency:
# head_ref is only defined for pull requests, run_id is always unique and defined so if this
# workflow was not triggered by a pull request, nothing gets cancelled.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check-fmt:
name: Check formatting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: rustfmt
run: cargo fmt -- --check
working-directory: rust
test-versions:
name: Rust Lint
runs-on: ubuntu-24.04
strategy:
matrix:
rust: [stable, beta]
steps:
- uses: actions/checkout@v4
- name: Regen openapi libs
run: |
yarn
./regen_openapi.sh
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: "rust -> target"
# only save the cache on the main branch
# cf https://github.com/Swatinem/rust-cache/issues/95
save-if: ${{ github.ref == 'refs/heads/main' }}
# include relevant information in the cache name
prefix-key: "rust-client-${{ matrix.rust }}"
- uses: taiki-e/install-action@nextest
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: rust
- name: Run tests
run: cargo nextest run
working-directory: rust