keycard-cli/_assets/ci/Jenkinsfile
Jakub dff5aa8449 clean using cleanWs() and explicitly set GOPATH for tests (#4)
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-04-16 12:37:11 +02:00

79 lines
1.7 KiB
Groovy

pipeline {
agent { label 'linux' }
options {
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
disableConcurrentBuilds()
/* Go requires a certain directory structure */
checkoutToSubdirectory('src/github.com/status-im/keycard-cli')
}
environment {
PROJECT = 'src/github.com/status-im/keycard-cli'
GOPATH = "${env.WORKSPACE}"
PATH = "${env.PATH}:${env.GOPATH}/bin"
}
stages {
stage('Prep') {
steps { dir(env.PROJECT) {
sh 'make deps'
} }
}
stage('Test') {
agent {
docker {
label 'linux'
image 'statusteam/keycard-cli-ci:latest'
args '--entrypoint=""' /* allows jenkins use cat */
}
}
environment {
GOCACHE = "off"
GOPATH = "${env.WORKSPACE}"
PATH = "${env.PATH}:${env.GOPATH}/bin"
}
options {
checkoutToSubdirectory('src/github.com/status-im/keycard-cli')
}
steps { dir(env.PROJECT) {
sh 'make test'
} }
}
stage('Build') {
steps { script { dir(env.PROJECT) {
sh 'make build-platforms'
} } }
}
stage('Archive') {
steps { dir(env.PROJECT) {
archiveArtifacts('build/bin/*')
} }
}
stage('Release') {
steps { dir(env.PROJECT) {
withCredentials([usernamePassword(
credentialsId: 'status-im-auto',
usernameVariable: 'GITHUB_USER_NAME',
passwordVariable: 'GITHUB_TOKEN'
)]) {
sh 'make release'
}
} }
}
}
post {
always {
cleanWs() /* we can't use `make clean` because xgo creates root files */
}
}
}