Skip to content

Commit e9b204c

Browse files
authored
Merge pull request #291 from cuviper/ci
ci: merge queue and registry caching
2 parents 3674819 + 218acee commit e9b204c

File tree

5 files changed

+47
-19
lines changed

5 files changed

+47
-19
lines changed

.github/workflows/ci.yaml

Lines changed: 21 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

@@ -24,6 +20,11 @@ jobs:
2420
]
2521
steps:
2622
- uses: actions/checkout@v4
23+
- uses: actions/cache@v4
24+
if: startsWith(matrix.rust, '1')
25+
with:
26+
path: ~/.cargo/registry/index
27+
key: cargo-${{ matrix.rust }}-git-index
2728
- uses: dtolnay/rust-toolchain@master
2829
with:
2930
toolchain: ${{ matrix.rust }}
@@ -65,3 +66,18 @@ jobs:
6566
with:
6667
components: rustfmt
6768
- run: cargo fmt --all --check
69+
70+
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
71+
# protection, rather than having to add each job separately.
72+
success:
73+
name: Success
74+
runs-on: ubuntu-latest
75+
needs: [test, i686, no_std, fmt]
76+
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
77+
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
78+
# dependencies fails.
79+
if: always() # make sure this is never "skipped"
80+
steps:
81+
# Manually check the status of all dependencies. `if: failure()` does not work.
82+
- name: check if any dependency failed
83+
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
@@ -11,7 +11,7 @@ repository = "https://github.com/rust-num/num-bigint"
1111
version = "0.4.4"
1212
readme = "README.md"
1313
build = "build.rs"
14-
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
14+
exclude = ["/ci/*", "/.github/*"]
1515
edition = "2018"
1616

1717
[features]

bors.toml

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

0 commit comments

Comments
 (0)