Skip to content

Commit 8a16c75

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 8a16c75

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,17 @@ 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+
ls -lah /opt/cache
418+
ln -s /opt/cache/*.tar.* .
408419
- name: Build
409420
env:
410421
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
@@ -413,13 +424,20 @@ jobs:
413424
TAG: ${{needs.prepare.outputs.TAG}}
414425
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
415426
run: |
427+
ls -lah /opt/cache || true
416428
sudo apt-get update && sudo apt-get install libltdl-dev swig autoconf-archive
417429
./build-make.sh $(pwd)/install/llvm-mingw --host=${{matrix.arch}}-w64-mingw32
418430
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
419431
cd install
420432
NAME=llvm-mingw-$TAG-${{matrix.crt}}-${{matrix.arch}}
421433
mv llvm-mingw $NAME
422434
zip -9rq ../$NAME.zip $NAME
435+
cd ..
436+
set -x
437+
mkdir -p /opt/cache
438+
for i in make-*.tar.*; do
439+
if [ ! -L $i ]; then cp -a $i /opt/cache; fi
440+
done
423441
- uses: actions/upload-artifact@v4
424442
with:
425443
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)