status-go/_assets/ci/Jenkinsfile.android

85 lines
2.4 KiB
Plaintext

library 'status-jenkins-lib@v1.2.17'
pipeline {
agent { label 'linux' }
parameters {
string(
name: 'BRANCH',
defaultValue: 'develop',
description: 'Name of branch to build.'
)
booleanParam(
name: 'RELEASE',
defaultValue: false,
description: 'Enable to create build for release.',
)
}
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 {
/* fix for gomobile complaining about missing packages */
CGO_ENABLED = "1"
GO111MODULE = "off"
/* Other stuff */
TARGET = 'android'
GOPATH = "${env.WORKSPACE}"
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go"
ARTIFACT = "${env.WORKSPACE}/status-go-android-${utils.timestamp()}-${utils.gitCommit()}.aar"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
/* Android SDK */
ANDROID_HOME = '/usr/lib/android-sdk'
ANDROID_SDK_ROOT = '/usr/lib/android-sdk'
/* gomobile requires a specific NDK version */
ANDROID_NDK = "${env.NDK_GOMOBILE}"
ANDROID_NDK_HOME = "${env.NDK_GOMOBILE}"
}
stages {
stage('Prep') { steps { dir(env.STATUS_PATH) { script {
println("Version: ${utils.getVersion()}")
println("Git Branch: ${utils.branchName()}")
println("Git Commit: ${utils.gitCommit()}")
} } } }
stage('Setup') { steps { dir(env.STATUS_PATH) {
sh 'make setup-build modvendor-install'
} } }
stage('Vendoring check') { steps { dir(env.STATUS_PATH) {
/* fail build if vendoring hasn't been done */
sh 'GO111MODULE=on make vendor'
sh 'git diff --exit-code --no-color --stat vendor/'
} } }
stage('Compile') { steps { dir(env.STATUS_PATH) {
sh 'make statusgo-android'
sh "cp build/bin/statusgo.aar ${env.ARTIFACT}"
} } }
stage('Archive') { steps {
archiveArtifacts(env.ARTIFACT.minus("${env.WORKSPACE}/"))
} }
stage('Upload') { steps { script {
env.PKG_URL = s3.uploadArtifact(env.ARTIFACT)
} } }
} // stages
post {
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
always { dir(env.STATUS_PATH) { sh 'make clean' } }
} // post
} // pipeline