|
1 | | -name: ci |
| 1 | +name: CI |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
2 | 6 | on: |
3 | 7 | pull_request: |
4 | | - paths: |
5 | | - - '**' |
6 | | - - '!*.md' |
7 | | - - "!/LICENSE" |
8 | 8 | push: |
9 | 9 | branches: |
10 | 10 | - master |
11 | | - paths: |
12 | | - - '**' |
13 | | - - '!*.md' |
14 | | - - "!/LICENSE" |
| 11 | + |
| 12 | +env: |
| 13 | + RUST_BACKTRACE: 1 |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + CLICOLOR: 1 |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: "${{ github.workflow }}-${{ github.ref }}" |
| 19 | + cancel-in-progress: true |
| 20 | + |
15 | 21 | jobs: |
| 22 | + ci: |
| 23 | + permissions: |
| 24 | + contents: none |
| 25 | + name: CI |
| 26 | + needs: [test, lockfile, rustfmt] |
| 27 | + runs-on: ubuntu-latest |
| 28 | + if: "always()" |
| 29 | + steps: |
| 30 | + - name: Failed |
| 31 | + run: exit 1 |
| 32 | + if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')" |
16 | 33 | test: |
17 | 34 | name: Test |
18 | 35 | strategy: |
19 | 36 | matrix: |
20 | 37 | os: ["ubuntu-latest"] |
21 | 38 | rust: ["stable"] |
| 39 | + continue-on-error: ${{ matrix.rust != 'stable' }} |
22 | 40 | runs-on: ${{ matrix.os }} |
| 41 | + env: |
| 42 | + # Reduce amount of data cached |
| 43 | + CARGO_PROFILE_DEV_DEBUG: line-tables-only |
23 | 44 | steps: |
24 | 45 | - name: Checkout repository |
25 | | - uses: actions/checkout@v6 |
| 46 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 47 | + with: |
| 48 | + persist-credentials: false |
26 | 49 | - name: Install Rust |
27 | | - uses: actions-rs/toolchain@v1 |
| 50 | + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable |
28 | 51 | with: |
29 | 52 | toolchain: ${{ matrix.rust }} |
30 | | - profile: minimal |
31 | | - override: true |
32 | | - - uses: Swatinem/rust-cache@v2 |
| 53 | + - name: Initialize cache |
| 54 | + uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 |
33 | 55 | - name: Default features |
34 | 56 | run: cargo test --workspace |
| 57 | + lockfile: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Checkout repository |
| 61 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 62 | + with: |
| 63 | + persist-credentials: false |
| 64 | + - name: Install Rust |
| 65 | + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable |
| 66 | + with: |
| 67 | + toolchain: stable |
| 68 | + - name: Initialize cache |
| 69 | + uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 |
| 70 | + - name: "Is lockfile updated?" |
| 71 | + run: cargo update --workspace --locked |
| 72 | + rustfmt: |
| 73 | + name: rustfmt |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - name: Checkout repository |
| 77 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 78 | + with: |
| 79 | + persist-credentials: false |
| 80 | + - name: Install Rust |
| 81 | + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable |
| 82 | + with: |
| 83 | + toolchain: "1.95" # STABLE |
| 84 | + components: rustfmt |
| 85 | + - name: Initialize cache |
| 86 | + uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 |
| 87 | + - name: Check formatting |
| 88 | + run: cargo fmt --check |
0 commit comments