From b08fe0df84cd0e193fcf643d6feb2dcce8912d7a Mon Sep 17 00:00:00 2001 From: Se7enZ Date: Wed, 6 Nov 2024 19:59:04 +0100 Subject: [PATCH] build: Matrix strategy for release builds ([#7776]). Also modifies the `build-release.sh` script to optionally accept specific distribution targets for Ubuntu releases. --- .github/workflows/release.yml | 20 ++++++++++++++++++-- tools/build-release.sh | 7 +++++-- tools/repro-build.sh | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d20419cde9cd..915738540723 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,14 @@ jobs: ubuntu-noble: name: Release runs-on: ubuntu-24.04 + strategy: + fail-fast: false # Let each build finish. + matrix: + targets: + - 'bin-Fedora-28-amd64' + - 'bin-Ubuntu-focal' + - 'bin-Ubuntu-jammy' + - 'bin-Ubuntu-noble' steps: - name: Git checkout uses: actions/checkout@v4 @@ -32,11 +40,19 @@ jobs: ./configure - name: Build environment setup - run: contrib/cl-repro.sh + run: | + distribution="${${{ matrix.target }}#bin-Ubuntu-}" + echo "Building base image for ${distribution}" + sudo docker run --rm -v $(pwd):/build ubuntu:${distribution} bash -c "\ + apt-get update && \ + apt-get install -y debootstrap && \ + debootstrap ${distribution} /build/${distribution}" + sudo tar -C ${distribution} -c . | docker import - ${distribution} + if: contains(matrix.target, "Ubuntu") - name: Build release # TODO: Remove forced version after testing. - run: tools/build-release.sh bin-Fedora-28-amd64 bin-Ubuntu + run: tools/build-release.sh ${{ matrix.target }} - name: Upload release artifacts uses: actions/upload-artifact@v4 diff --git a/tools/build-release.sh b/tools/build-release.sh index 0924ff675f84..f98b47961156 100755 --- a/tools/build-release.sh +++ b/tools/build-release.sh @@ -153,8 +153,11 @@ for target in $TARGETS; do docker run --rm=true -w /build $TAG rm -rf /"$VERSION-$platform" /build echo "Fedora Image Built" ;; - Ubuntu) - for d in focal jammy noble; do + Ubuntu*) + distributions=${platform#Ubuntu-} + echo "distributions=$distributions" + [ "$distributions" == "Ubuntu" ] && distributions="focal jammy noble" + for d in $distributions; do # Capitalize the first letter of distro D=$(echo "$d" | awk '{print toupper(substr($0,1,1))substr($0,2)}') echo "Building Ubuntu $D Image" diff --git a/tools/repro-build.sh b/tools/repro-build.sh index 6c346616c623..dac5a1b0e791 100755 --- a/tools/repro-build.sh +++ b/tools/repro-build.sh @@ -53,6 +53,7 @@ else VER=$(uname -r) fi +ARCH=$(dpkg --print-architecture) PLATFORM="$OS"-"$VER" VERSION=${FORCE_VERSION:-$(git describe --tags --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's,.*/clightning-\(v[0-9.rc\-]*\)$,\1,p')}