diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fea1174c..5cefb72f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -225,6 +225,13 @@ jobs: BDDE_ARCH: ${{matrix.arch}} run: ci/github/setup_bdde.sh + - name: Cache Boost checkout + uses: actions/cache@v4 + with: + path: boost-root + key: boost-checkout-cache-${{matrix.os}}-${{matrix.container}}-${{github.sha}} + restore-keys: boost-checkout-cache-${{matrix.os}}-${{matrix.container}}- + - name: Setup Boost env: B2_ADDRESS_MODEL: ${{matrix.address-model}} @@ -272,6 +279,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_CACHE != '' }} + run: rm -rf boost-root; mv "${BOOST_ROOT_CACHE}" boost-root + working-directory: ${{github.workspace}} windows: defaults: run: diff --git a/ci/common_install.sh b/ci/common_install.sh index 91fddbcc..3b5c09b5 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -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 @@ -176,9 +178,10 @@ if [[ "$B2_DONT_BOOTSTRAP" != "1" ]]; then trap show_bootstrap_log ERR # Check if b2 already exists. This would (only) happen in a caching scenario. The purpose of caching is to save time by not recompiling everything. # The user may clear cache or delete b2 beforehand if they wish to rebuild. - if [ ! -f b2 ] || ! b2_version_output=$(./b2 --version); then + if [ ! -f b2 ]; then ${B2_WRAPPER} ./bootstrap.sh else + b2_version_output=$(./b2 --version) # b2 expects versions to match engineversion=$(echo "$b2_version_output" | tr -s ' ' | cut -d' ' -f2 | cut -d'-' -f1) enginemajorversion=$(echo "${engineversion}" | cut -d'.' -f1) @@ -188,6 +191,11 @@ if [[ "$B2_DONT_BOOTSTRAP" != "1" ]]; then if [[ "${enginemajorversion}" == "${coremajorversion}" ]] && [[ "${engineminorversion}" == "${coreminorversion}" ]]; then echo "b2 already exists and has the same version number" else + if [[ "$engineversion" =~ ^[0-9]\.[0-9]\. ]]; then + echo "b2 binary version: $enginemajorversion:$engineminorversion vs source version $coremajorversion:$coreminorversion" + else + echo "Unable to extract B2 version from $b2_version_output" + fi ${B2_WRAPPER} ./bootstrap.sh fi fi 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