From 524737e867bca4a4630a0bd39b426bdf8363d538 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 28 Nov 2024 10:22:38 +0100 Subject: [PATCH 1/4] Show b2 binary and source version --- ci/common_install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/common_install.sh b/ci/common_install.sh index dcc1a571..174c1b6b 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -313,6 +313,11 @@ if [[ "${B2_DONT_BOOTSTRAP:0}" != "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 043d1a9f6c268330d22fadbe1a1c43c7d2759189 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 26 Nov 2024 09:48:06 +0100 Subject: [PATCH 2/4] 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/reusable.yml | 12 ++++++++++++ ci/common_install.sh | 2 ++ 2 files changed, 14 insertions(+) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index dd713948..a5e971b7 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -417,6 +417,13 @@ jobs: BDDE_EDITION: ${{matrix.edition}} BDDE_ARCH: ${{matrix.arch}} + - name: Cache Boost checkout + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + 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 run: source ci/github/install.sh env: @@ -472,6 +479,11 @@ 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}} + generate-windows-matrix: runs-on: ubuntu-latest outputs: diff --git a/ci/common_install.sh b/ci/common_install.sh index 174c1b6b..34d2096a 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -81,6 +81,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 65c6db80a7f8065387a92625f1b52437e8899df0 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Wed, 27 Nov 2024 10:28:17 +0100 Subject: [PATCH 3/4] 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/reusable.yml | 4 ++-- ci/github/install.sh | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index a5e971b7..82bb6a23 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -480,8 +480,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}} generate-windows-matrix: diff --git a/ci/github/install.sh b/ci/github/install.sh index 5cb3b824..b311e227 100644 --- a/ci/github/install.sh +++ b/ci/github/install.sh @@ -40,6 +40,11 @@ fi # shellcheck disable=SC1091 . "$(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 From 48521abe4c692dfaf05aa6efd8a0d97b8c9e85b6 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 26 Nov 2024 20:04:42 +0100 Subject: [PATCH 4/4] Add timing info to b2 --- ci/common_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/common_install.sh b/ci/common_install.sh index 34d2096a..b654ecf0 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -304,7 +304,7 @@ if [[ "${B2_DONT_BOOTSTRAP:0}" != "1" ]]; then # 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 - ${B2_WRAPPER:-} ./bootstrap.sh + time ${B2_WRAPPER:-} ./bootstrap.sh else # b2 expects versions to match engineversion=$(echo "$b2_version_output" | tr -s ' ' | cut -d' ' -f2 | cut -d'-' -f1) @@ -320,7 +320,7 @@ if [[ "${B2_DONT_BOOTSTRAP:0}" != "1" ]]; then else echo "Unable to extract B2 version from $b2_version_output" fi - ${B2_WRAPPER:-} ./bootstrap.sh + time ${B2_WRAPPER:-} ./bootstrap.sh fi fi trap - ERR