Skip to content

Commit 6ea23a2

Browse files
committed
build: always cache LLVM source/build even if the tests fail to avoid extra rebuilds (#3453)
builds/macos, linux, windows: update to explicit restore/save for LLVM source and LLVM builds
1 parent 62e8861 commit 6ea23a2

File tree

3 files changed

+162
-36
lines changed

3 files changed

+162
-36
lines changed

.github/workflows/build-macos.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
with:
3030
go-version: '1.20'
3131
cache: true
32-
- name: Cache LLVM source
33-
uses: actions/cache@v3
32+
- name: Restore LLVM source cache
33+
uses: actions/cache/restore@v3
3434
id: cache-llvm-source
3535
with:
36-
key: llvm-source-15-macos-v2
36+
key: llvm-source-15-macos-v3
3737
path: |
3838
llvm-project/clang/lib/Headers
3939
llvm-project/clang/include
@@ -43,11 +43,22 @@ jobs:
4343
- name: Download LLVM source
4444
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
4545
run: make llvm-source
46-
- name: Cache LLVM build
47-
uses: actions/cache@v3
46+
- name: Save LLVM source cache
47+
uses: actions/cache/save@v3
48+
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
49+
with:
50+
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
51+
path: |
52+
llvm-project/clang/lib/Headers
53+
llvm-project/clang/include
54+
llvm-project/compiler-rt
55+
llvm-project/lld/include
56+
llvm-project/llvm/include
57+
- name: Restore LLVM build cache
58+
uses: actions/cache/restore@v3
4859
id: cache-llvm-build
4960
with:
50-
key: llvm-build-15-macos-v3
61+
key: llvm-build-15-macos-v4
5162
path: llvm-build
5263
- name: Build LLVM
5364
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -61,6 +72,12 @@ jobs:
6172
# build!
6273
make llvm-build
6374
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
75+
- name: Save LLVM build cache
76+
uses: actions/cache/save@v3
77+
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
78+
with:
79+
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
80+
path: llvm-build
6481
- name: Cache wasi-libc sysroot
6582
uses: actions/cache@v3
6683
id: cache-wasi-libc

.github/workflows/linux.yml

Lines changed: 92 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ jobs:
3939
path: |
4040
~/.cache/go-build
4141
~/go/pkg/mod
42-
- name: Cache LLVM source
43-
uses: actions/cache@v3
42+
- name: Restore LLVM source cache
43+
uses: actions/cache/restore@v3
4444
id: cache-llvm-source
4545
with:
46-
key: llvm-source-15-linux-alpine-v2
46+
key: llvm-source-15-linux-alpine-v3
4747
path: |
4848
llvm-project/clang/lib/Headers
4949
llvm-project/clang/include
@@ -53,11 +53,22 @@ jobs:
5353
- name: Download LLVM source
5454
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
5555
run: make llvm-source
56-
- name: Cache LLVM build
57-
uses: actions/cache@v3
56+
- name: Save LLVM source cache
57+
uses: actions/cache/save@v3
58+
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
59+
with:
60+
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
61+
path: |
62+
llvm-project/clang/lib/Headers
63+
llvm-project/clang/include
64+
llvm-project/compiler-rt
65+
llvm-project/lld/include
66+
llvm-project/llvm/include
67+
- name: Restore LLVM build cache
68+
uses: actions/cache/restore@v3
5869
id: cache-llvm-build
5970
with:
60-
key: llvm-build-15-linux-alpine-v3
71+
key: llvm-build-15-linux-alpine-v4
6172
path: llvm-build
6273
- name: Build LLVM
6374
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -71,6 +82,12 @@ jobs:
7182
make llvm-build
7283
# Remove unnecessary object files (to reduce cache size).
7384
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
85+
- name: Save LLVM build cache
86+
uses: actions/cache/save@v3
87+
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
88+
with:
89+
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
90+
path: llvm-build
7491
- name: Cache Binaryen
7592
uses: actions/cache@v3
7693
id: cache-binaryen
@@ -168,11 +185,11 @@ jobs:
168185
run: |
169186
curl https://wasmtime.dev/install.sh -sSf | bash
170187
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
171-
- name: Cache LLVM source
172-
uses: actions/cache@v3
188+
- name: Restore LLVM source cache
189+
uses: actions/cache/restore@v3
173190
id: cache-llvm-source
174191
with:
175-
key: llvm-source-15-linux-asserts-v2
192+
key: llvm-source-15-linux-asserts-v3
176193
path: |
177194
llvm-project/clang/lib/Headers
178195
llvm-project/clang/include
@@ -182,11 +199,22 @@ jobs:
182199
- name: Download LLVM source
183200
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
184201
run: make llvm-source
185-
- name: Cache LLVM build
186-
uses: actions/cache@v3
202+
- name: Save LLVM source cache
203+
uses: actions/cache/save@v3
204+
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
205+
with:
206+
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
207+
path: |
208+
llvm-project/clang/lib/Headers
209+
llvm-project/clang/include
210+
llvm-project/compiler-rt
211+
llvm-project/lld/include
212+
llvm-project/llvm/include
213+
- name: Restore LLVM build cache
214+
uses: actions/cache/restore@v3
187215
id: cache-llvm-build
188216
with:
189-
key: llvm-build-15-linux-asserts-v3
217+
key: llvm-build-15-linux-asserts-v4
190218
path: llvm-build
191219
- name: Build LLVM
192220
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -198,6 +226,12 @@ jobs:
198226
make llvm-build ASSERT=1
199227
# Remove unnecessary object files (to reduce cache size).
200228
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
229+
- name: Save LLVM build cache
230+
uses: actions/cache/save@v3
231+
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
232+
with:
233+
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
234+
path: llvm-build
201235
- name: Cache Binaryen
202236
uses: actions/cache@v3
203237
id: cache-binaryen
@@ -254,11 +288,11 @@ jobs:
254288
with:
255289
go-version: '1.20'
256290
cache: true
257-
- name: Cache LLVM source
258-
uses: actions/cache@v3
291+
- name: Restore LLVM source cache
292+
uses: actions/cache/restore@v3
259293
id: cache-llvm-source
260294
with:
261-
key: llvm-source-15-linux-v2
295+
key: llvm-source-15-linux-v3
262296
path: |
263297
llvm-project/clang/lib/Headers
264298
llvm-project/clang/include
@@ -268,11 +302,22 @@ jobs:
268302
- name: Download LLVM source
269303
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
270304
run: make llvm-source
271-
- name: Cache LLVM build
272-
uses: actions/cache@v3
305+
- name: Save LLVM source cache
306+
uses: actions/cache/save@v3
307+
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
308+
with:
309+
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
310+
path: |
311+
llvm-project/clang/lib/Headers
312+
llvm-project/clang/include
313+
llvm-project/compiler-rt
314+
llvm-project/lld/include
315+
llvm-project/llvm/include
316+
- name: Restore LLVM build cache
317+
uses: actions/cache/restore@v3
273318
id: cache-llvm-build
274319
with:
275-
key: llvm-build-15-linux-arm-v3
320+
key: llvm-build-15-linux-arm-v4
276321
path: llvm-build
277322
- name: Build LLVM
278323
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -286,6 +331,12 @@ jobs:
286331
make llvm-build CROSS=arm-linux-gnueabihf
287332
# Remove unnecessary object files (to reduce cache size).
288333
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
334+
- name: Save LLVM build cache
335+
uses: actions/cache/save@v3
336+
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
337+
with:
338+
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
339+
path: llvm-build
289340
- name: Cache Binaryen
290341
uses: actions/cache@v3
291342
id: cache-binaryen
@@ -354,11 +405,11 @@ jobs:
354405
with:
355406
go-version: '1.20'
356407
cache: true
357-
- name: Cache LLVM source
358-
uses: actions/cache@v3
408+
- name: Restore LLVM source cache
409+
uses: actions/cache/restore@v3
359410
id: cache-llvm-source
360411
with:
361-
key: llvm-source-15-linux-v2
412+
key: llvm-source-15-linux-v3
362413
path: |
363414
llvm-project/clang/lib/Headers
364415
llvm-project/clang/include
@@ -368,11 +419,22 @@ jobs:
368419
- name: Download LLVM source
369420
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
370421
run: make llvm-source
371-
- name: Cache LLVM build
372-
uses: actions/cache@v3
422+
- name: Save LLVM source cache
423+
uses: actions/cache/save@v3
424+
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
425+
with:
426+
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
427+
path: |
428+
llvm-project/clang/lib/Headers
429+
llvm-project/clang/include
430+
llvm-project/compiler-rt
431+
llvm-project/lld/include
432+
llvm-project/llvm/include
433+
- name: Restore LLVM build cache
434+
uses: actions/cache/restore@v3
373435
id: cache-llvm-build
374436
with:
375-
key: llvm-build-15-linux-arm64-v3
437+
key: llvm-build-15-linux-arm64-v4
376438
path: llvm-build
377439
- name: Build LLVM
378440
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -384,6 +446,12 @@ jobs:
384446
make llvm-build CROSS=aarch64-linux-gnu
385447
# Remove unnecessary object files (to reduce cache size).
386448
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
449+
- name: Save LLVM build cache
450+
uses: actions/cache/save@v3
451+
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
452+
with:
453+
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
454+
path: llvm-build
387455
- name: Cache Binaryen
388456
uses: actions/cache@v3
389457
id: cache-binaryen

.github/workflows/windows.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ jobs:
1515
build-windows:
1616
runs-on: windows-2022
1717
steps:
18+
- name: Configure pagefile
19+
uses: al-cheb/[email protected]
20+
with:
21+
minimum-size: 8GB
22+
maximum-size: 24GB
23+
disk-root: "C:"
1824
- uses: brechtm/setup-scoop@v2
1925
with:
2026
scoop_update: 'false'
@@ -31,11 +37,11 @@ jobs:
3137
with:
3238
go-version: '1.20'
3339
cache: true
34-
- name: Cache LLVM source
35-
uses: actions/cache@v3
40+
- name: Restore cached LLVM source
41+
uses: actions/cache/restore@v3
3642
id: cache-llvm-source
3743
with:
38-
key: llvm-source-15-windows-v2
44+
key: llvm-source-15-windows-v4
3945
path: |
4046
llvm-project/clang/lib/Headers
4147
llvm-project/clang/include
@@ -45,11 +51,22 @@ jobs:
4551
- name: Download LLVM source
4652
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
4753
run: make llvm-source
48-
- name: Cache LLVM build
49-
uses: actions/cache@v3
54+
- name: Save cached LLVM source
55+
uses: actions/cache/save@v3
56+
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
57+
with:
58+
key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
59+
path: |
60+
llvm-project/clang/lib/Headers
61+
llvm-project/clang/include
62+
llvm-project/compiler-rt
63+
llvm-project/lld/include
64+
llvm-project/llvm/include
65+
- name: Restore cached LLVM build
66+
uses: actions/cache/restore@v3
5067
id: cache-llvm-build
5168
with:
52-
key: llvm-build-15-windows-v3
69+
key: llvm-build-15-windows-v5
5370
path: llvm-build
5471
- name: Build LLVM
5572
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -62,6 +79,12 @@ jobs:
6279
make llvm-build CCACHE=OFF
6380
# Remove unnecessary object files (to reduce cache size).
6481
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
82+
- name: Save cached LLVM build
83+
uses: actions/cache/save@v3
84+
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
85+
with:
86+
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
87+
path: llvm-build
6588
- name: Cache wasi-libc sysroot
6689
uses: actions/cache@v3
6790
id: cache-wasi-libc
@@ -100,6 +123,12 @@ jobs:
100123
runs-on: windows-2022
101124
needs: build-windows
102125
steps:
126+
- name: Configure pagefile
127+
uses: al-cheb/[email protected]
128+
with:
129+
minimum-size: 8GB
130+
maximum-size: 24GB
131+
disk-root: "C:"
103132
- uses: brechtm/setup-scoop@v2
104133
with:
105134
scoop_update: 'false'
@@ -131,6 +160,12 @@ jobs:
131160
runs-on: windows-2022
132161
needs: build-windows
133162
steps:
163+
- name: Configure pagefile
164+
uses: al-cheb/[email protected]
165+
with:
166+
minimum-size: 8GB
167+
maximum-size: 24GB
168+
disk-root: "C:"
134169
- name: Checkout
135170
uses: actions/checkout@v3
136171
- name: Install Go
@@ -154,6 +189,12 @@ jobs:
154189
runs-on: windows-2022
155190
needs: build-windows
156191
steps:
192+
- name: Configure pagefile
193+
uses: al-cheb/[email protected]
194+
with:
195+
minimum-size: 8GB
196+
maximum-size: 24GB
197+
disk-root: "C:"
157198
- uses: brechtm/setup-scoop@v2
158199
with:
159200
scoop_update: 'false'

0 commit comments

Comments
 (0)