From a347ae32b65afe58567a885f2947eec83fd40323 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 30 Oct 2025 10:45:58 -0400 Subject: [PATCH] ci: Just use one job for build + test In the future, we may want to "shard" tests across multiple runners, but as is right now it's basically just adding overhead to copy the disk image as an artifact across the job. While we're here, clean things up further to match the general principle that GHA flows should mostly just be running `just`. The logic from build.sh to map from strings -> containers though moves into the GHA for now. Signed-off-by: Colin Walters --- .github/workflows/ci.yml | 72 +++++++++++++++++++--------------------- tests/build.sh | 38 --------------------- 2 files changed, 34 insertions(+), 76 deletions(-) delete mode 100755 tests/build.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90cfb1867..7d9e6eb6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,8 +120,10 @@ jobs: uses: ./.github/actions/bootc-ubuntu-setup - name: Build mdbook run: just build-mdbook - # Build containers and disk images for integration testing across OS matrix - build-integration: + # Build bootc from source into a container image FROM each specified base `test_os` + # running unit and integration tests (using TMT, leveraging the support for nested virtualization + # in the GHA runners) + test-integration: strategy: fail-fast: false matrix: @@ -135,49 +137,43 @@ jobs: uses: ./.github/actions/bootc-ubuntu-setup with: libvirt: true + - name: Install tmt + run: pip install --user "tmt[provision-virtual]" - name: Build container and disk image run: | - tests/build.sh ${{ matrix.test_os }} + set -xeuo pipefail + build_args=() + # Map from an ID-VERSIONID pair to a container ref + target=${{ matrix.test_os }} + OS_ID=$(echo "$target" | cut -d '-' -f 1) + OS_VERSION_ID=$(echo "$target" | cut -d '-' -f 2) + # Base image + case "$OS_ID" in + "centos") + BASE="quay.io/centos-bootc/centos-bootc:stream${OS_VERSION_ID}" + ;; + "fedora") + BASE="quay.io/fedora/fedora-bootc:${OS_VERSION_ID}" + ;; + *) echo "Unknown OS: ${OS_ID}" 1>&2; exit 1 + ;; + esac + build_args+=("--build-arg=base=$BASE") + just build ${build_args[@]} + just build-integration-test-image + # Cross check we're using the right base + used_vid=$(podman run --rm localhost/bootc-integration bash -c '. /usr/lib/os-release && echo $VERSION_ID') + test "$OS_VERSION_ID" = "${used_vid}" - name: Run container tests - run: + run: | just test-container - - name: Archive disk image - uses: actions/upload-artifact@v5 - with: - name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk - path: target/bootc-integration-test.qcow2 - retention-days: 1 - - # Run TMT-based integration tests on disk images from build-integration - test-integration: - needs: build-integration - strategy: - fail-fast: false - matrix: - test_os: [fedora-42, fedora-43, centos-9, centos-10] - - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v5 - - name: Bootc Ubuntu Setup - uses: ./.github/actions/bootc-ubuntu-setup - with: - libvirt: true - - name: Install tmt - run: pip install --user "tmt[provision-virtual]" - - - name: Create folder to save disk image - run: mkdir -p target - - - name: Download disk.raw - uses: actions/download-artifact@v6 - with: - name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk - path: target + - name: Generate disk image + run: | + mkdir -p target + just build-disk-image localhost/bootc-integration target/bootc-integration-test.qcow2 - name: Workaround https://github.com/teemtee/testcloud/issues/18 run: sudo rm -f /usr/bin/chcon && sudo ln -sr /usr/bin/true /usr/bin/chcon diff --git a/tests/build.sh b/tests/build.sh deleted file mode 100755 index 53b4f57a2..000000000 --- a/tests/build.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# This script basically builds bootc from source using the provided base image, -# then runs the target tests. - -# If provided should be of the form fedora-42 or centos-10 -target=${1:-} -build_args=() -if test -n "${target:-}"; then - shift - # Get OS info from TEST_OS env - OS_ID=$(echo "$target" | cut -d '-' -f 1) - OS_VERSION_ID=$(echo "$target" | cut -d '-' -f 2) - - # Base image - case "$OS_ID" in - "centos") - BASE="quay.io/centos-bootc/centos-bootc:stream${OS_VERSION_ID}" - ;; - "fedora") - BASE="quay.io/fedora/fedora-bootc:${OS_VERSION_ID}" - ;; - *) echo "Unknown OS: ${OS_ID}" 1>&2; exit 1 - ;; - esac - build_args+=("--build-arg=base=$BASE") -fi - -just build ${build_args[@]} -just build-integration-test-image - -# Host builds will have this already, but we use it as a general dumping space -# for output artifacts -mkdir -p target -# Debugging for https://github.com/bootc-dev/bcvk/issues/65 -echo ulimit=$(ulimit -Hn) -just build-disk-image localhost/bootc-integration target/bootc-integration-test.qcow2