Skip to content

Commit b0bbde0

Browse files
committed
github: Cache the gnu make tarball
This avoids breaking the build if the gnu download server is unavailable.
1 parent 06e91d0 commit b0bbde0

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,16 @@ jobs:
411411
- uses: actions/download-artifact@v4
412412
with:
413413
name: profile
414+
- name: Cache downloads
415+
id: cache-tarballs
416+
uses: actions/cache@v4
417+
with:
418+
path: /opt/cache
419+
key: tarballs-${{ hashFiles('build-make.sh') }}
420+
- name: Restore cache
421+
if: steps.cache-tarballs.outputs.cache-hit != ''
422+
run: |
423+
ln -s /opt/cache/*.tar.* .
414424
- name: Build
415425
env:
416426
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -427,6 +437,13 @@ jobs:
427437
NAME=llvm-mingw-$TAG-${{matrix.crt}}-${{matrix.arch}}
428438
mv llvm-mingw $NAME
429439
zip -9rq ../$NAME.zip $NAME
440+
- name: Save cache
441+
if: steps.cache-tarballs.outputs.cache-hit != 'true'
442+
run: |
443+
mkdir -p /opt/cache
444+
for i in make-*.tar.*; do
445+
if [ ! -L $i ]; then cp -a $i /opt/cache; fi
446+
done
430447
- uses: actions/upload-artifact@v4
431448
with:
432449
name: windows-${{matrix.crt}}-${{matrix.arch}}-toolchain

build-make.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ download() {
5252
}
5353

5454
if [ ! -d make-$MAKE_VERSION ]; then
55-
download https://ftpmirror.gnu.org/gnu/make/make-$MAKE_VERSION.tar.gz
55+
if [ ! -e make-$MAKE_VERSION.tar.gz ]; then
56+
download https://ftpmirror.gnu.org/gnu/make/make-$MAKE_VERSION.tar.gz
57+
fi
5658
tar -zxf make-$MAKE_VERSION.tar.gz
5759
fi
5860

0 commit comments

Comments
 (0)