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
6 changes: 6 additions & 0 deletions .github/workflows/generate_reference_results_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
description: 'Commit msg for commit that adds the reference results'
default: "Adding reference results"
type: string
suites:
description: 'Comma-separated test suites to generate reference results for (leave empty for all)'
default: ''
required: false
type: string
log_level:
description: 'Logging verbosity level used for the systemtests'
default: 'INFO'
Expand All @@ -28,4 +33,5 @@ jobs:
with:
from_ref: ${{ inputs.from_ref }}
commit_msg: ${{ inputs.commit_msg }}
suites: ${{ inputs.suites }}
log_level: ${{ inputs.log_level }}
26 changes: 22 additions & 4 deletions .github/workflows/generate_reference_results_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
description: 'Commit msg for commit that adds the reference results'
default: "Adding reference results"
type: string
suites:
description: 'Comma-separated test suites to generate reference results for. If empty, all suites are generated.'
default: ''
required: false
type: string
log_level:
description: 'Logging verbosity level used for the systemtests'
default: 'INFO'
Expand All @@ -24,6 +29,7 @@ jobs:
echo "Initiated by: ${{ github.actor }}"
echo "Running generate_reference_results.py --log-level ${{inputs.log_level}}"
echo "Using Ref: ${{ inputs.from_ref }}"
echo "Suites filter: ${{ inputs.suites || 'all (no filter)' }}"
echo "Commit message on success: ${{ inputs.commit_msg }}"
- name: Move LFS URL to local LFS server
run: |
Expand Down Expand Up @@ -56,15 +62,27 @@ jobs:
test -f generate_reference_results.py && export GENERATE_REF_RESULTS=generate_reference_results.py
test -f generate_reference_data.py && export GENERATE_REF_RESULTS=generate_reference_data.py
echo "Selected $GENERATE_REF_RESULTS to run"
python $GENERATE_REF_RESULTS --log-level=${{inputs.log_level}}
SUITES_ARGS=()
if [ -n "${{ inputs.suites }}" ]; then
SUITES_ARGS+=(--suites "${{ inputs.suites }}")
Comment thread
MakisH marked this conversation as resolved.
fi
python "$GENERATE_REF_RESULTS" --log-level="${{inputs.log_level}}" "${SUITES_ARGS[@]}"
cd ../../
- name: Create commit
if: success()
run: |
git checkout ${{ inputs.from_ref }}
git add ./*/*/*.tar.gz
git add ./*/*.tar.gz
git add ./*/reference-results/*.metadata
# Add only the changed reference results.
# When no suite filter is given, add all reference result files.
# When a suite filter is given, only add matching reference result artifacts,
# including newly created files for newly added tutorials or suites.
if [ -z "${{ inputs.suites }}" ]; then
git add ./*/*/*.tar.gz
git add ./*/*.tar.gz
git add ./*/reference-results/*.metadata
else
git add -A -- '**/reference-results/*.tar.gz' '**/reference-results/*.metadata'
fi
git commit -m "${{inputs.commit_msg}}"
git push
- name: Upload artifacts for debugging
Expand Down
1 change: 1 addition & 0 deletions changelog-entries/711.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added optional `--suites` filter to `generate_reference_results.py` and the corresponding workflow, allowing selective regeneration of reference results for specific test suites instead of always regenerating all of them. https://github.com/precice/tutorials/pull/711
Comment thread
MakisH marked this conversation as resolved.
36 changes: 35 additions & 1 deletion tools/tests/generate_reference_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def main():
parser = argparse.ArgumentParser(description='Generate reference data for systemtests')
parser.add_argument('--rundir', type=str, help='Directory to run the systemstests in.',
nargs='?', const=PRECICE_TESTS_RUN_DIR, default=PRECICE_TESTS_RUN_DIR)
parser.add_argument('--suites', type=str,
help='Comma-separated test suites to generate reference results for. '
'If not specified, all suites are used.')
parser.add_argument('--log-level', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
default='INFO', help='Set the logging level')

Expand All @@ -99,7 +102,38 @@ def main():

available_tutorials = Tutorials.from_path(PRECICE_TUTORIAL_DIR)

test_suites = TestSuites.from_yaml(PRECICE_TESTS_DIR / "tests.yaml", available_tutorials)
all_test_suites = TestSuites.from_yaml(PRECICE_TESTS_DIR / "tests.yaml", available_tutorials)

if args.suites:
test_suites_requested = []
for name in args.suites.split(','):
normalized_name = name.strip()
if normalized_name and normalized_name not in test_suites_requested:
test_suites_requested.append(normalized_name)

if not test_suites_requested:
parser.error(
"The --suites option did not contain any valid suite names after parsing. "
"Use print_test_suites.py to get an overview")

test_suites = []
unknown_test_suites = []
for name in test_suites_requested:
found = all_test_suites.get_by_name(name)
if not found:
unknown_test_suites.append(name)
else:
test_suites.append(found)

if unknown_test_suites:
parser.error(
f"Unknown test suite name(s): {', '.join(unknown_test_suites)}. "
"Use print_test_suites.py to get an overview")

logging.info(f"Filtering to requested suites: {[s.name for s in test_suites]}")
else:
test_suites = all_test_suites
logging.info("No --suites filter specified, generating reference results for all suites.")

# Read in parameters
build_args = SystemtestArguments.from_yaml(PRECICE_TESTS_DIR / "reference_versions.yaml")
Expand Down
Loading