From 14e67f3ee72246de15d9b9295127cfc949f956c1 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 28 Nov 2024 10:22:38 +0100 Subject: [PATCH 1/3] Show b2 binary and source version --- ci/common_install.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/common_install.sh b/ci/common_install.sh index 91fddbcc..3b9ff69d 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -176,9 +176,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 +189,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 From ece2826848ba1544a038c81968a24ee1109e1af3 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 26 Nov 2024 09:48:06 +0100 Subject: [PATCH 2/3] GHA: Cache boost checkout 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. --- .github/workflows/ci.yml | 11 +++++++++++ ci/common_install.sh | 2 ++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fea1174c..a33de29a 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 != '' }} + run: rm -rf boost-root; mv "${BOOST_ROOT}" boost-root + working-directory: ${{github.workspace}} windows: defaults: run: diff --git a/ci/common_install.sh b/ci/common_install.sh index 3b9ff69d..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 From cb3b3fb544adba3ef58ebe76bf3715980aef8f1e Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 27 Nov 2024 10:28:17 +0100 Subject: [PATCH 3/3] 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