gilo/Jenkinsfile

45 lines
1006 B
Plaintext
Raw Normal View History

2021-03-30 19:42:49 -04:00
pipeline {
2021-03-30 21:11:42 -04:00
agent any
tools {
2021-03-30 21:12:40 -04:00
go 'go1.16.2'
2021-03-30 21:11:42 -04:00
}
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 {
2021-04-01 17:46:25 -04:00
sh "go test ./... -v"
2021-03-30 21:11:42 -04:00
}
}
2021-04-01 17:21:37 -04:00
stage('Test Coverage') {
steps {
2021-04-01 17:46:25 -04:00
sh "go get github.com/axw/gocov/..."
sh "go get github.com/AlekSi/gocov-xml"
sh "gocov test github.com/gorilla/mux | gocov-xml > coverage.xml"
2021-04-01 17:21:37 -04:00
}
}
}
post {
always {
cobertura coberturaReportFile: 'coverage.xml'
}
2021-03-30 21:11:42 -04:00
}
}