Skip to content

Commit d94e304

Browse files
committed
Use go unit test results in ci
1 parent 3379f3a commit d94e304

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Jenkinsfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pipeline {
1818
label 'docker-multiarch'
1919
}
2020
options {
21-
buildDiscarder(logRotator(numToKeepStr: '5'))
21+
buildDiscarder(logRotator(numToKeepStr: '10'))
2222
disableConcurrentBuilds()
2323
ansiColor('xterm')
2424
}
@@ -71,7 +71,8 @@ pipeline {
7171
steps {
7272
sh './scripts/ci/build-frontend'
7373
sh './scripts/ci/test-backend'
74-
sh './scripts/ci/build-backend'
74+
// Temporarily disable building backend binaries
75+
// sh './scripts/ci/build-backend'
7576
// Build the docker image used for testing below
7677
sh '''docker build --pull --no-cache \\
7778
-t "${IMAGE}:${BRANCH_LOWER}-ci-${BUILD_NUMBER}" \\
@@ -84,12 +85,13 @@ pipeline {
8485
}
8586
post {
8687
success {
87-
archiveArtifacts allowEmptyArchive: false, artifacts: 'bin/*'
88+
junit 'test/results/junit/*'
89+
// archiveArtifacts allowEmptyArchive: false, artifacts: 'bin/*'
8890
publishHTML([
8991
allowMissing: false,
9092
alwaysLinkToLastBuild: false,
9193
keepAll: false,
92-
reportDir: 'html-reports',
94+
reportDir: 'test/results/html-reports',
9395
reportFiles: 'backend-coverage.html',
9496
reportName: 'HTML Reports',
9597
useWrapperFileDirectly: true

scripts/ci/test-backend

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ if [ "${1:-}" = "--inside-docker" ]; then
4444
cd /app/backend
4545
[ -z "$(go tool fix -diff ./internal)" ]
4646
go test -json -cover -coverprofile="/tmp/coverage.out" ./internal/... | tparse
47-
mkdir "$DIR/../../html-reports"
48-
go tool cover -html="/tmp/coverage.out" -o "$DIR/../../html-reports/backend-coverage.html"
47+
mkdir -p "$DIR/../../test/results/html-reports" "$DIR/../../test/results/junit"
48+
go tool cover -html="/tmp/coverage.out" -o "$DIR/../../test/results/html-reports/backend-coverage.html"
49+
go test -v -tags="unit integration" -covermode=atomic ./internal/... 2>&1 | go-junit-report -set-exit-code > "$DIR/../../test/results/junit/backend.xml"
4950
rm -f "/tmp/coverage.out"
50-
chown -R 1000:1000 "$DIR/../../html-reports"
51+
chown -R 1000:1000 "$DIR/../../test/results"
5152
golangci-lint -v run ./...
5253
else
5354
# run this script from within docker

0 commit comments

Comments
 (0)