2021-05-06 15:14:58 +00:00
|
|
|
library 'status-jenkins-lib@v1.2.17'
|
|
|
|
|
2019-02-25 17:48:44 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
|
|
|
|
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'BRANCH',
|
|
|
|
defaultValue: 'develop',
|
|
|
|
description: 'Name of branch to build.'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
/* Go requires a certain directory structure */
|
|
|
|
checkoutToSubdirectory('src/github.com/status-im/status-go')
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
2021-03-04 17:08:34 +00:00
|
|
|
numToKeepStr: '5',
|
2019-02-25 17:48:44 +00:00
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2021-05-06 15:14:58 +00:00
|
|
|
TARGET = 'linux'
|
|
|
|
STATUS_PATH = 'src/github.com/status-im/status-go'
|
|
|
|
GOPATH = "${env.WORKSPACE}"
|
|
|
|
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
|
2019-02-25 17:48:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2021-05-06 15:14:58 +00:00
|
|
|
stage('Prep') { steps { dir(env.STATUS_PATH) { script {
|
|
|
|
println("Version: ${utils.getVersion()}")
|
|
|
|
println("Git Branch: ${utils.branchName()}")
|
|
|
|
println("Git Commit: ${utils.gitCommit()}")
|
|
|
|
} } } }
|
2019-02-25 17:48:44 +00:00
|
|
|
|
|
|
|
stage('Setup') { steps { dir(env.STATUS_PATH) {
|
2019-12-20 12:02:44 +00:00
|
|
|
sh 'GO111MODULE=off make setup-build modvendor-install'
|
2019-02-25 17:48:44 +00:00
|
|
|
} } }
|
|
|
|
|
2019-12-20 12:02:44 +00:00
|
|
|
stage('Vendoring check') { steps { dir(env.STATUS_PATH) {
|
2021-06-09 10:16:04 +00:00
|
|
|
// fail build if vendoring hasn't been done
|
2019-12-20 12:02:44 +00:00
|
|
|
sh 'GO111MODULE=on make vendor && git diff --exit-code --no-color --stat vendor/'
|
2021-05-06 15:14:58 +00:00
|
|
|
} } }
|
2019-12-20 12:02:44 +00:00
|
|
|
|
2019-02-25 17:48:44 +00:00
|
|
|
stage('Lint') { steps { dir(env.STATUS_PATH) {
|
|
|
|
sh 'make lint'
|
|
|
|
} } }
|
|
|
|
|
|
|
|
stage('Canary') { steps { dir(env.STATUS_PATH) {
|
|
|
|
sh 'make canary-test'
|
|
|
|
} } }
|
|
|
|
|
2021-06-09 10:16:04 +00:00
|
|
|
stage('Unit Tests') { steps { script { dir(env.STATUS_PATH) {
|
|
|
|
docker.image('postgres:9.6-alpine').withRun(
|
|
|
|
'-e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432'
|
|
|
|
) { c ->
|
|
|
|
sh 'make test-unit'
|
|
|
|
}
|
|
|
|
} } } }
|
2019-02-25 17:48:44 +00:00
|
|
|
} // stages
|
|
|
|
} // pipeline
|