Skip to content

Commit dc5c8b6

Browse files
committed
github: Cache the gnu make tarball
This avoids breaking the build if the gnu download server is unavailable.
1 parent 40604cd commit dc5c8b6

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
@@ -405,6 +405,16 @@ jobs:
405405
sudo mv llvm-mingw* /opt/llvm-mingw
406406
echo /opt/llvm-mingw/bin >> $GITHUB_PATH
407407
- uses: actions/checkout@v4
408+
- name: Cache downloads
409+
id: cache-tarballs
410+
uses: actions/cache@v4
411+
with:
412+
path: /opt/cache
413+
key: tarballs-${{ hashFiles('build-make.sh') }}
414+
- name: Restore cache
415+
if: steps.cache-tarballs.outputs.cache-hit != ''
416+
run: |
417+
ln -s /opt/cache/*.tar.* .
408418
- name: Build
409419
env:
410420
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -420,6 +430,13 @@ jobs:
420430
NAME=llvm-mingw-$TAG-${{matrix.crt}}-${{matrix.arch}}
421431
mv llvm-mingw $NAME
422432
zip -9rq ../$NAME.zip $NAME
433+
- name: Save cache
434+
if: steps.cache-tarballs.outputs.cache-hit != 'true'
435+
run: |
436+
mkdir -p /opt/cache
437+
for i in make-*.tar.*; do
438+
if [ ! -L $i ]; then cp -a $i /opt/cache; fi
439+
done
423440
- uses: actions/upload-artifact@v4
424441
with:
425442
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)