Skip to content

Commit

Permalink
build: Matrix strategy for release builds ([ElementsProject#7776]).
Browse files Browse the repository at this point in the history
Also modifies the `build-release.sh` script to optionally
accept specific distribution targets for Ubuntu releases.
  • Loading branch information
s373nZ committed Nov 6, 2024
1 parent 1209b5e commit 887030d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ jobs:
ubuntu-noble:
name: Release
runs-on: ubuntu-24.04
strategy:
fail-fast: false # Let each build finish.
matrix:
target:
- 'bin-Fedora-28-amd64'
- 'bin-Ubuntu-focal'
- 'bin-Ubuntu-jammy'
- 'bin-Ubuntu-noble'
steps:
- name: Git checkout
uses: actions/checkout@v4
Expand All @@ -32,14 +40,26 @@ jobs:
./configure
- name: Build environment setup
run: contrib/cl-repro.sh
run: |
distribution=$(echo ${{ matrix.target }} | cut -d'-' -f3)
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}
# Build Docker image
docker build -t cl-repro-${distribution} - < contrib/reprobuild/Dockerfile.${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
with:
path: release/
name: ${{ matrix.target }}
if-no-files-found: error
7 changes: 5 additions & 2 deletions tools/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tools/repro-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')}

Expand Down

0 comments on commit 887030d

Please sign in to comment.