Skip to content

Commit d46cf08

Browse files
authored
Merge pull request #120 from cuviper/ci
ci: merge queue and registry caching
2 parents a78ab81 + 7589944 commit d46cf08

File tree

6 files changed

+54
-22
lines changed

6 files changed

+54
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 8 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,7 +17,12 @@ jobs:
2117
nightly
2218
]
2319
steps:
24-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
21+
- uses: actions/cache@v4
22+
if: startsWith(matrix.rust, '1')
23+
with:
24+
path: ~/.cargo/registry/index
25+
key: cargo-${{ matrix.rust }}-git-index
2526
- uses: dtolnay/rust-toolchain@master
2627
with:
2728
toolchain: ${{ matrix.rust }}
@@ -33,7 +34,7 @@ jobs:
3334
name: No Std
3435
runs-on: ubuntu-latest
3536
steps:
36-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3738
- uses: dtolnay/rust-toolchain@stable
3839
with:
3940
target: thumbv6m-none-eabi
@@ -43,8 +44,23 @@ jobs:
4344
name: Format
4445
runs-on: ubuntu-latest
4546
steps:
46-
- uses: actions/checkout@v3
47+
- uses: actions/checkout@v4
4748
- uses: dtolnay/rust-toolchain@1.62.0
4849
with:
4950
components: rustfmt
5051
- run: cargo fmt --all --check
52+
53+
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
54+
# protection, rather than having to add each job separately.
55+
success:
56+
name: Success
57+
runs-on: ubuntu-latest
58+
needs: [test, no_std, fmt]
59+
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
60+
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
61+
# dependencies fails.
62+
if: always() # make sure this is never "skipped"
63+
steps:
64+
# Manually check the status of all dependencies. `if: failure()` does not work.
65+
- name: check if any dependency failed
66+
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

.github/workflows/master.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ jobs:
1515
matrix:
1616
rust: [1.31.0, stable]
1717
steps:
18-
- uses: actions/checkout@v3
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
1924
- uses: dtolnay/rust-toolchain@master
2025
with:
2126
toolchain: ${{ matrix.rust }}

.github/workflows/pr.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ jobs:
1111
matrix:
1212
rust: [1.31.0, stable]
1313
steps:
14-
- uses: actions/checkout@v3
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
1520
- uses: dtolnay/rust-toolchain@master
1621
with:
1722
toolchain: ${{ matrix.rust }}
@@ -22,8 +27,23 @@ jobs:
2227
name: Format
2328
runs-on: ubuntu-latest
2429
steps:
25-
- uses: actions/checkout@v3
30+
- uses: actions/checkout@v4
2631
- uses: dtolnay/rust-toolchain@1.62.0
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-complex"
1010
repository = "https://github.com/rust-num/num-complex"
1111
version = "0.4.4"
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.

ci/test_full.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ check_version 1.43 || cargo update -p libm --precise 0.2.5
4040

4141
# Some crates moved to Rust 1.56 / 2021
4242
check_version 1.56 || (
43+
cargo update -p serde --precise 1.0.185
4344
cargo update -p quote --precise 1.0.30
4445
cargo update -p proc-macro2 --precise 1.0.65
4546
cargo update -p rkyv --precise 0.7.40

0 commit comments

Comments
 (0)