Skip to content

Commit 779b98d

Browse files
committed
Update CI to Supported Versions (#22)
- Update our GitHub Actions to the latest major versions. - Update our `setup_sbuild.sh` script to support the updated Ubuntu 24.04 GH runners. - Enable CI to run on PRs. (cherry picked from commit d984544)
1 parent 1373a76 commit 779b98d

File tree

2 files changed

+61
-16
lines changed

2 files changed

+61
-16
lines changed

.github/workflows/apt.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ on:
44
push:
55
branches:
66
- release/**
7+
pull_request:
8+
branches:
9+
- master
710

811
jobs:
912
build-source-package:
1013
runs-on: ubuntu-latest
1114
strategy:
15+
fail-fast: false
1216
matrix:
1317
dist: ${{ fromJSON(vars.BUILD_DISTS) }}
1418
steps:
15-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
1620
- name: Install dependencies
1721
run: |
1822
sudo apt-get update && \
1923
sudo apt-get install \
20-
debhelper dput tcl-tls libsystemd-dev pkg-config
24+
debhelper dput tcl-tls libsystemd-dev pkg-config build-essential
2125
- name: Determine version
2226
run: |
2327
VERSION=$(head -1 debian/changelog | sed 's/^.*([0-9]*:*\([0-9.]*\)-.*$/\1/')
@@ -41,22 +45,33 @@ jobs:
4145
redis_*.orig.tar.gz
4246
4347
build-binary-package:
44-
runs-on: ubuntu-latest
48+
runs-on: ${{ contains(matrix.arch, 'arm') && 'ubuntu24-arm64-2-8' || 'ubuntu-latest' }}
4549
strategy:
50+
fail-fast: false
4651
matrix:
4752
dist: ${{ fromJSON(vars.BUILD_DISTS) }}
4853
arch: ${{ fromJSON(vars.BUILD_ARCHS) }}
4954
exclude: ${{ fromJSON(vars.BUILD_EXCLUDE) }}
5055
needs: build-source-package
5156
steps:
52-
- uses: actions/checkout@v2
57+
- uses: actions/checkout@v4
5358
- name: Determine build architecture
5459
run: |
55-
if [ ${{ matrix.arch }} = "i386" ]; then
56-
BUILD_ARCH=i386
57-
else
58-
BUILD_ARCH=amd64
59-
fi
60+
case ${{ matrix.arch }} in
61+
i386)
62+
BUILD_ARCH=i386
63+
;;
64+
arm64)
65+
BUILD_ARCH=arm64
66+
;;
67+
armhf)
68+
BUILD_ARCH=armhf
69+
;;
70+
*)
71+
BUILD_ARCH=amd64
72+
;;
73+
esac
74+
6075
echo "BUILD_ARCH=${BUILD_ARCH}" >> $GITHUB_ENV
6176
- name: Setup APT Signing key
6277
run: |
@@ -96,6 +111,7 @@ jobs:
96111
env:
97112
ARCH: amd64
98113
strategy:
114+
fail-fast: false
99115
matrix:
100116
image: ${{ fromJSON(vars.SMOKE_TEST_IMAGES) }}
101117
container: ${{ matrix.image }}
@@ -116,6 +132,7 @@ jobs:
116132
echo ping | redis-cli -p 26379
117133
118134
upload-packages:
135+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
119136
env:
120137
DEB_S3_VERSION: "0.11.3"
121138
runs-on: ubuntu-latest

setup_sbuild.sh

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#!/bin/bash
32
if [ $# != 2 ]; then
43
echo "Please use: setup_build.sh [dist] [arch]"
@@ -13,11 +12,18 @@ else
1312
disttype="debian"
1413
fi
1514

16-
# Determine base apt repository URL based on type of distribution.
15+
if [ "$dist" = "focal" ]; then
16+
ubuntu_ports="/ubuntu-ports"
17+
fi
18+
# Determine base apt repository URL based on type of distribution and architecture.
1719
case "$disttype" in
1820
ubuntu)
19-
url=http://archive.ubuntu.com/ubuntu
20-
;;
21+
if [ "$arch" = "arm64" ] || [ "$arch" = "armhf" ]; then
22+
url=http://ports.ubuntu.com/ubuntu-ports
23+
else
24+
url=http://archive.ubuntu.com/ubuntu
25+
fi
26+
;;
2127
debian)
2228
url=http://deb.debian.org/debian
2329
;;
@@ -31,12 +37,34 @@ sbuild-createchroot \
3137
${dist} `mktemp -d` ${url}
3238

3339
# Ubuntu has the main and ports repositories on different URLs, so we need to
34-
# properly set up /etc/apt/sources.list to make cross compilation work.
40+
# properly set up /etc/apt/sources.list to make cross compilation work
41+
# and enable multi-architecture support inside a chroot environment
3542
if [ "$disttype" = "ubuntu" ]; then
43+
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture i386
44+
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture armhf
45+
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture arm64
46+
# Update /etc/apt/sources.list for cross-compilation (Ubuntu)
3647
cat <<__END__ | schroot -c source:${dist}-${arch}-sbuild -d / -- tee /etc/apt/sources.list
3748
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu ${dist} main universe
3849
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu ${dist}-updates main universe
39-
deb [arch=armhf,arm64] http://ports.ubuntu.com ${dist} main universe
40-
deb [arch=armhf,arm64] http://ports.ubuntu.com ${dist}-updates main universe
50+
deb [arch=armhf,arm64] http://ports.ubuntu.com${ubuntu_ports} ${dist} main universe
51+
deb [arch=armhf,arm64] http://ports.ubuntu.com${ubuntu_ports} ${dist}-updates main universe
52+
__END__
53+
54+
elif [ "$disttype" = "debian" ]; then
55+
# enable multi-architecture support inside a chroot environment
56+
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture i386
57+
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture armhf
58+
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture arm64
59+
# Update /etc/apt/sources.list for cross-compilation (Debian)
60+
cat <<__END__ | schroot -c source:${dist}-${arch}-sbuild -d / -- tee /etc/apt/sources.list
61+
deb [arch=amd64,i386,armhf,arm64] http://deb.debian.org/debian ${dist} main contrib non-free non-free-firmware
62+
deb [arch=amd64,i386,armhf,arm64] http://deb.debian.org/debian ${dist}-updates main contrib non-free non-free-firmware
63+
deb [arch=amd64,i386,armhf,arm64] http://deb.debian.org/debian-security ${dist}-security main contrib non-free non-free-firmware
4164
__END__
4265
fi
66+
if [ "$dist" = "focal" ]; then
67+
# Install gcc-10 and g++-10 which are required in case of Ubuntu Focal to support Ranges library, introduced in C++20
68+
schroot -c source:${dist}-${arch}-sbuild -d / -- bash -c "apt update && apt remove -y gcc-9 g++-9 gcc-9-base && apt upgrade -yqq && apt install -y gcc build-essential gcc-10 g++-10 clang-format clang lcov openssl"
69+
schroot -c source:${dist}-${arch}-sbuild -d / -- bash -c "[ -f /usr/bin/gcc-10 ] && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10|| echo 'gcc-10 installation failed'"
70+
fi

0 commit comments

Comments
 (0)