Skip to content

Commit 63bab78

Browse files
committed
workflow: run pytests via matrix to get more parallel runs
This commit moves the test running into a matrix so that we get more parallel testing. It will still be (much) dominated by `test_build_iso.py` but at least this way a flaky test in e.g. `test_container` is much faster to re-run. With multiple VMs we can probably also parallize the tests because we have less images per VM to test so diskspace may be less of an issue.
1 parent 84200d3 commit 63bab78

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/tests.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,30 @@ jobs:
7070
# allow seemingly unreachable commands
7171
SHELLCHECK_OPTS: -e SC1091 -e SC2002 -e SC2317
7272

73+
collect_tests:
74+
runs-on: ubuntu-latest
75+
outputs:
76+
test_files: ${{ steps.collect.outputs.test_files }}
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v4
80+
with:
81+
ref: ${{ github.event.pull_request.head.sha }}
82+
- name: Collect test files
83+
id: collect
84+
run: |
85+
TEST_FILES=$(ls test/test_*.py | sort)
86+
JSON_FILES=$(echo "${TEST_FILES}" | jq -R | jq -cs )
87+
echo "test_files=${JSON_FILES}" >> $GITHUB_OUTPUT
88+
7389
integration:
7490
# TODO: run this also via tmt/testing-farm
7591
name: "Integration"
7692
runs-on: ubuntu-24.04
93+
needs: collect_tests
94+
strategy:
95+
matrix:
96+
test_file: ${{ fromJson(needs.collect_tests.outputs.test_files) }}
7797
steps:
7898
- uses: actions/checkout@v4
7999
with:
@@ -136,7 +156,7 @@ jobs:
136156
# podman needs (parts of) the environment but will break when
137157
# XDG_RUNTIME_DIR is set.
138158
# TODO: figure out what exactly podman needs
139-
sudo -E XDG_RUNTIME_DIR= pytest-3 --basetemp=/mnt/var/tmp/bib-tests
159+
sudo -E XDG_RUNTIME_DIR= pytest-3 --basetemp=/mnt/var/tmp/bib-tests ${{ matrix.test_file }}
140160
- name: Diskspace (after)
141161
if: ${{ always() }}
142162
run: |

0 commit comments

Comments
 (0)