2018-09-25 13:05:00 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
2017-09-15 16:14:36 +00:00
|
|
|
|
2018-09-25 13:05:00 +00:00
|
|
|
parameters {
|
2019-02-25 14:59:12 +00:00
|
|
|
string(
|
|
|
|
name: 'BRANCH',
|
|
|
|
defaultValue: 'develop',
|
|
|
|
description: 'Name of branch to build.'
|
|
|
|
)
|
2018-09-25 13:05:00 +00:00
|
|
|
booleanParam(
|
2018-11-27 12:01:34 +00:00
|
|
|
name: 'RELEASE',
|
2018-09-25 13:05:00 +00:00
|
|
|
defaultValue: false,
|
2019-02-25 14:59:12 +00:00
|
|
|
description: 'Enable to create a new release on GitHub and DigitalOcean Space.',
|
2018-09-25 13:05:00 +00:00
|
|
|
)
|
|
|
|
}
|
2017-09-21 18:38:25 +00:00
|
|
|
|
2018-09-25 13:05:00 +00:00
|
|
|
options {
|
|
|
|
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',
|
|
|
|
))
|
|
|
|
}
|
2017-09-15 16:14:36 +00:00
|
|
|
|
2018-09-25 13:05:00 +00:00
|
|
|
environment {
|
2019-04-15 09:57:06 +00:00
|
|
|
STATUS_PATH = "${env.WORKSPACE}/src/github.com/status-im/status-go"
|
2019-02-07 12:12:35 +00:00
|
|
|
CI_DIR = "${env.STATUS_PATH}/_assets/ci"
|
|
|
|
GOPATH = "${env.WORKSPACE}"
|
|
|
|
PATH = "${env.PATH}:${env.GOPATH}/bin"
|
2019-02-01 17:02:52 +00:00
|
|
|
/* This will override the var in Makefile */
|
2019-04-12 10:50:14 +00:00
|
|
|
RELEASE_DIR = "${env.WORKSPACE}/pkg"
|
2018-09-25 13:05:00 +00:00
|
|
|
}
|
2017-09-15 16:14:36 +00:00
|
|
|
|
2018-09-25 13:05:00 +00:00
|
|
|
stages {
|
|
|
|
stage('Prep') {
|
|
|
|
steps { script {
|
|
|
|
lib = load("${env.STATUS_PATH}/_assets/ci/lib.groovy")
|
2019-04-15 09:57:06 +00:00
|
|
|
version = lib.getVersion()
|
2018-12-06 12:22:18 +00:00
|
|
|
println("Version: ${version}")
|
2018-09-25 13:05:00 +00:00
|
|
|
println("Git Branch: ${lib.gitBranch()}")
|
|
|
|
println("Git Commit: ${lib.gitCommit()}")
|
|
|
|
} }
|
2019-02-01 17:02:52 +00:00
|
|
|
} // stage(Prep)
|
|
|
|
|
2018-09-25 13:05:00 +00:00
|
|
|
stage('Setup') { steps { dir(env.STATUS_PATH) {
|
2019-02-01 17:02:52 +00:00
|
|
|
/* install release tools */
|
|
|
|
sh 'make release-install'
|
|
|
|
} } } // stage(Setup)
|
|
|
|
|
2017-09-15 16:14:36 +00:00
|
|
|
stage('Build') {
|
2018-09-25 13:05:00 +00:00
|
|
|
parallel {
|
2019-02-01 17:02:52 +00:00
|
|
|
stage('iOS') { steps { script {
|
|
|
|
ios = lib.buildBranch('status-go/platforms/ios')
|
|
|
|
} } }
|
|
|
|
stage('Android') { steps { script {
|
|
|
|
android = lib.buildBranch('status-go/platforms/android')
|
|
|
|
} } }
|
|
|
|
stage('Linux') { steps { script {
|
|
|
|
linux = lib.buildBranch('status-go/platforms/linux')
|
|
|
|
} } }
|
2019-03-25 10:35:38 +00:00
|
|
|
stage('Docker') { steps { script {
|
2019-03-29 17:49:18 +00:00
|
|
|
dock = lib.buildBranch('status-go/platforms/docker')
|
2019-03-25 10:35:38 +00:00
|
|
|
} } }
|
2019-04-12 10:50:14 +00:00
|
|
|
stage('XGO') { steps { script {
|
|
|
|
xgo = lib.buildBranch('status-go/platforms/xgo')
|
|
|
|
} } }
|
2019-02-01 17:02:52 +00:00
|
|
|
} // parallel
|
|
|
|
} // stage(Build)
|
|
|
|
|
|
|
|
stage('Archive') {
|
|
|
|
steps { script {
|
2019-04-12 10:50:14 +00:00
|
|
|
sh("rm -fr ${env.RELEASE_DIR}/*")
|
|
|
|
[ios, android, linux, xgo].each { platformBuild ->
|
|
|
|
lib.copyArts(platformBuild)
|
|
|
|
}
|
|
|
|
dir(env.RELEASE_DIR) {
|
2019-02-01 17:02:52 +00:00
|
|
|
/* generate sha256 checksums for upload */
|
|
|
|
sh 'sha256sum * | tee checksum.sha256'
|
|
|
|
archiveArtifacts('*')
|
2018-09-25 13:05:00 +00:00
|
|
|
}
|
2019-02-01 17:02:52 +00:00
|
|
|
} }
|
|
|
|
} // stage(Archive)
|
|
|
|
|
|
|
|
stage('Release') { when { expression { params.RELEASE == true } }
|
2019-04-12 10:50:14 +00:00
|
|
|
steps { script {
|
2019-04-15 09:57:06 +00:00
|
|
|
def suffix = "-"+lib.suffix()
|
2019-02-01 17:02:52 +00:00
|
|
|
/* rename build files to not include versions */
|
2019-04-12 10:50:14 +00:00
|
|
|
dir(env.RELEASE_DIR) {
|
2019-04-15 09:57:06 +00:00
|
|
|
findFiles(glob: 'status-go-*').each { pkg ->
|
|
|
|
sh "mv ${pkg.path} ${pkg.path.replace(suffix, "")}"
|
2019-04-12 10:50:14 +00:00
|
|
|
}
|
2018-12-06 12:22:18 +00:00
|
|
|
}
|
2019-02-01 17:02:52 +00:00
|
|
|
/* perform the release */
|
|
|
|
dir(env.STATUS_PATH) {
|
|
|
|
withCredentials([[
|
|
|
|
$class: 'UsernamePasswordMultiBinding',
|
|
|
|
credentialsId: 'status-im-auto',
|
|
|
|
usernameVariable: 'GITHUB_USER',
|
|
|
|
passwordVariable: 'GITHUB_TOKEN'
|
|
|
|
]]) {
|
2019-04-12 10:50:14 +00:00
|
|
|
env.RELEASE_BRANCH = lib.gitBranch()
|
|
|
|
env.RELEASE_DIR = env.RELEASE_DIR
|
|
|
|
sh 'yes | make release'
|
2018-09-25 13:05:00 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-12 10:50:14 +00:00
|
|
|
} }
|
2019-02-01 17:02:52 +00:00
|
|
|
} // stage(Release)
|
|
|
|
|
|
|
|
stage('Cleanup') { steps { dir(env.STATUS_PATH) {
|
|
|
|
sh 'make clean-release'
|
|
|
|
} } } // stage(Cleanup)
|
|
|
|
} // stages
|
2017-09-15 16:14:36 +00:00
|
|
|
}
|