Skip to content

Commit a043c8e

Browse files
committed
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 <[email protected]>
1 parent 338aaab commit a043c8e

File tree

2 files changed

+34
-76
lines changed

2 files changed

+34
-76
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ jobs:
120120
uses: ./.github/actions/bootc-ubuntu-setup
121121
- name: Build mdbook
122122
run: just build-mdbook
123-
# Build containers and disk images for integration testing across OS matrix
124-
build-integration:
123+
# Build bootc from source into a container image FROM each specified base `test_os`
124+
# running unit and integration tests (using TMT, leveraging the support for nested virtualization
125+
# in the GHA runners)
126+
test-integration:
125127
strategy:
126128
fail-fast: false
127129
matrix:
@@ -135,49 +137,43 @@ jobs:
135137
uses: ./.github/actions/bootc-ubuntu-setup
136138
with:
137139
libvirt: true
140+
- name: Install tmt
141+
run: pip install --user "tmt[provision-virtual]"
138142

139143
- name: Build container and disk image
140144
run: |
141-
tests/build.sh ${{ matrix.test_os }}
145+
set -xeuo pipefail
146+
build_args=()
147+
# Map from an ID-VERSIONID pair to a container ref
148+
target=${{ matrix.test_os }}
149+
OS_ID=$(echo "$target" | cut -d '-' -f 1)
150+
OS_VERSION_ID=$(echo "$target" | cut -d '-' -f 2)
151+
# Base image
152+
case "$OS_ID" in
153+
"centos")
154+
BASE="quay.io/centos-bootc/centos-bootc:stream${OS_VERSION_ID}"
155+
;;
156+
"fedora")
157+
BASE="quay.io/fedora/fedora-bootc:${OS_VERSION_ID}"
158+
;;
159+
*) echo "Unknown OS: ${OS_ID}" 1>&2; exit 1
160+
;;
161+
esac
162+
build_args+=("--build-arg=base=$BASE")
163+
just build ${build_args[@]}
164+
just build-integration-test-image
165+
# Cross check we're using the right base
166+
used_vid=$(podman run --rm localhost/bootc-integration bash -c '. /usr/lib/os-release && echo $VERSION_ID')
167+
test "$OS_VERSION_ID" = "${used_vid}"
142168
143169
- name: Run container tests
144-
run:
170+
run: |
145171
just test-container
146172
147-
- name: Archive disk image
148-
uses: actions/upload-artifact@v5
149-
with:
150-
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk
151-
path: target/bootc-integration-test.qcow2
152-
retention-days: 1
153-
154-
# Run TMT-based integration tests on disk images from build-integration
155-
test-integration:
156-
needs: build-integration
157-
strategy:
158-
fail-fast: false
159-
matrix:
160-
test_os: [fedora-42, fedora-43, centos-9, centos-10]
161-
162-
runs-on: ubuntu-24.04
163-
164-
steps:
165-
- uses: actions/checkout@v5
166-
- name: Bootc Ubuntu Setup
167-
uses: ./.github/actions/bootc-ubuntu-setup
168-
with:
169-
libvirt: true
170-
- name: Install tmt
171-
run: pip install --user "tmt[provision-virtual]"
172-
173-
- name: Create folder to save disk image
174-
run: mkdir -p target
175-
176-
- name: Download disk.raw
177-
uses: actions/download-artifact@v6
178-
with:
179-
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk
180-
path: target
173+
- name: Generate disk image
174+
run: |
175+
mkdir -p target
176+
just build-disk-image localhost/bootc-integration target/bootc-integration-test.qcow2
181177
182178
- name: Workaround https://github.com/teemtee/testcloud/issues/18
183179
run: sudo rm -f /usr/bin/chcon && sudo ln -sr /usr/bin/true /usr/bin/chcon

tests/build.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)