Skip to content

Commit

Permalink
Update CI to Supported Versions (#22)
Browse files Browse the repository at this point in the history
- 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 38f1856)
  • Loading branch information
adamiBs committed Jan 16, 2025
1 parent 847d437 commit 7d95974
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 16 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ on:
push:
branches:
- release/**
pull_request:
branches:
- master

jobs:
build-source-package:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dist: ${{ fromJSON(vars.BUILD_DISTS) }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update && \
sudo apt-get install \
debhelper dput tcl-tls libsystemd-dev pkg-config
debhelper dput tcl-tls libsystemd-dev pkg-config build-essential
- name: Determine version
run: |
VERSION=$(head -1 debian/changelog | sed 's/^.*([0-9]*:*\([0-9.]*\)-.*$/\1/')
Expand All @@ -41,22 +45,33 @@ jobs:
redis_*.orig.tar.gz
build-binary-package:
runs-on: ubuntu-latest
runs-on: ${{ contains(matrix.arch, 'arm') && 'ubuntu24-arm64-2-8' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
dist: ${{ fromJSON(vars.BUILD_DISTS) }}
arch: ${{ fromJSON(vars.BUILD_ARCHS) }}
exclude: ${{ fromJSON(vars.BUILD_EXCLUDE) }}
needs: build-source-package
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Determine build architecture
run: |
if [ ${{ matrix.arch }} = "i386" ]; then
BUILD_ARCH=i386
else
BUILD_ARCH=amd64
fi
case ${{ matrix.arch }} in
i386)
BUILD_ARCH=i386
;;
arm64)
BUILD_ARCH=arm64
;;
armhf)
BUILD_ARCH=armhf
;;
*)
BUILD_ARCH=amd64
;;
esac
echo "BUILD_ARCH=${BUILD_ARCH}" >> $GITHUB_ENV
- name: Setup APT Signing key
run: |
Expand Down Expand Up @@ -96,6 +111,7 @@ jobs:
env:
ARCH: amd64
strategy:
fail-fast: false
matrix:
image: ${{ fromJSON(vars.SMOKE_TEST_IMAGES) }}
container: ${{ matrix.image }}
Expand All @@ -116,6 +132,7 @@ jobs:
echo ping | redis-cli -p 26379
upload-packages:
if: github.event_name == 'push' && github.ref == 'refs/heads/release/*'
env:
DEB_S3_VERSION: "0.11.3"
runs-on: ubuntu-latest
Expand Down
42 changes: 35 additions & 7 deletions setup_sbuild.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#!/bin/bash
if [ $# != 2 ]; then
echo "Please use: setup_build.sh [dist] [arch]"
Expand All @@ -13,11 +12,18 @@ else
disttype="debian"
fi

# Determine base apt repository URL based on type of distribution.
if [ "$dist" = "focal" ]; then
ubuntu_ports="/ubuntu-ports"
fi
# Determine base apt repository URL based on type of distribution and architecture.
case "$disttype" in
ubuntu)
url=http://archive.ubuntu.com/ubuntu
;;
if [ "$arch" = "arm64" ] || [ "$arch" = "armhf" ]; then
url=http://ports.ubuntu.com/ubuntu-ports
else
url=http://archive.ubuntu.com/ubuntu
fi
;;
debian)
url=http://deb.debian.org/debian
;;
Expand All @@ -31,12 +37,34 @@ sbuild-createchroot \
${dist} `mktemp -d` ${url}

# Ubuntu has the main and ports repositories on different URLs, so we need to
# properly set up /etc/apt/sources.list to make cross compilation work.
# properly set up /etc/apt/sources.list to make cross compilation work
# and enable multi-architecture support inside a chroot environment
if [ "$disttype" = "ubuntu" ]; then
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture i386
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture armhf
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture arm64
# Update /etc/apt/sources.list for cross-compilation (Ubuntu)
cat <<__END__ | schroot -c source:${dist}-${arch}-sbuild -d / -- tee /etc/apt/sources.list
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu ${dist} main universe
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu ${dist}-updates main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com ${dist} main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com ${dist}-updates main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com${ubuntu_ports} ${dist} main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com${ubuntu_ports} ${dist}-updates main universe
__END__

elif [ "$disttype" = "debian" ]; then
# enable multi-architecture support inside a chroot environment
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture i386
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture armhf
schroot -c source:${dist}-${arch}-sbuild -d / -- dpkg --add-architecture arm64
# Update /etc/apt/sources.list for cross-compilation (Debian)
cat <<__END__ | schroot -c source:${dist}-${arch}-sbuild -d / -- tee /etc/apt/sources.list
deb [arch=amd64,i386,armhf,arm64] http://deb.debian.org/debian ${dist} main contrib non-free non-free-firmware
deb [arch=amd64,i386,armhf,arm64] http://deb.debian.org/debian ${dist}-updates main contrib non-free non-free-firmware
deb [arch=amd64,i386,armhf,arm64] http://deb.debian.org/debian-security ${dist}-security main contrib non-free non-free-firmware
__END__
fi
if [ "$dist" = "focal" ]; then
# Install gcc-10 and g++-10 which are required in case of Ubuntu Focal to support Ranges library, introduced in C++20
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"
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'"
fi

0 comments on commit 7d95974

Please sign in to comment.