From a69f656c613947a8f8db2c47afdc7b82f156e645 Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Thu, 16 Feb 2023 16:47:38 +0100 Subject: [PATCH] CI: improve tests reporting (extract failed tests + uncaught tracebacks) --- .github/workflows/actions/runTests/action.yml | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/actions/runTests/action.yml b/.github/workflows/actions/runTests/action.yml index 7723f1c6e3..29e4aab55c 100644 --- a/.github/workflows/actions/runTests/action.yml +++ b/.github/workflows/actions/runTests/action.yml @@ -48,17 +48,32 @@ runs: shell: bash if: always() run: | + sed -ne "/^FAIL[[:alpha:]]*:/,/^[[:blank:]]*$/bF; /^Traceback/,/^[^[:blank:]]/{/^Traceback/bT; /^[^[:blank:]]/G; bT}; b; :T w ${{ inputs.logFile }}_tracebacks" -e "b; :F w ${{ inputs.logFile }}_failedtests" ${{ inputs.logFile }} + icon="" + if [ $( cat ${{ inputs.logFile }}_tracebacks | wc -l ) -gt 0 ] + then + icon=" :fire:" + fi if [ ${{ steps.runTests.outcome }} == 'success' ] then - echo "
:heavy_check_mark: ${{ inputs.testDescription }} succeeded" >> ${{ inputs.reportFile}} + echo "
:heavy_check_mark: ${{ inputs.testDescription }} succeeded$icon" >> ${{ inputs.reportFile }} else - echo "
:fire: ${{ inputs.testDescription }} failed" >> ${{ inputs.reportFile}} + echo "
:fire: ${{ inputs.testDescription }} failed$icon" >> ${{ inputs.reportFile }} + echo "" >> ${{ inputs.reportFile }} + echo "Failed tests" >> ${{ inputs.reportFile }} + echo "" >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + cat ${{ inputs.logFile }}_failedtests >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} fi - echo "" >> ${{ inputs.reportFile}} - echo "Below is presented only the 20 last lines of the test log" >> ${{ inputs.reportFile}} - echo "" >> ${{ inputs.reportFile}} - echo '```' >> ${{ inputs.reportFile}} - cat ${{ inputs.logFile }} | tail -n 20 >> ${{ inputs.reportFile}} - echo '```' >> ${{ inputs.reportFile}} - echo "
">> ${{ inputs.reportFile}} - echo "" >> ${{ inputs.reportFile}} + echo "" >> ${{ inputs.reportFile }} + if [ $( cat ${{ inputs.logFile }}_tracebacks | wc -l ) -gt 0 ] + then + echo "Uncaught tracebacks -- these tracebacks appeared during test but didn't fail a test --" >> ${{ inputs.reportFile }} + echo "" >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + cat ${{ inputs.logFile }}_tracebacks >> ${{ inputs.reportFile }} + echo '```' >> ${{ inputs.reportFile }} + fi + echo "
">> ${{ inputs.reportFile }} + echo "" >> ${{ inputs.reportFile }}