From 0037e717c839c4e6b2c8d5f0defc4b51011e9171 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 a33de29a..5cefb72f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,8 +280,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