From d9a228d3e851ebed16a4b0e6e2917ffd73088027 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 16 Apr 2024 07:41:50 +0200 Subject: [PATCH] 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. --- .github/workflows/test.yml | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a3dea260..764d6211 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,9 +7,6 @@ concurrency: cancel-in-progress: true env: - # setting workers to 1 just to have the same syntax in all test - # but to disable parallelism for the majority who have concurrency issues - TEST_WORKERS: "-n 1" # Share the store between the workers speeds things up further OSBUILD_TEST_STORE: /var/tmp/osbuild-test-store @@ -21,26 +18,12 @@ jobs: fail-fast: false matrix: test: - - "test.mod" - - "test.run.test_boot" - - "test.run.test_devices" - - "test.run.test_executable" - - "test.run.test_mount" - - "test.run.test_noop" - - "test.run.test_sources" - - "test.run.test_stages" - - "stages/test" - - "tools/test" + - parallel + - normal environment: - "py36" # RH8 - "py39" # RH9 - "py312" # latest fedora - # special keyword "include" - include: - # this test _can_ run in parallel - # Using 4 workers is a bit arbitrary, "auto" is probably too aggressive. - - test: "test.run.test_stages" - env_TEST_WORKERS: "-n 4" steps: - name: "Clone Repository" uses: actions/checkout@v4 @@ -54,9 +37,16 @@ jobs: # 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 - TEST_WORKERS="${{ matrix.env_TEST_WORKERS || env.TEST_WORKERS }}" \ + 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 }}" -- ${{ matrix.test }} + tox -e "${{ matrix.environment }}" -- $TEST_WORKERS -k "$TEST_CATEGORY" v1_manifests: name: "Assembler test (legacy)" @@ -72,6 +62,5 @@ jobs: with: image: ghcr.io/osbuild/osbuild-ci:latest-202308241910 run: | - TEST_WORKERS="${{ env.TEST_WORKERS }}" \ OSBUILD_TEST_STORE="${{ env.OSBUILD_TEST_STORE }}" \ - tox -e "py36" -- test.run.test_assemblers + tox -e "py36" -- ${{ env.TEST_WORKERS }} test.run.test_assemblers