Skip to content

Commit

Permalink
GHA: Cache boost checkout
Browse files Browse the repository at this point in the history
Instead of cloning the Boost main repository and later potentially many
submodules (by `depinst.py`) we can cache the last checkout.
On any changes the checkout-and-pull should update it to the appropriate
version.
  • Loading branch information
Flamefire committed Nov 26, 2024
1 parent 341eee7 commit 5aa75a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,21 @@ jobs:
BDDE_ARCH: ${{matrix.arch}}
run: ci/github/setup_bdde.sh

- name: Cache Boost checkout
uses: actions/cache@v3
if: env.GHA_USE_NODE_20 == 'false'
with:
path: boost-root
key: boost-checkout-cache-${{matrix.os}}-${{matrix.container}}-${{github.sha}}
restore-keys: ${{matrix.os}}-${{matrix.container}}-
- name: Cache Boost checkout
uses: actions/cache@v4
if: env.GHA_USE_NODE_20 == 'true'
with:
path: boost-root
key: boost-checkout-cache-${{matrix.os}}-${{matrix.container}}-${{github.sha}}
restore-keys: ${{matrix.os}}-${{matrix.container}}-

- name: Setup Boost
env:
B2_ADDRESS_MODEL: ${{matrix.address-model}}
Expand Down Expand Up @@ -292,6 +307,10 @@ jobs:
COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}

- name: Prepare for cache
if: ${{ env.BOOST_ROOT != '' }}
run: rm -rf boost-root; mv "${BOOST_ROOT}" boost-root
working-directory: ${{github.workspace}}
windows:
defaults:
run:
Expand Down
2 changes: 2 additions & 0 deletions ci/common_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ else
export BOOST_BRANCH="develop"
fi

# CI cache might have restored the boost-root folder in the current directory
[ ! -d boost-root ] || mv boost-root ..
cd ..

if [ ! -d boost-root ]; then
Expand Down

0 comments on commit 5aa75a4

Please sign in to comment.