@@ -20,27 +20,71 @@ runs:
2020 using : " composite"
2121 steps :
2222 - name : Convert XML
23- if : always()
23+ if : always()
2424 shell : bash
2525 run : |
2626 cd build
27- mkdir -p ${{ inputs.job-name }}
28- xsltproc \
29- ../.github/ci-scripts/conv.xsl Testing/$(head -n 1 < Testing/TAG)/Test.xml \
30- > ${{ inputs.job-name }}/Test.xml
31-
27+ mkdir -p "${{ inputs.job-name }}"
28+
29+ test_xml=""
30+ conversion_failed=false
31+ if [[ -r Testing/TAG ]]; then
32+ test_xml="Testing/$(head -n 1 < Testing/TAG)/Test.xml"
33+ elif [[ -r Testing/Test.xml ]]; then
34+ test_xml="Testing/Test.xml"
35+ fi
36+
37+ if [[ -n "${test_xml}" && -r "${test_xml}" ]]; then
38+ if ! xsltproc \
39+ ../.github/ci-scripts/conv.xsl "${test_xml}" \
40+ > "${{ inputs.job-name }}/Test.xml"; then
41+ conversion_failed=true
42+ rm -f "${{ inputs.job-name }}/Test.xml"
43+ cp "${test_xml}" "${{ inputs.job-name }}/CTest-Test.xml"
44+ fi
45+ fi
46+
47+ if [[ ! -f "${{ inputs.job-name }}/Test.xml" ]]; then
48+ if [[ "${conversion_failed}" == "true" ]]; then
49+ printf '%s\n' \
50+ '<testsuites>' \
51+ ' <testsuite name="ctest-artifacts" tests="1" failures="0"'\
52+ ' errors="1" skipped="0">' \
53+ ' <testcase classname="collect-artifacts"'\
54+ ' name="ctest-xml-conversion">' \
55+ ' <error message="Failed to convert CTest XML with xsltproc"/>' \
56+ ' </testcase>' \
57+ ' </testsuite>' \
58+ '</testsuites>' \
59+ > "${{ inputs.job-name }}/Test.xml"
60+ else
61+ printf '%s\n' \
62+ '<testsuites>' \
63+ ' <testsuite name="ctest" tests="0" failures="0"'\
64+ ' errors="0" skipped="0"/>' \
65+ '</testsuites>' \
66+ > "${{ inputs.job-name }}/Test.xml"
67+ fi
68+ fi
69+
3270 - name : Move core dumps
3371 if : failure() && inputs.collect-failure-artifacts == 'true'
3472 shell : bash
3573 run : |
3674 cd build
37- mkdir -p ${{ inputs.job-name }}
38- cp core.* ${{ inputs.job-name }} || true
39-
75+ mkdir -p "${{ inputs.job-name }}"
76+ shopt -s nullglob
77+ core_files=(core.*)
78+ if (( ${#core_files[@]} != 0 )); then
79+ cp "${core_files[@]}" "${{ inputs.job-name }}"
80+ fi
81+
4082 - name : Move debug logs
4183 if : failure() && inputs.collect-failure-artifacts == 'true'
4284 shell : bash
4385 run : |
4486 cd build
45- mkdir -p ${{ inputs.job-name }}
46- cp debug-log.txt ${{ inputs.job-name }} || true
87+ mkdir -p "${{ inputs.job-name }}"
88+ if [[ -f debug-log.txt ]]; then
89+ cp debug-log.txt "${{ inputs.job-name }}"
90+ fi
0 commit comments