2019-02-01 17:02:52 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
|
|
|
|
2019-02-25 14:59:12 +00:00
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'BRANCH',
|
|
|
|
defaultValue: 'develop',
|
|
|
|
description: 'Name of branch to build.'
|
|
|
|
)
|
|
|
|
booleanParam(
|
|
|
|
name: 'RELEASE',
|
|
|
|
defaultValue: false,
|
|
|
|
description: 'Enable to create build for release.',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-02-01 17:02:52 +00:00
|
|
|
options {
|
2019-02-25 09:04:53 +00:00
|
|
|
timestamps()
|
|
|
|
disableConcurrentBuilds()
|
2019-02-01 17:02:52 +00:00
|
|
|
/* Go requires a certain directory structure */
|
|
|
|
checkoutToSubdirectory('src/github.com/status-im/status-go')
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '30',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2019-08-20 07:05:15 +00:00
|
|
|
/* fix for gomobile complaining about missing packages */
|
|
|
|
CGO_ENABLED = "1"
|
|
|
|
GO111MODULE = "off"
|
|
|
|
/* Other stuff */
|
2019-02-07 12:12:35 +00:00
|
|
|
BUILD_PLATFORM = 'android'
|
2019-04-12 10:50:14 +00:00
|
|
|
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go"
|
2019-02-01 17:02:52 +00:00
|
|
|
CI_DIR = "${env.STATUS_PATH}/_assets/ci"
|
|
|
|
GOPATH = "${env.WORKSPACE}"
|
2019-06-11 17:05:47 +00:00
|
|
|
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
|
2019-02-01 17:02:52 +00:00
|
|
|
ANDROID_HOME = '/usr/lib/android-sdk'
|
|
|
|
ANDROID_SDK_ROOT = '/usr/lib/android-sdk'
|
2019-02-25 09:04:53 +00:00
|
|
|
/* gomobile requires a specific NDK version */
|
|
|
|
ANDROID_NDK = "${env.NDK_GOMOBILE}"
|
|
|
|
ANDROID_NDK_HOME = "${env.NDK_GOMOBILE}"
|
2019-02-01 17:02:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Prep') { steps { script {
|
|
|
|
lib = load("${CI_DIR}/lib.groovy")
|
|
|
|
/* clarify what we're building */
|
|
|
|
println("Version: ${lib.getVersion()}")
|
|
|
|
println("Git Branch: ${lib.gitBranch()}")
|
|
|
|
println("Git Commit: ${lib.gitCommit()}")
|
|
|
|
/* save and create a dir for artifacts */
|
2019-08-20 07:05:15 +00:00
|
|
|
dest = "${env.WORKSPACE}/out"
|
2019-02-01 17:02:52 +00:00
|
|
|
sh "mkdir -p ${dest}"
|
|
|
|
/* for easier reuse */
|
|
|
|
artifact = "status-go-android-${lib.suffix()}.aar"
|
|
|
|
} } }
|
|
|
|
|
|
|
|
stage('Setup') { steps { dir(env.STATUS_PATH) {
|
2019-12-20 12:02:44 +00:00
|
|
|
sh 'make setup-build modvendor-install'
|
2019-02-01 17:02:52 +00:00
|
|
|
} } }
|
|
|
|
|
2019-12-20 12:02:44 +00:00
|
|
|
stage('Vendoring check') { steps { dir(env.STATUS_PATH) {
|
|
|
|
/* fail build if vendoring hasn't been done */
|
|
|
|
sh 'GO111MODULE=on make vendor && git diff --exit-code --no-color --stat vendor/'
|
|
|
|
} } } // stage(Vendoring check)
|
|
|
|
|
2019-02-01 17:02:52 +00:00
|
|
|
stage('Compile') { steps { dir(env.STATUS_PATH) {
|
|
|
|
sh 'make statusgo-android'
|
|
|
|
sh "cp build/bin/statusgo.aar ${dest}/${artifact}"
|
|
|
|
} } }
|
|
|
|
|
|
|
|
stage('Archive') { steps {
|
2019-08-20 07:05:15 +00:00
|
|
|
archiveArtifacts("out/${artifact}")
|
2019-02-01 17:02:52 +00:00
|
|
|
} }
|
|
|
|
|
|
|
|
stage('Upload') { steps { script {
|
2019-08-20 07:05:15 +00:00
|
|
|
env.PKG_URL = lib.uploadArtifact("out/${artifact}")
|
2019-02-01 17:02:52 +00:00
|
|
|
} } }
|
|
|
|
} // stages
|
2019-02-07 12:12:35 +00:00
|
|
|
post {
|
|
|
|
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
|
|
|
|
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
|
2019-07-29 17:28:31 +00:00
|
|
|
always { dir(env.STATUS_PATH) {
|
|
|
|
sh 'make clean'
|
|
|
|
sh "rm -fr ${dest}"
|
|
|
|
} }
|
2019-02-07 12:12:35 +00:00
|
|
|
} // post
|
2019-02-01 17:02:52 +00:00
|
|
|
} // pipeline
|