Skip to content

Commit d4c060e

Browse files
committed
ci: expand matrix to include older rusts
1 parent acfc394 commit d4c060e

File tree

2 files changed

+97
-12
lines changed

2 files changed

+97
-12
lines changed

.github/scripts/matrix.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python3
2+
3+
import itertools
4+
import json
5+
import subprocess
6+
7+
output = subprocess.check_output(
8+
"yq -ojson '.jobs.coverage.strategy.matrix' .github/workflows/ci.yml", shell=True
9+
)
10+
11+
matrix = json.loads(output)
12+
13+
exclude = matrix.pop("exclude", [])
14+
include = matrix.pop("include", [])
15+
16+
keys = sorted(matrix.keys())
17+
values = [matrix[key] for key in keys]
18+
19+
excluded = {tuple((key, item[key]) for key in keys) for item in exclude}
20+
included = {tuple((key, item[key]) for key in keys) for item in include}
21+
22+
generated = {tuple(zip(keys, items)) for items in itertools.product(*values)}
23+
24+
final = (generated - excluded) | included
25+
final_list = [{key: value for key, value in items} for items in sorted(final)]
26+
27+
items = []
28+
for item in final_list:
29+
os = item["os"]
30+
rust = item["rust"]
31+
rustc_bootstrap = item["rustc_bootstrap"]
32+
33+
bootstrap = "" if rust == "nightly" or rustc_bootstrap == "0" else "-bootstrap"
34+
35+
items.append(f"code-coverage-report-{rust}-{os}{bootstrap}")
36+
37+
38+
print(",".join(items))

.github/workflows/ci.yml

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,40 @@ jobs:
4141
os:
4242
- ubuntu-latest
4343
- macos-latest
44-
- windows-latest
44+
# - windows-latest
4545
rust:
46+
- "1.86"
47+
- "1.87"
48+
- "1.88"
49+
- "1.89"
50+
- "1.90"
4651
- stable
4752
- beta
4853
- nightly
54+
rustc_bootstrap:
55+
- "0"
56+
- "1"
4957
exclude:
58+
# bootstrap is only relevant for non-nightly toolchains
59+
- os: ubuntu-latest
60+
rust: nightly
61+
rustc_bootstrap: "0"
62+
- os: macos-latest
63+
rust: nightly
64+
rustc_bootstrap: "0"
65+
# - os: windows-latest
66+
# rust: nightly
67+
# rustc_bootstrap: "0"
68+
include:
5069
# Windows builds depend on an unstable feature: windows_process_exit_code_from
5170
# TODO: find a better way to handle this for windows without nightly
5271
- os: windows-latest
53-
rust: stable
54-
- os: windows-latest
55-
rust: beta
72+
rust: nightly
73+
rustc_bootstrap: "1"
5674
runs-on: ${{ matrix.os }}
5775
env:
5876
RUSTFLAGS: "-D warnings"
77+
RUSTC_BOOTSTRAP: ${{ matrix.rustc_bootstrap }}
5978
steps:
6079
- name: Checkout
6180
uses: actions/checkout@v4
@@ -65,7 +84,7 @@ jobs:
6584
with:
6685
toolchain: ${{ matrix.rust }}
6786
components: clippy
68-
cache-shared-key: ${{ matrix.os }}-${{ matrix.rust }}
87+
cache-shared-key: ${{ matrix.os }}-${{ matrix.rust }}${{ matrix.rust != 'nightly' && matrix.rustc_bootstrap == '1' && '-bootstrap' || '' }}
6988

7089
- name: Fetch cargo dependencies
7190
run: cargo fetch --verbose --locked
@@ -97,10 +116,40 @@ jobs:
97116
matrix:
98117
os:
99118
- ubuntu-latest
119+
- macos-latest
120+
# - windows-latest
100121
rust:
122+
- "1.86"
123+
- "1.87"
124+
- "1.88"
125+
- "1.89"
126+
- "1.90"
101127
- stable
128+
- beta
102129
- nightly
130+
rustc_bootstrap:
131+
- "0"
132+
- "1"
133+
exclude:
134+
# bootstrap is only relevant for non-nightly toolchains
135+
- os: ubuntu-latest
136+
rust: nightly
137+
rustc_bootstrap: "0"
138+
- os: macos-latest
139+
rust: nightly
140+
rustc_bootstrap: "0"
141+
# - os: windows-latest
142+
# rust: nightly
143+
# rustc_bootstrap: "0"
144+
include:
145+
# Windows builds depend on an unstable feature: windows_process_exit_code_from
146+
# TODO: find a better way to handle this for windows without nightly
147+
- os: windows-latest
148+
rust: nightly
149+
rustc_bootstrap: "1"
103150
runs-on: ${{ matrix.os }}
151+
env:
152+
RUSTC_BOOTSTRAP: ${{ matrix.rustc_bootstrap }}
104153
steps:
105154
- name: Checkout
106155
uses: actions/checkout@v4
@@ -110,28 +159,26 @@ jobs:
110159
with:
111160
toolchain: ${{ matrix.rust }}
112161
components: llvm-tools-preview
113-
cache-shared-key: ${{ matrix.os }}-${{ matrix.rust }}
162+
cache-shared-key: ${{ matrix.os }}-${{ matrix.rust }}${{ matrix.rust != 'nightly' && matrix.rustc_bootstrap == '1' && '-bootstrap' || '' }}
114163

115164
- name: Install grcov
116165
run: cargo install grcov
117166

118167
- name: Run Rust tests with coverage
119168
run: .github/scripts/collect-coverage.sh
120-
env:
121-
RUSTC_PROBE_KEEP_PROBE: ${{ matrix.rust == 'nightly' && '1' || '0'}}
122169

123170
- name: Upload out if failed
124171
if: failure()
125172
uses: actions/upload-artifact@v4
126173
with:
127-
name: coverage-failure-${{ matrix.rust }}-${{ matrix.os }}
174+
name: coverage-failure-${{ matrix.rust }}-${{ matrix.os }}${{ matrix.rust != 'nightly' && matrix.rustc_bootstrap == '1' && '-bootstrap' || '' }}
128175
path: target/debug/build/git-remote-codecommit-*
129176
retention-days: 1
130177

131178
- name: Archive code coverage results
132179
uses: actions/upload-artifact@v4
133180
with:
134-
name: code-coverage-report-${{ matrix.rust }}-${{ matrix.os }}
181+
name: code-coverage-report-${{ matrix.rust }}-${{ matrix.os }}${{ matrix.rust != 'nightly' && matrix.rustc_bootstrap == '1' && '-bootstrap' || '' }}
135182
path: target/debug/coverage/html/
136183
retention-days: 7
137184

@@ -146,7 +193,7 @@ jobs:
146193
uses: coverallsapp/github-action@v2
147194
with:
148195
files: target/debug/coverage/lcov
149-
flag-name: code-coverage-report-${{ matrix.rust }}-${{ matrix.os }}
196+
flag-name: code-coverage-report-${{ matrix.rust }}-${{ matrix.os }}${{ matrix.rust != 'nightly' && matrix.rustc_bootstrap == '1' && '-bootstrap' || '' }}
150197
parallel: true
151198

152199
finalize-coveralls-run:
@@ -161,7 +208,7 @@ jobs:
161208
uses: coverallsapp/github-action@v2
162209
with:
163210
parallel-finished: true
164-
carryforward: code-coverage-report-stable-ubuntu-latest,code-coverage-report-nightly-ubuntu-latest
211+
carryforward: code-coverage-report-1.86-macos-latest,code-coverage-report-1.86-macos-latest-bootstrap,code-coverage-report-1.87-macos-latest,code-coverage-report-1.87-macos-latest-bootstrap,code-coverage-report-1.88-macos-latest,code-coverage-report-1.88-macos-latest-bootstrap,code-coverage-report-1.89-macos-latest,code-coverage-report-1.89-macos-latest-bootstrap,code-coverage-report-1.90-macos-latest,code-coverage-report-1.90-macos-latest-bootstrap,code-coverage-report-beta-macos-latest,code-coverage-report-beta-macos-latest-bootstrap,code-coverage-report-nightly-macos-latest,code-coverage-report-stable-macos-latest,code-coverage-report-stable-macos-latest-bootstrap,code-coverage-report-1.86-ubuntu-latest,code-coverage-report-1.86-ubuntu-latest-bootstrap,code-coverage-report-1.87-ubuntu-latest,code-coverage-report-1.87-ubuntu-latest-bootstrap,code-coverage-report-1.88-ubuntu-latest,code-coverage-report-1.88-ubuntu-latest-bootstrap,code-coverage-report-1.89-ubuntu-latest,code-coverage-report-1.89-ubuntu-latest-bootstrap,code-coverage-report-1.90-ubuntu-latest,code-coverage-report-1.90-ubuntu-latest-bootstrap,code-coverage-report-beta-ubuntu-latest,code-coverage-report-beta-ubuntu-latest-bootstrap,code-coverage-report-nightly-ubuntu-latest,code-coverage-report-stable-ubuntu-latest,code-coverage-report-stable-ubuntu-latest-bootstrap,code-coverage-report-nightly-windows-latest
165212

166213
build-docs:
167214
name: Build Documentation

0 commit comments

Comments
 (0)