feat: publish test_stats report (#4349)

Let's publish test_stats as a Jenkins report instead of printing to the
build log.
This commit is contained in:
Anton Iakimov 2023-11-22 11:37:05 +01:00 committed by GitHub
parent 5e2af9e4fa
commit c62957f621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 4 deletions

View file

@ -103,11 +103,25 @@ pipeline {
post {
always {
script { env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText" }
junit '**/report.xml'
junit testResults: '**/report.xml',
skipOldReports: true,
skipPublishingChecks: true
publishHTML target: [
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'reports',
reportFiles: 'test_stats.txt',
reportName: 'Reports',
reportTitles: 'Test Stats'
]
}
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup { dir(env.TMPDIR) { deleteDir() } }
cleanup {
dir(env.TMPDIR) { deleteDir() }
sh "make git-clean"
}
} // post
} // pipeline

View file

@ -40,17 +40,22 @@ for package in ${UNIT_TEST_PACKAGES}; do
fi
if [[ "${go_test_exit}" -ne 0 ]]; then
echo -e "${YLW}Failed, see the log:${RST} ${BLD}${output_file}${RST}"
if [[ "${CI}" == 'true' ]]; then
echo -e "${YLW}Failed, see the log:${RST} ${BLD}${output_file}${RST}"
fi
if [[ "$UNIT_TEST_FAILFAST" == 'true' ]]; then
exit "${go_test_exit}"
fi
last_failing_exit_code="${go_test_exit}"
fi
done
if [[ "${last_failing_exit_code}" -ne 0 ]]; then
if [[ "${UNIT_TEST_COUNT}" -gt 1 ]]; then
"${GIT_ROOT}/_assets/scripts/test_stats.py"
mkdir -p "${GIT_ROOT}/reports"
"${GIT_ROOT}/_assets/scripts/test_stats.py" | redirect_stdout "${GIT_ROOT}/reports/test_stats.txt"
fi
exit "${last_failing_exit_code}"