-
Notifications
You must be signed in to change notification settings - Fork 134
52 lines (46 loc) · 1.22 KB
/
format.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
name: Check code formatting
on:
push:
branches:
- main
paths:
- ".github/workflows/format.yml"
- "**.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
pull_request:
branches:
- main
paths:
- ".github/workflows/format.yml"
- "**.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
jobs:
format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: format-${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
format-${{ 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