Skip to content

Commit cfc7187

Browse files
authored
Merge pull request #4406 from esl/ci-build-packages-for-arm64
Add building `arm64` packages to CI pipeline
2 parents ae7aad7 + 431357e commit cfc7187

File tree

5 files changed

+149
-9
lines changed

5 files changed

+149
-9
lines changed

.circleci/template.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,11 @@ jobs:
707707
name: Build package
708708
command: |
709709
./tools/test.sh -p pkg -s false
710+
- run:
711+
name: Verify package architecture
712+
command: |
713+
./tools/circle-install-packages.sh rpm
714+
./tools/pkg/verify_arch.sh
710715
- when:
711716
condition:
712717
matches:
@@ -749,66 +754,132 @@ workflows:
749754
platform: debian-bookworm
750755
context: mongooseim-org
751756
filters: *all_tags_and_master
757+
- package:
758+
name: debian-bookworm-arm64
759+
executor: otp_27_arm64
760+
platform: debian-bookworm
761+
context: mongooseim-org
762+
filters: *all_tags_and_master
752763
- package:
753764
name: debian-bullseye
754765
executor: otp_27
755766
platform: debian-bullseye
756767
context: mongooseim-org
757768
filters: *all_tags_and_master
769+
- package:
770+
name: debian-bullseye-arm64
771+
executor: otp_27_arm64
772+
platform: debian-bullseye
773+
context: mongooseim-org
774+
filters: *all_tags_and_master
758775
- package:
759776
name: debian-buster
760777
executor: otp_27
761778
platform: debian-buster
762779
context: mongooseim-org
763780
filters: *all_tags_and_master
781+
- package:
782+
name: debian-buster-arm64
783+
executor: otp_27_arm64
784+
platform: debian-buster
785+
context: mongooseim-org
786+
filters: *all_tags_and_master
764787
- package:
765788
name: ubuntu-oracular
766789
executor: otp_27
767790
platform: ubuntu-oracular
768791
context: mongooseim-org
769792
filters: *all_tags_and_master
793+
- package:
794+
name: ubuntu-oracular-arm64
795+
executor: otp_27_arm64
796+
platform: ubuntu-oracular
797+
context: mongooseim-org
798+
filters: *all_tags_and_master
770799
- package:
771800
name: ubuntu-noble
772801
executor: otp_27
773802
platform: ubuntu-noble
774803
context: mongooseim-org
775804
filters: *all_tags_and_master
805+
- package:
806+
name: ubuntu-noble-arm64
807+
executor: otp_27_arm64
808+
platform: ubuntu-noble
809+
context: mongooseim-org
810+
filters: *all_tags_and_master
776811
- package:
777812
name: ubuntu-jammy
778813
executor: otp_27
779814
platform: ubuntu-jammy
780815
context: mongooseim-org
781816
filters: *all_tags_and_master
817+
- package:
818+
name: ubuntu-jammy-arm64
819+
executor: otp_27_arm64
820+
platform: ubuntu-jammy
821+
context: mongooseim-org
822+
filters: *all_tags_and_master
782823
- package:
783824
name: ubuntu-focal
784825
executor: otp_27
785826
platform: ubuntu-focal
786827
context: mongooseim-org
787828
filters: *all_tags_and_master
829+
- package:
830+
name: ubuntu-focal-arm64
831+
executor: otp_27_arm64
832+
platform: ubuntu-focal
833+
context: mongooseim-org
834+
filters: *all_tags_and_master
788835
- package:
789836
name: rockylinux-9
790837
executor: otp_27
791838
platform: rockylinux-9
792839
context: mongooseim-org
793840
filters: *all_tags_and_master
841+
- package:
842+
name: rockylinux-9-arm64
843+
executor: otp_27_arm64
844+
platform: rockylinux-9
845+
context: mongooseim-org
846+
filters: *all_tags_and_master
794847
- package:
795848
name: rockylinux-8
796849
executor: otp_27
797850
platform: rockylinux-8
798851
context: mongooseim-org
799852
filters: *all_tags_and_master
853+
- package:
854+
name: rockylinux-8-arm64
855+
executor: otp_27_arm64
856+
platform: rockylinux-8
857+
context: mongooseim-org
858+
filters: *all_tags_and_master
800859
- package:
801860
name: almalinux-9
802861
executor: otp_27
803862
platform: almalinux-9
804863
context: mongooseim-org
805864
filters: *all_tags_and_master
865+
- package:
866+
name: almalinux-9-arm64
867+
executor: otp_27_arm64
868+
platform: almalinux-9
869+
context: mongooseim-org
870+
filters: *all_tags_and_master
806871
- package:
807872
name: almalinux-8
808873
executor: otp_27
809874
platform: almalinux-8
810875
context: mongooseim-org
811876
filters: *all_tags_and_master
877+
- package:
878+
name: almalinux-8-arm64
879+
executor: otp_27_arm64
880+
platform: almalinux-8
881+
context: mongooseim-org
882+
filters: *all_tags_and_master
812883
# ======== BASE DOCKER BUILDS ========
813884
- build_in_docker:
814885
name: otp_27_docker

tools/pkg/Dockerfile_deb

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,28 @@ FROM $builder_image AS builder
88
# Install build deps
99
ENV DEBIAN_FRONTEND=noninteractive
1010
RUN apt-get update
11-
RUN apt-get install -y locales git make zlib1g-dev unixodbc-dev gcc g++ libssl-dev curl gpg wget gnupg
11+
RUN apt-get install -y locales git make zlib1g-dev unixodbc-dev gcc g++ libssl-dev curl gpg
1212

1313
# The signing script requires debsigs version 0.2 or higher, which is unavailable in
1414
# package repositories of Ubuntu versions earlier than 24.10 and Debian versions earlier than 13.
15-
# TODO: Switch to installing debsigs via apt once support for these older versions is dropped.
16-
RUN wget http://ftp.de.debian.org/debian/pool/main/d/debsigs/debsigs_0.2.2-1_all.deb && \
17-
dpkg -i debsigs_0.2.2-1_all.deb && \
18-
rm debsigs_0.2.2-1_all.deb && \
19-
which debsigs
15+
# TODO: Remove custom repo setup once older distro support ends.
16+
RUN arch=$(dpkg --print-architecture) && \
17+
distro=$(grep ^ID= /etc/os-release | cut -d= -f2 | tr -d '"') && \
18+
if [ "$distro" = "ubuntu" ]; then \
19+
if [ "$arch" = "arm64" ]; then \
20+
echo "deb http://ports.ubuntu.com/ubuntu-ports oracular main restricted universe multiverse" >> /etc/apt/sources.list; \
21+
else \
22+
echo "deb http://archive.ubuntu.com/ubuntu oracular main restricted universe multiverse" >> /etc/apt/sources.list; \
23+
fi && \
24+
printf "Package: debsigs\nPin: release n=oracular\nPin-Priority: 990\n" > /etc/apt/preferences.d/debsigs; \
25+
elif [ "$distro" = "debian" ]; then \
26+
echo "deb http://deb.debian.org/debian trixie main" >> /etc/apt/sources.list && \
27+
printf "Package: debsigs\nPin: release n=trixie\nPin-Priority: 990\n" > /etc/apt/preferences.d/debsigs; \
28+
fi && \
29+
apt-get update && \
30+
apt-get install -y --no-install-recommends debsigs && \
31+
sed -i '/oracular/d' /etc/apt/sources.list && \
32+
sed -i '/trixie/d' /etc/apt/sources.list
2033

2134
ARG erlang_version
2235

tools/pkg/scripts/deb/build_package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version=$1
55
revision=$2
66
otp_version=$3
77

8-
arch="amd64"
8+
arch=$(dpkg --print-architecture)
99

1010
cd ~/mongooseim
1111

tools/pkg/scripts/rpm/build_package.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,20 @@ version=$1
55
revision=$2
66
otp_version=$3
77

8-
arch="x86_64"
9-
package_name_arch="amd64"
8+
arch=$(uname -m)
109

10+
case "$arch" in
11+
x86_64)
12+
package_name_arch="amd64"
13+
;;
14+
aarch64)
15+
package_name_arch="arm64"
16+
;;
17+
*)
18+
echo "Unsupported architecture: $arch"
19+
exit 1
20+
;;
21+
esac
1122

1223
rpmbuild -bb \
1324
--define "version ${version}" \

tools/pkg/verify_arch.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
executor_arch=$(uname -m)
2+
case "$executor_arch" in
3+
x86_64)
4+
expected_arch="amd64"
5+
;;
6+
aarch64)
7+
expected_arch="arm64"
8+
;;
9+
*)
10+
echo "Unsupported executor architecture: $executor_arch"
11+
exit 1
12+
;;
13+
esac
14+
15+
echo "Executor architecture detected: $expected_arch"
16+
17+
package_file=$(find tools/pkg/packages -name "*.deb" -o -name "*.rpm")
18+
if [ -z "$package_file" ]; then
19+
echo "No package found in the output directory."
20+
exit 1
21+
fi
22+
23+
if [[ $package_file == *.deb ]]; then
24+
actual_arch=$(dpkg --info "$package_file" | grep Architecture | awk '{print $2}')
25+
elif [[ $package_file == *.rpm ]]; then
26+
actual_arch=$(rpm -qi "$package_file" | grep Architecture | awk '{print $2}')
27+
if [ "$actual_arch" == "x86_64" ]; then
28+
actual_arch="amd64"
29+
elif [ "$actual_arch" == "aarch64" ]; then
30+
actual_arch="arm64"
31+
else
32+
echo "Unable to determine architecture from file output."
33+
exit 1
34+
fi
35+
else
36+
echo "Unknown package type: $package_file"
37+
exit 1
38+
fi
39+
40+
if [ "$expected_arch" != "$actual_arch" ]; then
41+
echo "Architecture mismatch: expected $expected_arch but got $actual_arch"
42+
exit 1
43+
fi
44+
45+
echo "Package architecture verified: $actual_arch"

0 commit comments

Comments
 (0)