|
4 | 4 | push: |
5 | 5 | branches: [main] |
6 | 6 | pull_request: |
7 | | - branches: [main] |
8 | | - workflow_dispatch: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ci-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
9 | 11 |
|
10 | 12 | env: |
11 | 13 | CARGO_TERM_COLOR: always |
12 | 14 | RUST_BACKTRACE: 1 |
13 | 15 |
|
14 | 16 | jobs: |
15 | | - check: |
16 | | - name: Check |
17 | | - runs-on: ubuntu-latest |
18 | | - steps: |
19 | | - - uses: actions/checkout@v4 |
20 | | - |
21 | | - - name: Install Rust |
22 | | - uses: dtolnay/rust-action@stable |
23 | | - |
24 | | - - name: Cache cargo |
25 | | - uses: actions/cache@v4 |
26 | | - with: |
27 | | - path: | |
28 | | - ~/.cargo/bin/ |
29 | | - ~/.cargo/registry/index/ |
30 | | - ~/.cargo/registry/cache/ |
31 | | - ~/.cargo/git/db/ |
32 | | - target/ |
33 | | - key: ${{ runner.os }}-cargo-check-${{ hashFiles('**/Cargo.toml') }} |
34 | | - |
35 | | - - name: Run cargo check |
36 | | - run: cargo check --all-targets |
37 | | - |
38 | | - test: |
39 | | - name: Test |
40 | | - runs-on: ubuntu-latest |
41 | | - steps: |
42 | | - - uses: actions/checkout@v4 |
43 | | - |
44 | | - - name: Install Rust |
45 | | - uses: dtolnay/rust-action@stable |
46 | | - |
47 | | - - name: Cache cargo |
48 | | - uses: actions/cache@v4 |
49 | | - with: |
50 | | - path: | |
51 | | - ~/.cargo/bin/ |
52 | | - ~/.cargo/registry/index/ |
53 | | - ~/.cargo/registry/cache/ |
54 | | - ~/.cargo/git/db/ |
55 | | - target/ |
56 | | - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} |
57 | | - |
58 | | - - name: Run tests |
59 | | - run: cargo test --all-targets |
60 | | - |
61 | 17 | fmt: |
62 | | - name: Format |
| 18 | + name: Formatting |
63 | 19 | runs-on: ubuntu-latest |
64 | 20 | steps: |
65 | | - - uses: actions/checkout@v4 |
66 | | - |
67 | | - - name: Install Rust |
68 | | - uses: dtolnay/rust-action@stable |
| 21 | + - uses: actions/checkout@v6 |
| 22 | + - uses: dtolnay/rust-toolchain@stable |
69 | 23 | with: |
70 | 24 | components: rustfmt |
71 | | - |
72 | | - - name: Check formatting |
73 | | - run: cargo fmt --all -- --check |
| 25 | + - run: cargo fmt --all --check |
74 | 26 |
|
75 | 27 | clippy: |
76 | 28 | name: Clippy |
77 | 29 | runs-on: ubuntu-latest |
78 | 30 | steps: |
79 | | - - uses: actions/checkout@v4 |
80 | | - |
81 | | - - name: Install Rust |
82 | | - uses: dtolnay/rust-action@stable |
| 31 | + - name: Free disk space |
| 32 | + run: | |
| 33 | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL |
| 34 | + sudo docker image prune --all --force |
| 35 | + - uses: actions/checkout@v6 |
| 36 | + - uses: dtolnay/rust-toolchain@stable |
83 | 37 | with: |
84 | 38 | components: clippy |
85 | | - |
86 | | - - name: Cache cargo |
87 | | - uses: actions/cache@v4 |
| 39 | + - uses: actions/cache@v5 |
88 | 40 | with: |
89 | 41 | path: | |
90 | | - ~/.cargo/bin/ |
91 | | - ~/.cargo/registry/index/ |
92 | | - ~/.cargo/registry/cache/ |
93 | | - ~/.cargo/git/db/ |
94 | | - target/ |
95 | | - key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }} |
| 42 | + ~/.cargo/registry |
| 43 | + ~/.cargo/git |
| 44 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 45 | + restore-keys: ${{ runner.os }}-cargo-registry- |
| 46 | + - uses: actions/cache@v5 |
| 47 | + with: |
| 48 | + path: target |
| 49 | + key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} |
| 50 | + restore-keys: ${{ runner.os }}-cargo-clippy- |
| 51 | + - run: cargo clippy --workspace --all-targets -- -D warnings |
96 | 52 |
|
97 | | - - name: Run clippy |
98 | | - run: cargo clippy --all-targets -- -D warnings |
| 53 | + test: |
| 54 | + name: Tests |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - name: Free disk space |
| 58 | + run: | |
| 59 | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL |
| 60 | + sudo docker image prune --all --force |
| 61 | + - uses: actions/checkout@v6 |
| 62 | + - uses: dtolnay/rust-toolchain@stable |
| 63 | + - uses: actions/cache@v5 |
| 64 | + with: |
| 65 | + path: | |
| 66 | + ~/.cargo/registry |
| 67 | + ~/.cargo/git |
| 68 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 69 | + restore-keys: ${{ runner.os }}-cargo-registry- |
| 70 | + - uses: actions/cache@v5 |
| 71 | + with: |
| 72 | + path: target |
| 73 | + key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} |
| 74 | + restore-keys: ${{ runner.os }}-cargo-test- |
| 75 | + - run: cargo test --workspace |
0 commit comments