2021-09-28 07:52:00 +00:00
|
|
|
library 'status-jenkins-lib@v1.3.3'
|
2021-05-06 15:14:58 +00:00
|
|
|
|
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-09-28 07:52:00 +00:00
|
|
|
TARGET = 'linux'
|
|
|
|
GOPATH = "${env.WORKSPACE}"
|
|
|
|
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
|
|
|
|
REPO = 'src/github.com/status-im/status-go'
|
2019-02-25 17:48:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Prep') { steps { dir(env.REPO) { script {
|
2021-05-06 15:14:58 +00:00
|
|
|
println("Version: ${utils.getVersion()}")
|
|
|
|
println("Git Branch: ${utils.branchName()}")
|
|
|
|
println("Git Commit: ${utils.gitCommit()}")
|
|
|
|
} } } }
|
2019-02-25 17:48:44 +00:00
|
|
|
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Setup') { steps { dir(env.REPO) {
|
2021-09-13 09:04:00 +00:00
|
|
|
sh 'make setup-build install-modvendor'
|
2019-02-25 17:48:44 +00:00
|
|
|
} } }
|
|
|
|
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Vendoring check') { steps { dir(env.REPO) {
|
2021-09-13 09:04:00 +00:00
|
|
|
/* fail build if vendoring hasn't been done */
|
|
|
|
sh 'make vendor'
|
|
|
|
sh 'git diff --exit-code --no-color --stat vendor/'
|
2021-05-06 15:14:58 +00:00
|
|
|
} } }
|
2019-12-20 12:02:44 +00:00
|
|
|
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Lint') { steps { dir(env.REPO) {
|
2019-02-25 17:48:44 +00:00
|
|
|
sh 'make lint'
|
|
|
|
} } }
|
|
|
|
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Canary') { steps { dir(env.REPO) {
|
2019-02-25 17:48:44 +00:00
|
|
|
sh 'make canary-test'
|
|
|
|
} } }
|
|
|
|
|
2021-09-28 07:52:00 +00:00
|
|
|
stage('Unit Tests') { steps { script { dir(env.REPO) {
|
2021-06-09 10:16:04 +00:00
|
|
|
docker.image('postgres:9.6-alpine').withRun(
|
|
|
|
'-e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432'
|
|
|
|
) { c ->
|
2021-09-09 14:28:54 +00:00
|
|
|
sh 'make test-unit V=1'
|
2021-06-09 10:16:04 +00:00
|
|
|
}
|
|
|
|
} } } }
|
2019-02-25 17:48:44 +00:00
|
|
|
} // stages
|
|
|
|
} // pipeline
|