mirror of
https://github.com/fmtlib/fmt.git
synced 2026-10-29 02:17:28 +08:00
Cache packages in Linux CI
Compilers are installed from third-party archives that periodically return 50x or throttle to a crawl, which fails the build. Keep the downloaded packages and restore them on the next run so that both apt and the legacy wget-based installs work from disk instead of refetching. apt, unlike apt-get, discards downloaded packages after installing them unless the binary-specific Keep-Downloaded-Packages is set. The cache is written once per key; bump the -v1 suffix to refresh it after the package versions change.
This commit is contained in:
parent
7a3b442edc
commit
fdf31252e6
25
.github/workflows/linux.yml
vendored
25
.github/workflows/linux.yml
vendored
@ -86,13 +86,27 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
||||
# Packages are installed from third-party archives that periodically
|
||||
# return 50x or throttle, which otherwise fails the build. The key covers
|
||||
# everything that determines the package set; bump the -v1 suffix to
|
||||
# discard the cached packages.
|
||||
- name: Cache packages
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/apt-cache
|
||||
key: pkg-${{matrix.os || 'ubuntu-22.04'}}-${{matrix.cxx}}-${{matrix.install}}-v1
|
||||
|
||||
- name: Create package cache directory
|
||||
run: mkdir -p ~/apt-cache
|
||||
|
||||
- name: Install GCC 4.9
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libatomic1 libc6-dev libgomp1 libitm1 libmpc3
|
||||
cd ~/apt-cache
|
||||
# https://launchpad.net/ubuntu/xenial/amd64/g++-4.9/4.9.3-13ubuntu2
|
||||
# launchpad periodically returns 50x errors, so retry to avoid flaky CI.
|
||||
wget --no-verbose --tries=5 --waitretry=10 \
|
||||
wget --no-verbose --no-clobber --tries=5 --waitretry=10 \
|
||||
--retry-connrefused --retry-on-http-error=502,503,504 \
|
||||
http://launchpadlibrarian.net/230069137/libmpfr4_3.1.3-2_amd64.deb \
|
||||
http://launchpadlibrarian.net/253728424/libasan1_4.9.3-13ubuntu2_amd64.deb \
|
||||
@ -123,9 +137,10 @@ jobs:
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libtinfo5
|
||||
cd ~/apt-cache
|
||||
# https://code.launchpad.net/ubuntu/xenial/amd64/clang-3.6/1:3.6.2-3ubuntu2
|
||||
# launchpad periodically returns 50x errors, so retry to avoid flaky CI.
|
||||
wget --no-verbose --tries=5 --waitretry=10 \
|
||||
wget --no-verbose --no-clobber --tries=5 --waitretry=10 \
|
||||
--retry-connrefused --retry-on-http-error=502,503,504 \
|
||||
http://launchpadlibrarian.net/230019046/libffi6_3.2.1-4_amd64.deb \
|
||||
http://launchpadlibrarian.net/445346109/libasan2_5.4.0-6ubuntu1~16.04.12_amd64.deb \
|
||||
@ -186,9 +201,15 @@ jobs:
|
||||
|
||||
- name: Create build environment
|
||||
run: |
|
||||
# apt (unlike apt-get) defaults to discarding downloaded packages, so
|
||||
# the binary-specific setting is required to populate the cache.
|
||||
printf 'Binary::apt::APT::Keep-Downloaded-Packages "true";\n' | \
|
||||
sudo tee /etc/apt/apt.conf.d/99keep-packages
|
||||
sudo cp -n ~/apt-cache/*.deb /var/cache/apt/archives || true
|
||||
sudo apt update
|
||||
${{matrix.install}}
|
||||
sudo apt install locales-all
|
||||
cp -n /var/cache/apt/archives/*.deb ~/apt-cache || true
|
||||
cmake -E make_directory ${{runner.workspace}}/build
|
||||
|
||||
- name: Select matching C compiler
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user