Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pipeline {
STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26257/postgres?sslmode=disable'
STORJ_TEST_POSTGRES = 'postgres://postgres@localhost/postgres?sslmode=disable'
STORJ_TEST_LOG_LEVEL = 'info'
COVERFLAGS = "${ env.BRANCH_NAME == 'main' ? '-coverprofile=.build/coverprofile ' : ''}"
}
steps {
sh 'make test 2>&1 | grep "^{.*" | tee .build/tests.json | xunit -out .build/tests.xml'
Expand All @@ -95,6 +96,19 @@ pipeline {
sh script: 'cat .build/tests.json| tparse -all -top -slow 100', returnStatus: true
archiveArtifacts artifacts: '.build/tests.json'
junit '.build/tests.xml'

script {
if(fileExists(".build/coverprofile")){
sh script: 'filter-cover-profile < .build/coverprofile > .build/clean.coverprofile', returnStatus: true
sh script: 'gocov convert .build/clean.coverprofile > .build/cover.json', returnStatus: true
sh script: 'gocov-xml < .build/cover.json > .build/cobertura.xml', returnStatus: true
cobertura coberturaReportFile: '.build/cobertura.xml',
lineCoverageTargets: '70, 60, 50',
autoUpdateHealth: false,
autoUpdateStability: false,
failUnhealthy: false
}
}
}
}
}
Expand All @@ -120,6 +134,19 @@ pipeline {
sh script: 'cat .build/testsuite.json| tparse -all -top -slow 100', returnStatus: true
archiveArtifacts artifacts: '.build/testsuite.json'
junit '.build/testsuite.xml'

script {
if(fileExists(".build/coverprofile")){
sh script: 'filter-cover-profile < .build/coverprofile > .build/clean.coverprofile', returnStatus: true
sh script: 'gocov convert .build/clean.coverprofile > .build/cover.json', returnStatus: true
sh script: 'gocov-xml < .build/cover.json > .build/cobertura.xml', returnStatus: true
cobertura coberturaReportFile: '.build/cobertura.xml',
lineCoverageTargets: '70, 60, 50',
autoUpdateHealth: false,
autoUpdateStability: false,
failUnhealthy: false
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ SKIP_TESTSUITE ?= false

.PHONY: test
test: test-testsuite ## Test
go test -json=${JSON} -p 16 -parallel 4 -race -short=${SHORT} -timeout 10m -vet=off ./...
go test -json=${JSON} -cover -coverprofile=.build/coverprofile -p 16 -parallel 4 -race -short=${SHORT} -timeout 10m -vet=off ./...

.PHONY: test-testsuite
test-testsuite: ## Test testsuite
Expand All @@ -174,7 +174,7 @@ endif
.PHONY: test-testsuite-do
test-testsuite-do:
go vet ./...
go test -json=${JSON} -p 16 -parallel 4 -race -short=${SHORT} -timeout 10m -vet=off ./...
go test -json=${JSON} -cover -coverprofile=.build/coverprofile -p 16 -parallel 4 -race -short=${SHORT} -timeout 10m -vet=off ./...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beware, this will overwrite the coverage of the main module

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this error be caused by this?
tparse error: no parseable events: call go test with -json flag


##@ Local development/Public Jenkins/Verification

Expand Down