File tree 3 files changed +37
-20
lines changed
3 files changed +37
-20
lines changed Original file line number Diff line number Diff line change 16
16
]
17
17
steps :
18
18
- uses : actions/checkout@v4
19
+ - uses : actions/cache@v4
20
+ if : startsWith(matrix.rust, '1')
21
+ with :
22
+ path : ~/.cargo/registry/index
23
+ key : cargo-${{ matrix.rust }}-git-index
19
24
- uses : dtolnay/rust-toolchain@master
20
25
with :
21
26
toolchain : ${{ matrix.rust }}
@@ -43,16 +48,17 @@ jobs:
43
48
components : rustfmt
44
49
- run : cargo fmt --all --check
45
50
46
- ci-success :
47
- name : Complete
48
- runs-on : ubuntu-latest
49
- needs : [test, no_std, fmt]
50
- steps :
51
- - run : exit 0
52
- ci-failed :
53
- name : Complete
51
+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
52
+ # protection, rather than having to add each job separately.
53
+ success :
54
+ name : Success
54
55
runs-on : ubuntu-latest
55
56
needs : [test, no_std, fmt]
56
- if : failure()
57
+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
58
+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
59
+ # dependencies fails.
60
+ if : always() # make sure this is never "skipped"
57
61
steps :
58
- - run : exit 1
62
+ # Manually check the status of all dependencies. `if: failure()` does not work.
63
+ - name : check if any dependency failed
64
+ run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Original file line number Diff line number Diff line change 16
16
rust : [1.31.0, stable]
17
17
steps :
18
18
- uses : actions/checkout@v4
19
+ - uses : actions/cache@v4
20
+ if : startsWith(matrix.rust, '1')
21
+ with :
22
+ path : ~/.cargo/registry/index
23
+ key : cargo-${{ matrix.rust }}-git-index
19
24
- uses : dtolnay/rust-toolchain@master
20
25
with :
21
26
toolchain : ${{ matrix.rust }}
Original file line number Diff line number Diff line change 12
12
rust : [1.31.0, stable]
13
13
steps :
14
14
- uses : actions/checkout@v4
15
+ - uses : actions/cache@v4
16
+ if : startsWith(matrix.rust, '1')
17
+ with :
18
+ path : ~/.cargo/registry/index
19
+ key : cargo-${{ matrix.rust }}-git-index
15
20
- uses : dtolnay/rust-toolchain@master
16
21
with :
17
22
toolchain : ${{ matrix.rust }}
@@ -28,16 +33,17 @@ jobs:
28
33
components : rustfmt
29
34
- run : cargo fmt --all --check
30
35
31
- ci-success :
32
- name : Complete
33
- runs-on : ubuntu-latest
34
- needs : [test, fmt]
35
- steps :
36
- - run : exit 0
37
- ci-failed :
38
- name : Complete
36
+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
37
+ # protection, rather than having to add each job separately.
38
+ success :
39
+ name : Success
39
40
runs-on : ubuntu-latest
40
41
needs : [test, fmt]
41
- if : failure()
42
+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
43
+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
44
+ # dependencies fails.
45
+ if : always() # make sure this is never "skipped"
42
46
steps :
43
- - run : exit 1
47
+ # Manually check the status of all dependencies. `if: failure()` does not work.
48
+ - name : check if any dependency failed
49
+ run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
You can’t perform that action at this time.
0 commit comments