Skip to content

Commit 8f2f618

Browse files
authored
Merge pull request #1783 from arcaneframework/dev/ah-upload-test-result-codecov
Upload test results to Codecov
2 parents c8bd61e + 683214f commit 8f2f618

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/codecov.yml

+22
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,28 @@ jobs:
142142
mkdir -p ${{ env.CT_RESULT_DIR }}
143143
ARCANE_CHECK=1 ctest --test-dir ${{ env.BUILD_DIR }} --output-junit ${{ env.CT_RESULT_DIR }}/results.xml ${{ env.CT_OPTS }} -E '${{ env.EXCLUDED_TESTS }}' -LE '${{ env.EXCLUDED_TESTS_WITH_LABELS }}'
144144
145+
# https://www.ibm.com/docs/en/developer-for-zos/9.1.1?topic=formats-junit-xml-format
146+
- name: Edit results.xml for Codecov (need valid JUnit XML)
147+
shell: bash
148+
run: |
149+
RESULT_ORI=${{ env.CT_RESULT_DIR }}/results.xml
150+
RESULT_TMP=${{ env.CT_RESULT_DIR }}/results_ori.xml
151+
mv $RESULT_ORI $RESULT_TMP
152+
sed -e '/<testcase.*>/,/<\/testcase>/d' -e 's:</testsuite>::' -e 's/(empty)/CTest Arcane/' -e 's/hostname=""/hostname="GHA"/' $RESULT_TMP > $RESULT_ORI
153+
sed -n '/<testcase.*status="fail">/,/<\/testcase>/p' $RESULT_TMP | sed -e 's:<failure message="".*/>::M' -e 's/<system-out>/<failure message="Logs Arcane:">\n/M' -e 's:</system-out>:</failure>:M' >> $RESULT_ORI
154+
sed -n '/<testcase.*status="run">/,/<\/testcase>/p' $RESULT_TMP >> $RESULT_ORI
155+
echo '</testsuite>' >> $RESULT_ORI
156+
rm $RESULT_TMP
157+
158+
- name: Upload test results to Codecov
159+
uses: codecov/test-results-action@v1
160+
env:
161+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
162+
with:
163+
verbose: true
164+
fail_ci_if_error: true
165+
file: ${{ env.CT_RESULT_DIR }}/results.xml
166+
145167
- name: Display disks infos
146168
shell: bash
147169
run: |

0 commit comments

Comments
 (0)