|
1 | | -name: Checks |
| 1 | +name: Rust |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
2 | 5 |
|
3 | 6 | env: |
4 | 7 | CACHE_VERSION: 0 |
|
10 | 13 |
|
11 | 14 | on: |
12 | 15 | push: |
13 | | - branches: |
14 | | - - main |
| 16 | + branches: [main] |
15 | 17 | pull_request: |
16 | | - branches: |
17 | | - - main |
| 18 | + branches: [main] |
18 | 19 | merge_group: |
19 | 20 |
|
| 21 | +concurrency: |
| 22 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 23 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 24 | + |
20 | 25 | jobs: |
21 | 26 | cargo-checks: |
| 27 | + permissions: |
| 28 | + actions: write |
22 | 29 | name: Task cargo ${{ matrix.action }} |
23 | 30 | runs-on: ubuntu-latest |
| 31 | + |
24 | 32 | strategy: |
25 | 33 | matrix: |
26 | 34 | action: [clippy, fmt, test] |
| 35 | + |
27 | 36 | steps: |
28 | 37 | - name: Fetch latest code |
29 | 38 | uses: actions/checkout@v5 |
| 39 | + |
30 | 40 | - name: Setup build environment |
31 | 41 | if: matrix.action != 'fmt' |
32 | 42 | run: rustup show |
33 | | - - uses: Swatinem/rust-cache@v2 |
| 43 | + |
| 44 | + - name: Cache cargo target |
34 | 45 | if: matrix.action != 'fmt' |
| 46 | + uses: Swatinem/rust-cache@v2 |
35 | 47 | with: |
36 | 48 | prefix-key: ${{ env.CACHE_VERSION }} |
37 | 49 | key: ${{ matrix.action }} |
| 50 | + |
38 | 51 | - name: Cargo clippy |
39 | 52 | if: matrix.action == 'clippy' |
40 | 53 | uses: giraffate/clippy-action@v1 |
41 | 54 | with: |
42 | | - clippy_flags: --workspace --all-features --all-targets --locked |
| 55 | + clippy_flags: --workspace --all-features --all-targets --locked -- -Dwarnings |
| 56 | + |
43 | 57 | - name: Cargo fmt |
44 | 58 | if: matrix.action == 'fmt' |
45 | 59 | run: | |
46 | 60 | rustup toolchain install nightly |
47 | 61 | rustup component add rustfmt --toolchain nightly |
48 | 62 | cargo +nightly fmt --all -- --check |
| 63 | +
|
49 | 64 | - name: Cargo test |
50 | 65 | if: matrix.action == 'test' |
51 | 66 | run: RUST_MIN_STACK=67108864 cargo test --profile ci-dev --workspace --all-features --all-targets --locked |
52 | | - - name: Fast fail |
53 | | - uses: vishnudxb/cancel-workflow@v1.2 |
54 | | - if: failure() |
55 | | - with: |
56 | | - repo: hack-ink/array-bytes |
57 | | - workflow_id: ${{ github.run_id }} |
58 | | - access_token: ${{ github.token }} |
|
0 commit comments