-
Notifications
You must be signed in to change notification settings - Fork 136
87 lines (78 loc) · 2.33 KB
/
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
78
79
80
81
82
83
84
85
86
87
name: Lint the code
on:
push:
branches:
- main
paths:
- ".github/**/*"
- "**.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
pull_request:
branches:
- main
paths:
- ".github/**/*"
- "**.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
jobs:
linting:
name: Lint on ${{ matrix.os }} for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
- arm-unknown-linux-musleabihf
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
- os: ubuntu-latest
target: arm-unknown-linux-musleabihf
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
targets: ${{ matrix.target }}
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: lint-${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
lint-${{ runner.os }}-cargo-${{ matrix.target }}-
${{ runner.os }}-cargo-${{ matrix.target }}-
# ----- Actual linting logic ------
# These lines should mirror the `just lint` command.
- name: cargo fmt
run: cargo fmt --all -- --check
- name: cargo clippy
run: cargo clippy --tests --workspace -- -D warnings
- name: Install taplo-cli
run: cargo install taplo-cli || exit 0
- name: cargo sort
run: ~/.cargo/bin/taplo format --check