Adds junit and coverage to jenkinsfile

This commit is contained in:
Deepak Mallubhotla 2020-12-27 20:07:46 -06:00
parent 403295b2b4
commit ff0a8b97be
Signed by: deepak
GPG Key ID: 64BF53A3369104E7

16
Jenkinsfile vendored
View File

@ -30,9 +30,23 @@ pipeline {
}
}
stage('test') {
environment {
PATH="${env.PATH}:${env.GOPATH}/bin"
}
steps {
echo 'Running test'
sh 'go test -v ./...'
sh 'go test -v -coverprofile=coverage.out -covermode count > tests.out ./...'
sh "go get github.com/tebeka/go2xunit"
sh "go2xunit < tests.out -output tests.xml"
junit "tests.xml"
// convert coverage
sh "go get github.com/t-yuki/gocover-cobertura"
sh "gocover-cobertura < coverage.out > coverage.xml"
cobertura coberturaReportFile: 'coverage.xml'
}
}
stage('lint') {