status-go/_assets/ci/Jenkinsfile.ios

85 lines
2.3 KiB
Plaintext

pipeline {
agent { label 'macos' }
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: '30',
daysToKeepStr: '30',
))
}
environment {
/* fix for gomobile complaining about missing packages */
CGO_ENABLED = "1"
GO111MODULE = "off"
/* Other stuff */
BUILD_PLATFORM = 'ios'
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go"
CI_DIR = "${env.STATUS_PATH}/_assets/ci"
GOPATH = "${env.WORKSPACE}"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
}
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 */
dest = "${env.WORKSPACE}/out"
sh "mkdir -p ${dest}"
/* for easier reuse */
artifact = "status-go-ios-${lib.suffix()}.zip"
} } }
stage('Setup') { steps { dir(env.STATUS_PATH) {
sh 'unset TMPDIR && make setup-build'
} } }
stage('Compile') { steps { dir(env.STATUS_PATH) {
sh 'make statusgo-ios'
sh 'go get golang.org/x/tools/go/packages'
dir('build/bin') {
sh 'zip -r status-go-ios.zip Statusgo.framework'
sh "cp status-go-ios.zip ${dest}/${artifact}"
}
} } }
stage('Archive') { steps {
archiveArtifacts("out/${artifact}")
} }
stage('Upload') { steps { script {
env.PKG_URL = lib.uploadArtifact("out/${artifact}")
} } }
} // stages
post {
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
always { dir(env.STATUS_PATH) {
sh 'make clean'
sh "rm -fr ${dest}"
} }
} // post
} // pipeline