Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions .github/workflows/system-tests-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
default: 'release'
required: true
type: string
parallel:
description: 'Split into per-tutorial parallel jobs'
default: false
type: boolean
system_tests_branch:
description: 'Use the system tests from'
default: 'develop'
Expand Down Expand Up @@ -53,11 +57,42 @@ on:
type: string

jobs:
prepare-matrix:
name: Prepare test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Check out tutorials
uses: actions/checkout@v7
with:
ref: ${{ inputs.system_tests_branch }}
- name: Install Python dependencies
run: pip install --user -r tests/requirements.txt
- name: Build matrix from selected suites
id: matrix
working-directory: tests
env:
SUITES: ${{ inputs.suites }}
PARALLEL: ${{ inputs.parallel }}
run: |
MODE=serial
if [ "$PARALLEL" = "true" ]; then
MODE=parallel
fi
python3 prepare_matrix.py --suites "$SUITES" --mode "$MODE" --format=github > matrix.json
echo "matrix=$(cat matrix.json)" >> "$GITHUB_OUTPUT"

run-system-tests:
name: Trigger system tests
name: ${{ matrix.tutorial != '' && format('Trigger system tests ({0})', matrix.tutorial) || 'Trigger system tests' }}
needs: prepare-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
uses: $/.github/workflows/system-tests.yml
with:
suites: ${{ inputs.suites || 'release' }}
suites: ${{ matrix.suites }}
build_args: "TUTORIALS_REF:${{ inputs.ref-tutorials }},\
PRECICE_REF:${{ inputs.ref-precice }},\
PYTHON_BINDINGS_REF:${{ inputs.ref-python-bindings }},\
Expand All @@ -73,3 +108,4 @@ jobs:
SU2_ADAPTER_REF:${{ inputs.ref-su2-adapter }}"
system_tests_branch: ${{ inputs.system_tests_branch || 'develop' }}
log_level: "INFO"
job_label: ${{ matrix.tutorial }}
27 changes: 26 additions & 1 deletion .github/workflows/system-tests-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,33 @@ on:
timezone: "Europe/Berlin"

jobs:
prepare-matrix:
name: Prepare test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Check out tutorials
uses: actions/checkout@v7
with:
ref: develop
- name: Install Python dependencies
run: pip install --user -r tests/requirements.txt
- name: Build serial matrix for release
id: matrix
working-directory: tests
run: |
python3 prepare_matrix.py --suites release --mode serial --format=github > matrix.json
echo "matrix=$(cat matrix.json)" >> "$GITHUB_OUTPUT"

run-system-tests:
name: Trigger system tests
needs: prepare-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
uses: $/.github/workflows/system-tests.yml
with:
suites: 'release'
suites: ${{ matrix.suites }}
job_label: ${{ matrix.tutorial }}
11 changes: 8 additions & 3 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ on:
description: 'TRUE or FALSE (FALSE -> Upload only when the workflow fails)'
default: 'TRUE'
type: string
job_label:
description: 'Optional label for job and artifact names (e.g. tutorial name)'
default: ''
type: string
jobs:
run_system_tests:
name: ${{ inputs.job_label != '' && format('System tests ({0})', inputs.job_label) || 'System tests' }}
runs-on: [self-hosted, linux, x64, precice-tests-vm]
steps:
- name: Display a quick job summary
Expand Down Expand Up @@ -90,7 +95,7 @@ jobs:
id: archive-logs
uses: actions/upload-artifact@v7
with:
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}_logs
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}${{ inputs.job_label != '' && format('_{0}', inputs.job_label) || '' }}_logs
path: |
runs/*/system-tests-build.log
runs/*/system-tests-run.log
Expand All @@ -103,7 +108,7 @@ jobs:
id: archive-diffs
uses: actions/upload-artifact@v7
with:
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}_diffs
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}${{ inputs.job_label != '' && format('_{0}', inputs.job_label) || '' }}_diffs
path: |
runs/*/diff-results/visualizations/**/*.png
if-no-files-found: ignore
Expand All @@ -121,7 +126,7 @@ jobs:
if: ${{ failure() || inputs.upload_artifacts == 'TRUE' }}
uses: actions/upload-artifact@v7
with:
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}_full
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}${{ inputs.job_label != '' && format('_{0}', inputs.job_label) || '' }}_full
path: |
runs/*
!runs/tests/thirdparty
Expand Down
1 change: 1 addition & 0 deletions changelog-entries/789.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Parallelize scheduled and manual `release` system tests via a per-tutorial GitHub Actions matrix derived from `tests.yaml` [#789](https://github.com/precice/tutorials/issues/789)
9 changes: 6 additions & 3 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ The `Use workflow from` is a default option of GitHub Actions that concerns the

The [System tests (nightly)](https://github.com/precice/tutorials/actions/workflows/system-tests-nightly.yml) executes the `release` test suite every night. The [System tests (weekly)](https://github.com/precice/tutorials/actions/workflows/system-tests-weekly.yml) executes the `extra` test suite once per week.

The manual and nightly workflows always run a `prepare-matrix` job first. By default, suites run in a single serial matrix job. Enable the `parallel` input to split expandable suites (such as `release`) into one job per tutorial. If a parallel matrix job fails, re-run only that tutorial job from the Actions run page.

### Running from a pull request

Several repositories include a workflow that allows triggering the system tests by adding the `trigger-system-tests` label to the pull request. The event is triggered only at the moment of adding the label, so you need to remove the label and add it again if needed.
Expand Down Expand Up @@ -83,10 +85,11 @@ This will build and connect Docker containers and run tutorials in the `runs/` d

To clean up at the end, you might want to run a `docker system prune -a` and remove the `runs/` directory to save space.

There are also some auxiliary scripts (run without arguments):
There are also some auxiliary scripts:

- `print_test_suites.py`: Print all test suites defined in `tests.yaml`
- `print_case_combinations.py`: Print all possible combinations of participants in a tutorial, using its `metadata.yaml`.
- `print_test_suites.py`: Print all test suites defined in `tests.yaml`. No arguments are expected.
- `print_case_combinations.py`: Print all possible combinations of participants in a tutorial, using its `metadata.yaml`. No arguments are expected.
- `prepare_matrix.py`: Preview how the manual and nightly workflows split selected suites into GitHub Actions matrix jobs. Run it as `python prepare_matrix.py --suites release --mode [serial|parallel] --format [pretty|github]`.

## Understanding the logs

Expand Down
Loading
Loading