Skip to content

Commit 3303b7d

Browse files
authored
Merge pull request #125 from cuviper/ci
ci: merge queue and registry caching
2 parents bdae33a + 239cdb5 commit 3303b7d

File tree

5 files changed

+51
-16
lines changed

5 files changed

+51
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: CI
2-
on:
3-
push:
4-
branches:
5-
- staging
6-
- trying
2+
on: merge_group
73

84
jobs:
95

@@ -21,6 +17,11 @@ jobs:
2117
]
2218
steps:
2319
- uses: actions/checkout@v4
20+
- uses: actions/cache@v4
21+
if: startsWith(matrix.rust, '1')
22+
with:
23+
path: ~/.cargo/registry/index
24+
key: cargo-${{ matrix.rust }}-git-index
2425
- uses: dtolnay/rust-toolchain@master
2526
with:
2627
toolchain: ${{ matrix.rust }}
@@ -44,6 +45,10 @@ jobs:
4445
runs-on: ubuntu-latest
4546
steps:
4647
- uses: actions/checkout@v4
48+
- uses: actions/cache@v4
49+
with:
50+
path: ~/.cargo/registry/index
51+
key: cargo-1.31.0-git-index
4752
- uses: dtolnay/rust-toolchain@1.31.0
4853
with:
4954
target: thumbv6m-none-eabi
@@ -58,3 +63,18 @@ jobs:
5863
with:
5964
components: rustfmt
6065
- run: cargo fmt --all --check
66+
67+
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
68+
# protection, rather than having to add each job separately.
69+
success:
70+
name: Success
71+
runs-on: ubuntu-latest
72+
needs: [test, no_std_131, no_std_stable, fmt]
73+
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
74+
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
75+
# dependencies fails.
76+
if: always() # make sure this is never "skipped"
77+
steps:
78+
# Manually check the status of all dependencies. `if: failure()` does not work.
79+
- name: check if any dependency failed
80+
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

.github/workflows/master.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ jobs:
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 }}

.github/workflows/pr.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ jobs:
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 }}
@@ -27,3 +32,18 @@ jobs:
2732
with:
2833
components: rustfmt
2934
- run: cargo fmt --all --check
35+
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
40+
runs-on: ubuntu-latest
41+
needs: [test, fmt]
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"
46+
steps:
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) }}'

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name = "num-rational"
1010
repository = "https://github.com/rust-num/num-rational"
1111
version = "0.4.1"
1212
readme = "README.md"
13-
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
13+
exclude = ["/ci/*", "/.github/*"]
1414
edition = "2018"
1515

1616
[package.metadata.docs.rs]

bors.toml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)