Repository navigation
138 lines (137 loc) · 5.3 KB
/
Copy pathgenerate-reference-results.yml
File metadata and controls
138 lines (137 loc) · 5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Generate reference results (called)
on:
workflow_call:
inputs:
suites:
description: 'Test suites to execute (comma-separated, see tests.yaml)'
required: true
type: string
from_ref:
description: 'Git branch to use and commit to'
default: 'develop'
type: string
commit_msg:
description: 'Commit message'
default: "Add reference results"
type: string
tutorials_ref_source:
description: 'Where to take TUTORIALS_REF from when build_args is empty'
default: 'reference_versions.yaml'
type: string
build_args:
description: 'Comma-separated overrides for reference_versions.yaml (e.g. TUTORIALS_REF:my-branch)'
default: ''
type: string
clean_docker:
description: 'Run docker-system-prune before running tests'
default: 'FALSE'
type: string
log_level:
description: 'Logging verbosity of systemtests.py'
required: true
type: string
jobs:
generate_reference_results:
runs-on: [self-hosted, linux, x64, precice-tests-vm]
steps:
- name: Report the input values in the summary
run: |
{
echo "- Initiated by: @${{ github.actor }}"
echo "- Test suites: \`${{ inputs.suites || 'all (no filter)' }}\`"
echo "- Git branch to commit to: \`${{ inputs.from_ref }}\`"
echo "- Commit message: \`${{ inputs.commit_msg }}\`"
if [ -n "${{ inputs.build_args }}" ]; then
echo "- Build args override: \`${{ inputs.build_args }}\`"
elif [ "${{ inputs.tutorials_ref_source }}" = "workflow branch" ]; then
echo "- Tutorials source: workflow branch (\`TUTORIALS_REF:${{ inputs.from_ref }}\`)"
else
echo "- Tutorials source: \`reference_versions.yaml\`"
fi
echo "- Run \`docker-system-prune\` before running tests: \`${{ inputs.clean_docker }}\`"
echo "- Log level: \`${{ inputs.log_level }}\`"
echo "- Running \`generate_reference_results.py --suites ${{ inputs.suites }} --log_level ${{ inputs.log_level }}\`"
} >> "$GITHUB_STEP_SUMMARY"
- name: Move LFS URL to local LFS server
run: |
/home/precice/runners_root/scripts/make_lfs_local.sh
- name: 'Cleanup the folder'
# The first rf -rf ./* removes all non hidden files
# The second rf -rf ./.??* removes all hidden files (but not . and ..)
run: |
ls -la ./
rm -rf ./*
rm -rf ./.??*
ls -la ./
- name: Check out Tutorials for the system tests (tests/)
uses: actions/checkout@v7
with:
ref: ${{ inputs.from_ref }}
lfs: true
fetch-depth: 0
- name: Install Python dependencies
run: |
pip install --user -r tests/requirements.txt
- name: Cleanup Docker cache
if: ${{ inputs.clean_docker == 'TRUE' }}
# Remove all Docker containers, images, and build caches
# to ensure consistent results and as storage cleanup
run: |
docker system prune --all --force
- name: Copy runner-specific files (mirrors, restricted)
run: |
cp -r /home/precice/thirdparty ./tests/
cp -r /home/precice/restricted ./tests/
- name: Run tests
run: |
cd tests
SUITES_ARGS=()
if [ -n "${{ inputs.suites }}" ]; then
SUITES_ARGS+=(--suites "${{ inputs.suites }}")
fi
BUILD_ARGS_STR="${{ inputs.build_args }}"
if [ -z "$BUILD_ARGS_STR" ] && [ "${{ inputs.tutorials_ref_source }}" = "workflow branch" ]; then
BUILD_ARGS_STR="TUTORIALS_REF:${{ inputs.from_ref }}"
fi
BUILD_ARGS=()
if [ -n "$BUILD_ARGS_STR" ]; then
BUILD_ARGS=(--build_args "$BUILD_ARGS_STR")
fi
python generate_reference_results.py --log_level="${{ inputs.log_level }}" "${BUILD_ARGS[@]}" "${SUITES_ARGS[@]}"
cd ../../
- name: Create commit
if: success()
run: |
git checkout ${{ inputs.from_ref }}
# 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
else
git add -A -- '**/reference-results/*.tar.gz'
fi
git commit -m "${{inputs.commit_msg}}" || echo "::warning:: Could not commit the reference results - Ignore if only meant to be stored locally."
git push
- name: Archive system test logs
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}_reference_logs
path: |
runs/*/system-tests-build.log
runs/*/system-tests-run.log
runs/*/system-tests-compare.log
runs/*/*/system-tests_*.log
- name: Archive run files
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: system_tests_run_${{ github.run_id }}_${{ github.run_attempt }}_reference_full
path: |
runs/*
!runs/tests/thirdparty
!runs/tests/restricted
!runs/alya-flap*/