From 3f3cadc5252d1e827e644fbb714683c326df2e94 Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Thu, 19 Mar 2026 12:22:32 -0700 Subject: [PATCH] CI: Add ARM builder Do a ZFS build inside of an ARM runner. This only does a simple build, it does not run the test suite. The build runs on the runner itself rather than in a VM, since nesting is not supported on Github ARM runners. Reviewed-by: Brian Behlendorf Reviewed-by: George Melikov Signed-off-by: Tony Hutter Closes #18343 --- .github/workflows/scripts/qemu-3-deps-vm.sh | 22 +++++++++-- .github/workflows/scripts/qemu-4-build-vm.sh | 11 +++++- .github/workflows/zfs-arm.yml | 40 ++++++++++++++++++++ .github/workflows/zfs-qemu.yml | 2 +- 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/zfs-arm.yml diff --git a/.github/workflows/scripts/qemu-3-deps-vm.sh b/.github/workflows/scripts/qemu-3-deps-vm.sh index c8e1a015a..6a83ef45f 100755 --- a/.github/workflows/scripts/qemu-3-deps-vm.sh +++ b/.github/workflows/scripts/qemu-3-deps-vm.sh @@ -3,8 +3,11 @@ ###################################################################### # 3) install dependencies for compiling and loading # -# $1: OS name (like 'fedora41') -# $2: (optional) Experimental Fedora kernel version, like "6.14" to +# qemu-3-deps-vm.sh [--poweroff] OS_NAME [FEDORA_VERSION] +# +# --poweroff: Power off the VM after installing dependencies +# OS_NAME: OS name (like 'fedora41') +# FEDORA_VERSION: (optional) Experimental Fedora kernel version, like "6.14" to # install instead of Fedora defaults. ###################################################################### @@ -153,6 +156,12 @@ function install_fedora_experimental_kernel { sudo dnf -y copr disable @kernel-vanilla/mainline } +POWEROFF="" +if [ "$1" == "--poweroff" ] ; then + POWEROFF=1 + shift +fi + # Install dependencies case "$1" in almalinux8) @@ -212,6 +221,11 @@ case "$1" in sudo apt-get install -yq linux-tools-common libtirpc-dev \ linux-modules-extra-$(uname -r) sudo apt-get install -yq dh-sequence-dkms + + # Need 'build-essential' explicitly for ARM builder + # https://github.com/actions/runner-images/issues/9946 + sudo apt-get install -yq build-essential + echo "##[endgroup]" echo "##[group]Delete Ubuntu OpenZFS modules" for i in $(find /lib/modules -name zfs -type d); do sudo rm -rvf $i; done @@ -306,5 +320,7 @@ esac # reset cloud-init configuration and poweroff sudo cloud-init clean --logs -sleep 2 && sudo poweroff & +if [ "$POWEROFF" == "1" ] ; then + sleep 2 && sudo poweroff & +fi exit 0 diff --git a/.github/workflows/scripts/qemu-4-build-vm.sh b/.github/workflows/scripts/qemu-4-build-vm.sh index 38255cf39..bbfa2ec85 100755 --- a/.github/workflows/scripts/qemu-4-build-vm.sh +++ b/.github/workflows/scripts/qemu-4-build-vm.sh @@ -350,7 +350,16 @@ fi # save some sysinfo uname -a > /var/tmp/uname.txt -cd $HOME/zfs +# Check if we're running this script from within a VM or on the runner itself. +# Most of the time we will be running in a VM, but the ARM builder actually +# runs this script on the runner. If we happen to be running on the ARM +# runner, we will start in the ZFS source directory. If we're running on a VM +# then we'll just start in our home directory, and will need to 'cd' into our +# source directory. +if [ ! -e META ] ; then + cd $HOME/zfs +fi + export PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" extra="" diff --git a/.github/workflows/zfs-arm.yml b/.github/workflows/zfs-arm.yml new file mode 100644 index 000000000..6039e4736 --- /dev/null +++ b/.github/workflows/zfs-arm.yml @@ -0,0 +1,40 @@ +name: zfs-arm + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + zfs-arm: + name: ZFS ARM build + runs-on: ubuntu-24.04-arm + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + timeout-minutes: 20 + run: | + sudo apt-get -y remove firefox || true + .github/workflows/scripts/qemu-3-deps-vm.sh ubuntu24 + + # We're running the VM scripts locally on the runner, so need to fix + # up hostnames to make it work. + for ((i=0; i<=3; i++)); do + echo "127.0.0.1 vm$i" | sudo tee -a /etc/hosts + done + - name: Build modules + timeout-minutes: 30 + run: | + .github/workflows/scripts/qemu-4-build-vm.sh --enable-debug ubuntu24 + + # Quick sanity test since we're not running the full ZTS + sudo modprobe zfs + sudo dmesg | grep -i zfs + truncate -s 100M file + sudo zpool create tank ./file + zpool status + + echo "Built ZFS successfully on ARM" diff --git a/.github/workflows/zfs-qemu.yml b/.github/workflows/zfs-qemu.yml index 08ac889d3..113369916 100644 --- a/.github/workflows/zfs-qemu.yml +++ b/.github/workflows/zfs-qemu.yml @@ -118,7 +118,7 @@ jobs: - name: Install dependencies timeout-minutes: 60 - run: .github/workflows/scripts/qemu-3-deps.sh ${{ matrix.os }} ${{ github.event.inputs.fedora_kernel_ver }} + run: .github/workflows/scripts/qemu-3-deps.sh --poweroff ${{ matrix.os }} ${{ github.event.inputs.fedora_kernel_ver }} - name: Build modules timeout-minutes: 30