From dacc6bdd9118962cb68b3df24726f1b02f904e3c Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 27 Nov 2024 10:28:17 +0100 Subject: [PATCH] Avoid caching build artefacts When we copy the whole boost-root AFTER the build(s) it will contain also build artefacts such as the bin.v2 folder. When restoring that later B2 might skip parts of the build although it should not. Make a copy after the initial setup & bootstrap. --- .github/workflows/ci.yml | 4 ++-- ci/github/install.sh | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55b5f5f3..5b21d6b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -308,8 +308,8 @@ jobs: 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 + if: ${{ env.BOOST_ROOT_CACHE != '' }} + run: rm -rf boost-root; mv "${BOOST_ROOT_CACHE}" boost-root working-directory: ${{github.workspace}} windows: defaults: diff --git a/ci/github/install.sh b/ci/github/install.sh index c45cc798..60049679 100644 --- a/ci/github/install.sh +++ b/ci/github/install.sh @@ -33,6 +33,11 @@ fi . $(dirname "${BASH_SOURCE[0]}")/../common_install.sh +# Save the state before building anything to avoid caching build artefacts +BOOST_ROOT_CACHE="${BOOST_ROOT}-for-cache" +echo "BOOST_ROOT_CACHE=$BOOST_ROOT_CACHE" >> $GITHUB_ENV +cp -r "$BOOST_ROOT" "$BOOST_ROOT_CACHE" + # Persist the environment for all future steps # Set by common_install.sh