Skip to content

Commit 1e7938d

Browse files
committed
ci: Run unit tests once per OS instead of once per test-integration leg
I noticed we were spending a lot of time in each integration test job building Rust code for the unit tests. Since none of that varies per matrix, move that into the package job. Assisted-by: https://github.com/cgwalters/cgwalters#llms Signed-off-by: Colin Walters <walters@verbum.org>
1 parent c60b918 commit 1e7938d

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ jobs:
211211
path: target/packages/*.rpm
212212
retention-days: 1
213213

214+
# Unit tests don't depend on the variant/filesystem/bootloader/boot_type/seal_state
215+
# axes used by the test-integration matrix below, so we run them once per OS here
216+
# (reusing the BuildKit cache already warmed by `just check-buildsys` above) instead
217+
# of once per matrix leg.
218+
- name: Unit tests
219+
run: just unit-tests
220+
214221
# Build bootc from source into a container image FROM each specified base `test_os`
215222
# running unit and integration tests (using TMT, leveraging the support for nested virtualization
216223
# in the GHA runners)
@@ -310,8 +317,8 @@ jobs:
310317
used_vid=$(podman run --rm localhost/bootc bash -c '. /usr/lib/os-release && echo ${ID}-${VERSION_ID}')
311318
test ${{ matrix.test_os }} = "${used_vid}"
312319
313-
- name: Unit and container integration tests
314-
run: BOOTC_SKIP_PACKAGE=1 just test-container
320+
- name: Container integration tests
321+
run: BOOTC_SKIP_PACKAGE=1 just test-container-integration
315322

316323
- name: Validate composefs digest (UKI only)
317324
if: matrix.boot_type == 'uki'

Justfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,25 @@ test-tmt *ARGS: build
188188
@just _build-upgrade-image
189189
@just test-tmt-nobuild {{ARGS}}
190190

191-
# Run containerized unit and integration tests
191+
# Split out from `test-container` because, unlike the container integration tests,
192+
# unit tests don't depend on variant/filesystem/bootloader/boot_type/seal_state, so
193+
# CI runs this once per OS (in the `package` job) instead of once per test-integration
194+
# matrix leg.
195+
# Run the unit test suite in a container (needs e.g. ostree/composefs shared libs)
192196
[group('core')]
193-
test-container: build build-units
197+
unit-tests: build-units
194198
podman run --rm --read-only localhost/bootc-units /usr/bin/bootc-units
199+
200+
# Used by CI's test-integration matrix, where unit tests already ran once per OS.
201+
# Run the container integration tests only (no unit tests)
202+
[group('core')]
203+
test-container-integration: build
195204
podman run --rm --env=BOOTC_variant={{variant}} --env=BOOTC_base={{base}} --env=BOOTC_boot_type={{boot_type}} --mount=type=image,source={{base_img}},target=/run/target {{base_img}} bootc-integration-tests container
196205

206+
# Run containerized unit and integration tests
207+
[group('core')]
208+
test-container: unit-tests test-container-integration
209+
197210
[group('core')]
198211
test-composefs bootloader filesystem boot_type seal_state *ARGS:
199212
@if [ "{{seal_state}}" = "sealed" ] && [ "{{filesystem}}" = "xfs" ]; then \

0 commit comments

Comments
 (0)