|
16 | 16 | - '.gitignore'
|
17 | 17 |
|
18 | 18 | jobs:
|
19 |
| - check: |
| 19 | + fmt: |
20 | 20 | runs-on: ubuntu-latest
|
21 | 21 |
|
22 | 22 | steps:
|
23 | 23 | - uses: actions/checkout@v4
|
24 |
| - - uses: actions/cache@v3 |
25 |
| - with: |
26 |
| - path: | |
27 |
| - ~/.cargo/bin/ |
28 |
| - ~/.cargo/registry/index/ |
29 |
| - ~/.cargo/registry/cache/ |
30 |
| - ~/.cargo/git/db/ |
31 |
| - target/ |
32 |
| - key: ${{ github.event.repository.name }}-${{ runner.os }}-cargo-check-v3 |
33 |
| - - name: Install latest stable cargo |
34 |
| - uses: actions-rs/toolchain@v1 |
35 |
| - with: |
36 |
| - toolchain: stable |
37 |
| - override: true |
38 |
| - components: rustfmt, clippy |
39 |
| - - name: Install cargo nightly |
40 |
| - run: rustup install nightly |
| 24 | + |
| 25 | + - run: rustup component add rustfmt |
| 26 | + - uses: Swatinem/rust-cache@v2 |
| 27 | + |
| 28 | + - run: cargo fmt --all -- --check |
| 29 | + |
| 30 | + clippy: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - run: rustup component add clippy |
| 37 | + - uses: Swatinem/rust-cache@v2 |
| 38 | + |
| 39 | + - run: cargo clippy --all |
| 40 | + |
| 41 | + doc: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - run: rustup install nightly --profile minimal |
| 48 | + - uses: Swatinem/rust-cache@v2 |
| 49 | + |
41 | 50 | - name: Run check
|
42 |
| - run: | |
43 |
| - cargo fmt --all -- --check |
44 |
| - cargo clippy --all |
45 |
| - ./build_doc.sh |
| 51 | + run: ./build_doc.sh |
| 52 | + |
46 | 53 | build:
|
47 | 54 | runs-on: ubuntu-latest
|
48 | 55 |
|
49 | 56 | steps:
|
50 | 57 | - uses: actions/checkout@v4
|
51 |
| - - uses: actions/cache@v3 |
52 |
| - with: |
53 |
| - path: | |
54 |
| - ~/.cargo/bin/ |
55 |
| - ~/.cargo/registry/index/ |
56 |
| - ~/.cargo/registry/cache/ |
57 |
| - ~/.cargo/git/db/ |
58 |
| - target/ |
59 |
| - key: ${{ github.event.repository.name }}-${{ runner.os }}-cargo-test-v6 |
60 |
| - - name: Install latest nightly |
61 |
| - uses: actions-rs/toolchain@v1 |
62 |
| - with: |
63 |
| - toolchain: nightly |
64 |
| - override: true |
65 |
| - components: rust-src, miri |
66 |
| - - name: Run tests |
67 |
| - run: ./run_test.sh |
| 58 | + |
| 59 | + - run: | |
| 60 | + rustup toolchain install nightly --profile minimal --component rust-src --component miri |
| 61 | + rustup override set nightly |
| 62 | + - uses: Swatinem/rust-cache@v2 |
| 63 | + |
| 64 | + - run: ./run_test.sh |
| 65 | + |
| 66 | + # Dummy job to have a stable name for the "all tests pass" requirement |
| 67 | + tests-pass: |
| 68 | + name: Tests pass |
| 69 | + needs: |
| 70 | + - fmt |
| 71 | + - clippy |
| 72 | + - doc |
| 73 | + - build |
| 74 | + if: always() # always run even if dependencies fail |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + # fail if ANY dependency has failed or cancelled |
| 78 | + - if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')" |
| 79 | + run: exit 1 |
| 80 | + - run: exit 0 |
0 commit comments