status-go/_assets/ci/Jenkinsfile-manual

89 lines
2.3 KiB
Groovy

#!/usr/bin/env groovy
node('linux') {
env.GOPATH = "${env.WORKSPACE}"
env.PATH = "${env.PATH}:${env.GOPATH}/bin"
cloneDir = 'src/github.com/status-im/status-go'
paramBranch = env.branch ? env.branch : '*/develop'
dir(cloneDir) {
try {
deleteDir()
} catch (err) {
echo "failure while cleaning the directory"
}
}
checkout(
changelog: false,
poll: true,
scm: [$class: 'GitSCM', branches: [[name: paramBranch]],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'RelativeTargetDirectory', relativeTargetDir: cloneDir]
],
submoduleCfg: [],
userRemoteConfigs: [[url: 'https://github.com/status-im/status-go']]]
)
def remoteOriginRegex = ~/^remotes\/origin\//
dir(cloneDir) {
gitSHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
gitShortSHA = gitSHA.take(8)
gitBranch = sh(returnStdout: true, script: 'git name-rev --name-only HEAD').trim() - remoteOriginRegex
}
stage('Debug') {
sh 'env'
println(gitBranch)
println(gitSHA)
}
stage('Test') {
dir(cloneDir) {
sh 'make setup'
sh 'make ci'
}
}
stage('Build') {
sh 'go get github.com/status-im/xgo'
parallel (
'statusgo-android': {
dir(cloneDir) {
sh 'make statusgo-android'
}
},
'statusgo-ios-simulator': {
dir(cloneDir) {
sh '''
make statusgo-ios-simulator
cd build/bin/statusgo-ios-9.3-framework/
zip -r status-go-ios.zip Statusgo.framework
'''
}
}
)
}
stage('Deploy') {
dir(cloneDir) {
sh "make prepare-release"
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'status-im-auto',
usernameVariable: 'GITHUB_USER',
passwordVariable: 'GITHUB_TOKEN'
]]) {
sh """
yes | make release release_branch=${gitBranch}
"""
}
sh "make clean-release"
}
}
}