-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (60 loc) · 1.62 KB
/
checks.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
name: checks
on:
push:
branches: [master]
paths-ignore: ["**.md"]
pull_request:
paths-ignore: ["**.md"]
workflow_dispatch:
jobs:
extract-toolchain:
name: extract toolchain
runs-on: ubuntu-latest
outputs:
toolchain: ${{ steps.toolchain.outputs.value }}
steps:
- uses: actions/checkout@v4
- uses: sebrollen/[email protected]
id: toolchain
with:
file: rust-toolchain.toml
field: toolchain.channel
- run: echo "toolchain=${{ steps.toolchain.outputs.value || 'stable' }}" >> $GITHUB_OUTPUT
clippy:
name: cargo clippy
runs-on: ubuntu-latest
needs: extract-toolchain
env:
TOOLCHAIN: ${{ needs.extract-toolchain.outputs.toolchain }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
components: clippy
- uses: swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings
test:
name: cargo test
needs: extract-toolchain
runs-on: ubuntu-latest
env:
TOOLCHAIN: ${{ needs.extract-toolchain.outputs.toolchain }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.TOOLCHAIN }}
- uses: swatinem/rust-cache@v2
- run: cargo test
fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- uses: swatinem/rust-cache@v2
- run: cargo fmt --all -- --check