File tree Expand file tree Collapse file tree 3 files changed +37
-20
lines changed Expand file tree Collapse file tree 3 files changed +37
-20
lines changed Original file line number Diff line number Diff line change 2323 ]
2424 steps :
2525 - uses : actions/checkout@v4
26+ - uses : actions/cache@v4
27+ if : startsWith(matrix.rust, '1')
28+ with :
29+ path : ~/.cargo/registry/index
30+ key : cargo-${{ matrix.rust }}-git-index
2631 - uses : dtolnay/rust-toolchain@master
2732 with :
2833 toolchain : ${{ matrix.rust }}
@@ -68,16 +73,17 @@ jobs:
6873 components : rustfmt
6974 - run : cargo fmt --all --check
7075
71- ci-success :
72- name : Complete
73- runs-on : ubuntu-latest
74- needs : [test, i586, no_std, fmt]
75- steps :
76- - run : exit 0
77- ci-failed :
78- name : Complete
76+ # One job that "summarizes" the success state of this pipeline. This can then be added to branch
77+ # protection, rather than having to add each job separately.
78+ success :
79+ name : Success
7980 runs-on : ubuntu-latest
8081 needs : [test, i586, no_std, fmt]
81- if : failure()
82+ # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
83+ # failed" as success. So we have to do some contortions to ensure the job fails if any of its
84+ # dependencies fails.
85+ if : always() # make sure this is never "skipped"
8286 steps :
83- - run : exit 1
87+ # Manually check the status of all dependencies. `if: failure()` does not work.
88+ - name : check if any dependency failed
89+ run : jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
Original file line number Diff line number Diff line change 1616 rust : [1.31.0, stable]
1717 steps :
1818 - 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
1924 - uses : dtolnay/rust-toolchain@master
2025 with :
2126 toolchain : ${{ matrix.rust }}
Original file line number Diff line number Diff line change 1212 rust : [1.31.0, stable]
1313 steps :
1414 - 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
1520 - uses : dtolnay/rust-toolchain@master
1621 with :
1722 toolchain : ${{ matrix.rust }}
@@ -28,16 +33,17 @@ jobs:
2833 - uses : actions/checkout@v4
2934 - run : cargo fmt --all --check
3035
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
3940 runs-on : ubuntu-latest
4041 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"
4246 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