Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spread test riscv64 ubuntu server image #247

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 54 additions & 10 deletions .github/workflows/spread-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Tests
on: [pull_request]

jobs:
snap-build:
snap-build-amd64:
runs-on: ubuntu-24.04
# Only build the snap for pull requests, it's not needed on release branches
# or on master since we have launchpad build recipes which do this already
Expand All @@ -18,36 +18,77 @@ jobs:
- name: Uploading ubuntu-image snap artifact
uses: actions/upload-artifact@v4
with:
name: snap
name: snap-amd64
path: "*.snap"
if-no-files-found: error

snap-build-arm64:
runs-on: [self-hosted, ARM64, noble, Linux]
# Only build the snap for pull requests, it's not needed on release branches
# or on master since we have launchpad build recipes which do this already
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build ubuntu-image snap
uses: snapcore/action-build@v1

- name: Uploading ubuntu-image snap artifact
uses: actions/upload-artifact@v4
with:
name: snap-arm64
path: "*.snap"
if-no-files-found: error

spread:
name: Build a ${{ matrix.series }} image on ${{ matrix.group }} (${{ matrix.systems }})
runs-on: [self-hosted, ubuntu-image]
needs: snap-build
needs: [snap-build-amd64, snap-build-arm64]
strategy:
fail-fast: false
matrix:
include:
- group: ubuntu-devel
series: oracular
arch: amd64
systems: 'ubuntu-24.04-64'
tests: 'tests/commons/... tests/amd64/...'
- group: ubuntu-devel-crossbuild
series: oracular
arch: amd64
systems: 'ubuntu-24.04-64'
tests: 'tests/amd64-crossbuild/...'
- group: ubuntu-latest
series: noble
arch: amd64
systems: 'ubuntu-24.04-64'
tests: 'tests/amd64/...'
- group: ubuntu-latest-crossbuild
series: noble
arch: amd64
systems: 'ubuntu-24.04-64'
tests: 'tests/amd64-crossbuild/...'
- group: ubuntu-old
series: noble
arch: amd64
systems: 'ubuntu-20.04-64 ubuntu-22.04-64'
tests: 'tests/commons/... tests/amd64/...'
- group: ubuntu-arm-devel
series: oracular
arch: arm64
systems: 'ubuntu-24.04-arm-64'
tests: 'tests/commons/... tests/arm64/...'
- group: ubuntu-arm-latest
series: noble
arch: arm64
systems: 'ubuntu-24.04-arm-64'
tests: 'tests/arm64/...'
- group: ubuntu-arm-old
series: noble
arch: arm64
systems: 'ubuntu-20.04-arm-64 ubuntu-22.04-arm-64'
tests: 'tests/commons/... tests/arm64/...'

steps:
- name: Cleanup job workspace
Expand All @@ -73,10 +114,11 @@ jobs:
key: "${{ github.job }}-results-${{ github.run_id }}-${{ matrix.group }}-${{ steps.get-previous-attempt.outputs.previous_attempt }}"

# Needed for some older series we are unable to build the snap on anymore
- name: Download previsouly build artifact
- name: Download previously built artifacts
uses: actions/download-artifact@v4
with:
name: snap
pattern: snap-${{ matrix.arch }}
merge-multiple: true

- name: Prepare test results env and vars
id: prepare-test-results-env
Expand Down Expand Up @@ -113,12 +155,12 @@ jobs:
echo "::add-matcher::.github/spread-problem-matcher.json"

BACKEND=google
SPREAD=spread
SERIES=${{ matrix.series }}

if [[ "${{ matrix.systems }}" =~ -arm- ]]; then
BACKEND=google-arm
SPREAD=spread-arm
elif [[ "${{ matrix.group }}" =~ -crossbuild ]]; then
BACKEND=google-crossbuild
fi

RUN_TESTS=""
Expand All @@ -127,15 +169,17 @@ jobs:
RUN_TESTS="$FAILED_TESTS"
else
for SYSTEM in ${{ matrix.systems }}; do
RUN_TESTS="$RUN_TESTS $BACKEND:$SYSTEM:tests/..."
for TESTS in ${{ matrix.tests }}; do
RUN_TESTS="$RUN_TESTS $BACKEND:$SYSTEM:$TESTS"
done
done
fi
# Run spread tests
# "pipefail" ensures that a non-zero status from the spread is
# propagated; and we use a subshell as this option could trigger
# undesired changes elsewhere
echo "Running command: $SPREAD $RUN_TESTS"
(set -o pipefail; $SPREAD $RUN_TESTS | tee spread.log)
echo "Running command: spread $RUN_TESTS"
(set -o pipefail; spread $RUN_TESTS | tee spread.log)

- name: Discard spread workers
if: always()
Expand Down
34 changes: 24 additions & 10 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ backends:
- ubuntu-24.04-64:
storage: 45G
workers: 1
google-crossbuild:
type: google
key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
location: snapd-spread/us-east1-b
plan: n2-standard-4
halt-timeout: 2h
systems:
- ubuntu-24.04-64:
storage: 45G
workers: 1
google-arm:
type: google
key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
Expand Down Expand Up @@ -104,29 +114,28 @@ prepare: |
fi

apt update
apt install -y snapd libc6-dev git
apt install -y snapd libc6-dev git ubuntu-dev-tools
if [[ ! "$SPREAD_BACKEND" == *-arm ]]; then
apt install -y gcc-multilib binfmt-support qemu-user-static
fi

snap install core24
snap install yq
snap install snapcraft --classic

# Setup lxd
# Make sure we use the snap version
apt remove -y lxd
snap install lxd
lxd init --auto

# Build and install the snap
rm -rf ubuntu-image_*.snap || true
snapcraft


# Install the snap
snap install --classic --dangerous ubuntu-image_*.snap

unset SHELL
git clone -b $SERIES https://git.launchpad.net/ubuntu-images
git clone https://github.com/canonical/risc-v-gadget
mv risc-v-gadget/image-definition.yaml ubuntu-images/ubuntu-server-riscv64.yaml
git clone https://github.com/snapcore/models

debug: |
Expand All @@ -140,6 +149,11 @@ suites:
backends: [google, qemu]
environment:
IMG/ubuntu_server_pc_amd64: ubuntu-server-pc-amd64
tests/amd64-crossbuild/:
summary: Integration tests for ubuntu-image on amd64
backends: [google-crossbuild, qemu]
environment:
IMG/ubuntu_server_riscv64: ubuntu-server-riscv64
IMG/ubuntu_server_pi_arm64: ubuntu-server-pi-arm64
tests/arm64/:
summary: Integration tests for ubuntu-image on arm64
Expand All @@ -148,5 +162,5 @@ suites:
IMG/ubuntu_server_pi_arm64: ubuntu-server-pi-arm64
IMG/ubuntu_server_pc_arm64: ubuntu-server-pc-arm64
IMG/ubuntu_pi_arm64: ubuntu-pi-arm64

kill-timeout: 30m
1 change: 1 addition & 0 deletions tests/amd64-crossbuild
Loading