diff --git a/.github/workflows/spread-test.yaml b/.github/workflows/spread-test.yaml index 20291293..a2d9ccf2 100644 --- a/.github/workflows/spread-test.yaml +++ b/.github/workflows/spread-test.yaml @@ -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 @@ -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 @@ -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 @@ -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="" @@ -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() diff --git a/spread.yaml b/spread.yaml index 0047c5f2..1027c3ac 100644 --- a/spread.yaml +++ b/spread.yaml @@ -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")' @@ -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: | @@ -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 @@ -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 diff --git a/tests/amd64-crossbuild b/tests/amd64-crossbuild new file mode 120000 index 00000000..33a92686 --- /dev/null +++ b/tests/amd64-crossbuild @@ -0,0 +1 @@ +amd64 \ No newline at end of file