status-go/_assets/ci/Jenkinsfile.tests

67 lines
1.6 KiB
Plaintext

library 'status-jenkins-lib@v1.3.3'
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(
numToKeepStr: '5',
daysToKeepStr: '30',
))
}
environment {
TARGET = 'linux'
GOPATH = "${env.WORKSPACE}"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
REPO = 'src/github.com/status-im/status-go'
}
stages {
stage('Prep') { steps { dir(env.REPO) { script {
println("Version: ${utils.getVersion()}")
println("Git Branch: ${utils.branchName()}")
println("Git Commit: ${utils.gitCommit()}")
} } } }
stage('Setup') { steps { dir(env.REPO) {
sh 'make setup-build install-modvendor'
} } }
stage('Vendoring check') { steps { dir(env.REPO) {
/* fail build if vendoring hasn't been done */
sh 'make vendor'
sh 'git diff --exit-code --no-color --stat vendor/'
} } }
stage('Lint') { steps { dir(env.REPO) {
sh 'make lint'
} } }
stage('Canary') { steps { dir(env.REPO) {
sh 'make canary-test'
} } }
stage('Unit Tests') { steps { script { dir(env.REPO) {
docker.image('postgres:9.6-alpine').withRun(
'-e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432'
) { c ->
sh 'make test-unit V=1'
}
} } } }
} // stages
} // pipeline