From 43d989474e1010bcebcd7d3fe474bbf334fde1a2 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Thu, 27 Jul 2023 14:25:04 +1000 Subject: [PATCH] Use Publish HTML in CI --- Jenkinsfile | 10 +++++++++- scripts/ci/test-backend | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a842ec18..7e2b9df1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -84,8 +84,16 @@ pipeline { } post { success { - archiveArtifacts allowEmptyArchive: false, artifacts: 'coverage.html' archiveArtifacts allowEmptyArchive: false, artifacts: 'bin/*' + publishHTML([ + allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: false, + reportDir: 'backend-coverage', + reportFiles: 'index.html', + reportName: 'Backend Coverage', + useWrapperFileDirectly: true + ]) } } } diff --git a/scripts/ci/test-backend b/scripts/ci/test-backend index 0d578e1b..65b3e59b 100755 --- a/scripts/ci/test-backend +++ b/scripts/ci/test-backend @@ -44,9 +44,10 @@ if [ "${1:-}" = "--inside-docker" ]; then cd /app/backend [ -z "$(go tool fix -diff ./internal)" ] go test -json -cover -coverprofile="$DIR/../../coverage.out" ./internal/... | tparse - go tool cover -html="$DIR/../../coverage.out" -o "$DIR/../../coverage.html" - rm -f "$DIR/../../coverage.out" - chown 1000:1000 "$DIR/../../coverage.html" + mkdir "$DIR/../../backend-coverage" + go tool cover -html="/tmp/coverage.out" -o "$DIR/../../backend-coverage/index.html" + rm -f "/tmp/coverage.out" + chown -R 1000:1000 "$DIR/../../backend-coverage" golangci-lint -v run ./... else # run this script from within docker