debian-forge/.github/workflows/test.yml
Michael Vogt d9a228d3e8 workflow: simplify unit test running in the GH workflow
Run only two jobs in the GH runner for the unittest. The `test_stage.py`
because it takes a very long time and needs to run in parallel and
all the other tests.

This split avoid that we forget to add new unittests to the matrix
as we did before (see e.g. https://github.com/osbuild/osbuild/pull/1731)
and it will also enable the tests in:
- sources/test
- inputs/tests
- mounts/test

to run.

This will reduce the "granularity" of the test output a bit, in the
GH runner we only see two unit test matrix jobs now. However that
should not be too bad because the non-stage tests are really quick
to run.
2024-04-16 15:16:49 +02:00

66 lines
2.3 KiB
YAML

name: Tests
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# Share the store between the workers speeds things up further
OSBUILD_TEST_STORE: /var/tmp/osbuild-test-store
jobs:
test_suite:
name: "Unittest"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test:
- parallel
- normal
environment:
- "py36" # RH8
- "py39" # RH9
- "py312" # latest fedora
steps:
- name: "Clone Repository"
uses: actions/checkout@v4
- name: "Run"
uses: osbuild/containers/src/actions/privdocker@552e30cf1b4ed19c6ddaa57f96c342b3dff4227b
with:
image: ghcr.io/osbuild/osbuild-ci:latest-202308241910
run: |
# Hacky replacement of container storage driver:
# The default overlayfs doesn't work in the runner, so let's change
# it to vfs for the local storage skopeo stage test.
sed -i 's/overlay/vfs/g' /usr/share/containers/storage.conf # default system config
sed -i 's/overlay/vfs/g' /etc/containers/storage.conf || true # potential overrides
if [ "${{ matrix.test }}" == "parallel" ]; then
# 4 is a bit arbitrary
TEST_WORKERS="-n 4"
TEST_CATEGORY="test_stages.py"
else
# test_assemblers.py is run below
TEST_CATEGORY="not test_stages.py and not test_assemblers.py"
fi
OSBUILD_TEST_STORE="${{ env.OSBUILD_TEST_STORE }}" \
tox -e "${{ matrix.environment }}" -- $TEST_WORKERS -k "$TEST_CATEGORY"
v1_manifests:
name: "Assembler test (legacy)"
runs-on: ubuntu-latest
steps:
- name: "Clone Repository"
uses: actions/checkout@v4
- name: "Run"
uses: osbuild/containers/src/actions/privdocker@552e30cf1b4ed19c6ddaa57f96c342b3dff4227b
env:
# Using 4 workers is a bit arbitrary, "auto" is probably too aggressive.
TEST_WORKERS: "-n 4"
with:
image: ghcr.io/osbuild/osbuild-ci:latest-202308241910
run: |
OSBUILD_TEST_STORE="${{ env.OSBUILD_TEST_STORE }}" \
tox -e "py36" -- ${{ env.TEST_WORKERS }} test.run.test_assemblers