Skip to content

Commit

Permalink
ERL-270: github: workflows: nemos-images: build qemu-arm64 targets
Browse files Browse the repository at this point in the history
This makes use of the kiwi box build plugin to create an arm64 VM.

Additionally, roll the spread step into the build step. This adds more
complication to the build step, but allows us to test each target
individually without running out of resources. Spread does not have a
way to limit how many VMs are created, and as more and more targets are
added, we quickly run out of resources on the GitHub runners.

Signed-off-by: Isaac True <isaac.true@canonical.com>
  • Loading branch information
IsaacJT committed Sep 11, 2023
1 parent 1e1a4fa commit 740af42
Showing 1 changed file with 38 additions and 43 deletions.
81 changes: 38 additions & 43 deletions .github/workflows/nemos-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: nemos-images
on:
pull_request: {}
jobs:
qemu-amd64:
qemu:
runs-on: "ubuntu-latest"
strategy:
matrix:
Expand All @@ -13,6 +13,9 @@ jobs:
config:
- minimal
- reference
arch:
- amd64
- arm64
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -28,20 +31,42 @@ jobs:
- name: "Install Kiwi"
run: |
sudo DEBIAN_FRONTEND="noninteractive" \
apt install -y kiwi kiwi-systemdeps
apt install -y kiwi kiwi-systemdeps python3-kiwi-boxed-plugin
- name: "Run Kiwi"
run: |
sudo kiwi-ng --debug --profile bootstrapped \
--config nemos-images-${{ matrix.config }}-${{ matrix.series }}/kiwi.yaml \
system build --target-dir build \
--description nemos-images-${{ matrix.config }}-${{ matrix.series }}/qemu-amd64/
sudo mv build/nemos-image-${{ matrix.config }}-${{ matrix.series }}.*.qcow2 \
nemos-image-${{ matrix.config }}-${{ matrix.series }}-amd64.qcow2
- name: "Archive"
uses: "actions/upload-artifact@v3"
with:
name: "nemos-image-${{ matrix.config }}-${{ matrix.series }}-amd64"
path: "nemos-image-${{ matrix.config }}-${{ matrix.series }}-amd64.qcow2"
# If we are building for amd64, then we can build natively. Otherwise,
# we need to use the Kiwi boxbuild plugin to build in a VM
if [ "${{ matrix.arch }}" = "amd64" ]; then
sudo kiwi-ng --debug --profile bootstrapped \
--config nemos-images-${{ matrix.config }}-${{ matrix.series }}/kiwi.yaml \
system build --target-dir build \
--description nemos-images-${{ matrix.config }}-${{ matrix.series }}/qemu-${{ matrix.arch}}/
else
sudo kiwi-ng --debug --profile bootstrapped \
system boxbuild \
--box ubuntu --aarch64 --machine=virt --no-accel --cpu cortex-a53 \
--box-memory=$(( 4 * 1024 )) --box-smp-cpus=2 -- \
--target-dir build \
--description nemos-images-${{ matrix.config }}-${{ matrix.series }}/qemu-${{ matrix.arch }}/
fi
- name: "Install spread dependencies"
run: |
sudo DEBIAN_FRONTEND="noninteractive" \
apt install -y golang sshpass qemu-system-x86_64 ovmf \
qemu-system-arm qemu-efi-aarch64
- name: "Install spread"
run: |
go clean -modcache
go install github.com/snapcore/spread/cmd/spread@latest
- name: "Copy QEMU image to spread directory"
run: |
mkdir -p ~/.spread/adhoc
sudo mv -v build/nemos-image*.qcow2 \
~/.spread/adhoc/nemos-image-${{ matrix.config }}-${{ matrix.series }}-${{ matrix.arch }}.qcow2
sudo chmod a+rw ~/.spread/adhoc/*.qcow2
- name: "Run the spread tests inside QEMU"
run: |
~/go/bin/spread -v "adhoc:nemos-image-${{ matrix.config }}-${{ matrix.series }}-${{ matrix.arch }}"
s32g274ardb2:
runs-on: "ubuntu-latest"
strategy:
Expand Down Expand Up @@ -77,33 +102,3 @@ jobs:
--box-memory=$(( 2 * 1024 )) --box-smp-cpus=2 -- \
--target-dir build \
--description nemos-images-${{ matrix.config }}-${{ matrix.series }}/s32g274ardb2/
spread:
runs-on: "ubuntu-latest"
needs: "qemu-amd64"
steps:
- uses: "actions/checkout@v3"
- name: "Update system packages"
run: |
sudo apt update
sudo DEBIAN_FRONTEND="noninteractive" \
apt full-upgrade -y
- name: "Install dependencies"
run: |
sudo DEBIAN_FRONTEND="noninteractive" \
apt install -y golang ovmf qemu-system-x86 sshpass
- name: "Install spread"
run: |
go clean -modcache
go install github.com/snapcore/spread/cmd/spread@latest
- name: "Download QEMU images"
uses: actions/download-artifact@v3
- name: "Copy QEMU images to spread directory"
run: |
mkdir -p ~/.spread/adhoc
mv -v nemos-image-*/*.qcow2 ~/.spread/adhoc/
- name: "Run the spread tests inside QEMU"
run: |
# Currently, we only support amd64. Use the spread wildcard selector
# to make sure we only run those images.
~/go/bin/spread -v "adhoc:...-amd64"

0 comments on commit 740af42

Please sign in to comment.