Skip to content

Commit 291f1a5

Browse files
committed
pre-seed CI build jobs with versions.json
To avoid chances of a network failure in the build script, all CI jobs (except clippy job) use a pre-seeded versions.json artifact. This prevents each build of clang-installer from re-downloading the same versions.json file repeatedly.
1 parent 7b5e598 commit 291f1a5

7 files changed

Lines changed: 224 additions & 59 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,26 @@ concurrency:
2525
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2626

2727
jobs:
28+
seed-build-script:
29+
runs-on: ubuntu-latest
30+
name: Pre-seed static binaries' versions
31+
steps:
32+
- env:
33+
GITHUB_TOKEN: ${{ github.token }}
34+
run: >-
35+
gh release download
36+
-R cpp-linter/clang-tools-static-binaries
37+
--pattern versions.json
38+
--output versions.json
39+
- name: Upload versions.json
40+
uses: actions/upload-artifact@v7
41+
with:
42+
name: static-binary-versions
43+
path: versions.json
44+
if-no-files-found: error
45+
2846
build-bin:
47+
needs: [seed-build-script]
2948
name: Build ${{ matrix.name }} binary
3049
runs-on: ubuntu-latest
3150
strategy:
@@ -60,6 +79,12 @@ jobs:
6079
fi
6180
- run: rustup update --no-self-update
6281
if: steps.cache.outputs.cache-hit != 'true' || steps.validate.outputs.cache-valid == 'false'
82+
- name: Restore build script seed
83+
if: steps.cache.outputs.cache-hit != 'true' || steps.validate.outputs.cache-valid == 'false'
84+
uses: actions/download-artifact@v8
85+
with:
86+
name: static-binary-versions
87+
path: clang-installer
6388
- run: cargo build --bin cpp-linter --features bin --release
6489
if: steps.cache.outputs.cache-hit != 'true' || steps.validate.outputs.cache-valid == 'false'
6590
- name: Upload build artifact

.github/workflows/binary-builds.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,26 @@ concurrency:
3434
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
3535

3636
jobs:
37+
seed-build-script:
38+
runs-on: ubuntu-latest
39+
name: Pre-seed static binaries' versions
40+
steps:
41+
- env:
42+
GITHUB_TOKEN: ${{ github.token }}
43+
run: >-
44+
gh release download
45+
-R cpp-linter/clang-tools-static-binaries
46+
--pattern versions.json
47+
--output versions.json
48+
- name: Upload versions.json
49+
uses: actions/upload-artifact@v7
50+
with:
51+
name: static-binary-versions
52+
path: versions.json
53+
if-no-files-found: error
54+
3755
create-assets:
56+
needs: [seed-build-script]
3857
name: ${{ matrix.target }}
3958
strategy:
4059
fail-fast: false
@@ -113,6 +132,12 @@ jobs:
113132
GITHUB_TOKEN: ${{ github.token }}
114133
run: cargo binstall -y cross
115134

135+
- name: Restore build script seed
136+
uses: actions/download-artifact@v8
137+
with:
138+
name: static-binary-versions
139+
path: clang-installer
140+
116141
- name: Build
117142
run: >-
118143
${{ matrix.cross && 'cross' || 'cargo '}}

.github/workflows/build-docs.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,27 @@ jobs:
4444
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
4545
- run: cargo fetch
4646

47+
seed-build-script:
48+
runs-on: ubuntu-latest
49+
name: Pre-seed static binaries' versions
50+
steps:
51+
- env:
52+
GITHUB_TOKEN: ${{ github.token }}
53+
run: >-
54+
gh release download
55+
-R cpp-linter/clang-tools-static-binaries
56+
--pattern versions.json
57+
--output versions.json
58+
- name: Upload versions.json
59+
uses: actions/upload-artifact@v7
60+
with:
61+
name: static-binary-versions
62+
path: versions.json
63+
if-no-files-found: error
64+
4765
build-mkdocs:
4866
runs-on: ubuntu-latest
49-
needs: [cache-deps]
67+
needs: [cache-deps, seed-build-script]
5068
steps:
5169
- uses: actions/checkout@v6
5270
with:
@@ -66,6 +84,11 @@ jobs:
6684
run: cargo binstall -y nur
6785
env:
6886
GITHUB_TOKEN: ${{ github.token }}
87+
- name: Restore build script seed
88+
uses: actions/download-artifact@v8
89+
with:
90+
name: static-binary-versions
91+
path: clang-installer
6992
- name: Build docs
7093
run: nur docs --build
7194
- name: Upload docs build as artifact
@@ -76,7 +99,7 @@ jobs:
7699

77100
build-rustdoc:
78101
runs-on: ubuntu-latest
79-
needs: [cache-deps]
102+
needs: [cache-deps, seed-build-script]
80103
steps:
81104
- uses: actions/checkout@v6
82105
with:
@@ -97,6 +120,11 @@ jobs:
97120
run: cargo binstall -y nur
98121
env:
99122
GITHUB_TOKEN: ${{ github.token }}
123+
- name: Restore build script seed
124+
uses: actions/download-artifact@v8
125+
with:
126+
name: static-binary-versions
127+
path: clang-installer
100128
- run: nur docs rs
101129
- name: upload rustdoc build as artifact
102130
uses: actions/upload-artifact@v7

.github/workflows/node-js-packaging.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,26 @@ concurrency:
3838
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
3939

4040
jobs:
41+
seed-build-script:
42+
runs-on: ubuntu-latest
43+
name: Pre-seed static binaries' versions
44+
steps:
45+
- env:
46+
GITHUB_TOKEN: ${{ github.token }}
47+
run: >-
48+
gh release download
49+
-R cpp-linter/clang-tools-static-binaries
50+
--pattern versions.json
51+
--output versions.json
52+
- name: Upload versions.json
53+
uses: actions/upload-artifact@v7
54+
with:
55+
name: static-binary-versions
56+
path: versions.json
57+
if-no-files-found: error
58+
4159
build:
60+
needs: [seed-build-script]
4261
strategy:
4362
fail-fast: false
4463
matrix:
@@ -121,6 +140,11 @@ jobs:
121140
shell: bash
122141
- name: Install dependencies
123142
run: yarn install
143+
- name: Restore build script seed
144+
uses: actions/download-artifact@v8
145+
with:
146+
name: static-binary-versions
147+
path: clang-installer
124148
- name: Build
125149
run: ${{ matrix.settings.build }}
126150
shell: bash
@@ -133,6 +157,7 @@ jobs:
133157
bindings/node/${{ env.APP_NAME }}.*.wasm
134158
if-no-files-found: error
135159
build-freebsd:
160+
needs: [seed-build-script]
136161
runs-on: ubuntu-latest
137162
name: Build FreeBSD
138163
steps:
@@ -150,6 +175,11 @@ jobs:
150175
memory: 8G
151176
cpu_count: 3
152177
environment_variables: DEBUG RUSTUP_IO_THREADS
178+
- name: Restore build script seed
179+
uses: actions/download-artifact@v8
180+
with:
181+
name: static-binary-versions
182+
path: clang-installer
153183
- name: Build
154184
shell: cpa.sh {0}
155185
run: |-

.github/workflows/python-packaging.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,26 @@ concurrency:
4343
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
4444

4545
jobs:
46+
seed-build-script:
47+
runs-on: ubuntu-latest
48+
name: Pre-seed static binaries' versions
49+
steps:
50+
- env:
51+
GITHUB_TOKEN: ${{ github.token }}
52+
run: >-
53+
gh release download
54+
-R cpp-linter/clang-tools-static-binaries
55+
--pattern versions.json
56+
--output versions.json
57+
- name: Upload versions.json
58+
uses: actions/upload-artifact@v7
59+
with:
60+
name: static-binary-versions
61+
path: versions.json
62+
if-no-files-found: error
63+
4664
linux:
65+
needs: [seed-build-script]
4766
runs-on: ${{ matrix.platform.runner }}
4867
strategy:
4968
matrix:
@@ -67,7 +86,11 @@ jobs:
6786
- uses: actions/setup-python@v6
6887
with:
6988
python-version: '3.x'
70-
89+
- name: Restore build script seed
90+
uses: actions/download-artifact@v8
91+
with:
92+
name: static-binary-versions
93+
path: clang-installer
7194
- name: Build wheels
7295
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
7396
with:
@@ -104,6 +127,7 @@ jobs:
104127
path: dist/*
105128

106129
windows:
130+
needs: [seed-build-script]
107131
runs-on: ${{ matrix.platform.runner }}
108132
strategy:
109133
matrix:
@@ -120,6 +144,11 @@ jobs:
120144
with:
121145
python-version: '3.x'
122146
architecture: ${{ matrix.platform.target }}
147+
- name: Restore build script seed
148+
uses: actions/download-artifact@v8
149+
with:
150+
name: static-binary-versions
151+
path: clang-installer
123152
- name: Build wheels
124153
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
125154
with:
@@ -133,6 +162,7 @@ jobs:
133162
path: dist/*
134163

135164
macos:
165+
needs: [seed-build-script]
136166
runs-on: ${{ matrix.platform.runner }}
137167
strategy:
138168
fail-fast: false
@@ -149,6 +179,11 @@ jobs:
149179
- uses: actions/setup-python@v6
150180
with:
151181
python-version: '3.x'
182+
- name: Restore build script seed
183+
uses: actions/download-artifact@v8
184+
with:
185+
name: static-binary-versions
186+
path: clang-installer
152187
- name: Build wheels
153188
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
154189
with:

.github/workflows/run-dev-tests.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ concurrency:
2929
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
3030

3131
jobs:
32+
seed-build-script:
33+
runs-on: ubuntu-latest
34+
name: Pre-seed static binaries' versions
35+
steps:
36+
- env:
37+
GITHUB_TOKEN: ${{ github.token }}
38+
run: >-
39+
gh release download
40+
-R cpp-linter/clang-tools-static-binaries
41+
--pattern versions.json
42+
--output versions.json
43+
- name: Upload versions.json
44+
uses: actions/upload-artifact@v7
45+
with:
46+
name: static-binary-versions
47+
path: versions.json
48+
if-no-files-found: error
49+
3250
test:
3351
strategy:
3452
fail-fast: false
@@ -98,13 +116,16 @@ jobs:
98116
- name: Install nushell
99117
uses: hustcer/setup-nu@92c296ba1ba2ba04cc948ab64ddefe192dc13f0c # v3.23
100118

119+
- name: Restore build script seed
120+
uses: actions/download-artifact@v8
121+
with:
122+
name: static-binary-versions
123+
path: clang-installer
124+
101125
- name: Run test suite
102126
shell: nu {0}
103127
run: |-
104-
let version_info = (
105-
(^gh release download -R cpp-linter/clang-tools-static-binaries --pattern versions.json --output -)
106-
| from json
107-
)
128+
let version_info = open "clang-installer/versions.json"
108129
mut max_ver = 0
109130
mut min_ver = 99
110131
for ver in ($version_info.llvm_versions | columns) {
@@ -116,6 +137,7 @@ jobs:
116137
$max_ver = $ver
117138
}
118139
}
140+
let min_ver = $min_ver # make immutable
119141
for $ver in ($min_ver..$max_ver) {
120142
print $"::group::Testing with clang v($ver)"
121143
with-env { CLANG_VERSION: $"($ver)" } {

0 commit comments

Comments
 (0)