Timothy J. Warren
dc23a972dd
Some checks failed
timw4mail/gilo/pipeline/head There was a failure building this commit
45 lines
1.0 KiB
Groovy
45 lines
1.0 KiB
Groovy
pipeline {
|
|
agent any
|
|
tools {
|
|
go 'go1.16.2'
|
|
}
|
|
environment {
|
|
GO114MODULE = 'on'
|
|
CGO_ENABLED = 0
|
|
GOPATH = "${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}"
|
|
}
|
|
stages {
|
|
stage('Pre Test') {
|
|
steps {
|
|
echo 'Installing dependencies'
|
|
sh 'go version'
|
|
}
|
|
}
|
|
|
|
stage('Build') {
|
|
steps {
|
|
echo 'Compiling and building'
|
|
sh 'go build'
|
|
}
|
|
}
|
|
|
|
stage('Test') {
|
|
steps {
|
|
sh "go test ./... -v"
|
|
}
|
|
}
|
|
|
|
stage('Test Coverage') {
|
|
steps {
|
|
sh "go get github.com/axw/gocov/..."
|
|
sh "go get github.com/AlekSi/gocov-xml"
|
|
sh "go run github.com/axw/gocov/gocov test github.com/gorilla/mux | go run github.com/AlekSi/gocov-xml > coverage.xml"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
cobertura coberturaReportFile: 'coverage.xml'
|
|
}
|
|
}
|
|
} |