status-go/_assets/ci/Jenkinsfile

95 lines
2.5 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.10'
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 a new release on GitHub and DigitalOcean Space.',
)
}
options {
/* Prevent Jenkins jobs from running forever */
timeout(time: 40, unit: 'MINUTES')
ansiColor('xterm')
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',
artifactNumToKeepStr: '1',
))
}
environment {
REPO = "${env.WORKSPACE}/src/github.com/status-im/status-go"
GOPATH = "${env.WORKSPACE}"
PATH = "/usr/local/go/bin:${env.PATH}:${env.GOPATH}/bin"
2019-02-01 17:02:52 +00:00
/* This will override the var in Makefile */
RELEASE_DIR = "${env.WORKSPACE}/pkg"
}
stages {
stage('Build') {
parallel {
2019-02-01 17:02:52 +00:00
stage('iOS') { steps { script {
ios = jenkins.Build('status-go/platforms/ios')
2019-02-01 17:02:52 +00:00
} } }
stage('Android') { steps { script {
android = jenkins.Build('status-go/platforms/android')
2019-02-01 17:02:52 +00:00
} } }
stage('Linux') { steps { script {
linux = jenkins.Build('status-go/platforms/linux')
2019-02-01 17:02:52 +00:00
} } }
stage('Docker') { steps { script {
dock = jenkins.Build('status-go/platforms/docker')
} } }
2019-02-01 17:02:52 +00:00
} // parallel
} // stage(Build)
stage('Archive') {
steps { script {
sh "rm -fr ${env.RELEASE_DIR}"
sh "mkdir ${env.RELEASE_DIR}"
2019-10-05 09:13:53 +00:00
[ios, android, linux].each { platformBuild ->
jenkins.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('*')
}
2019-02-01 17:02:52 +00:00
} }
} // stage(Archive)
stage('Release') {
when { expression { params.RELEASE == true } }
steps { script {
dir (env.REPO) { version = utils.getVersion() }
github.publishReleaseFiles(
repo: 'status-go',
version: version,
desc: ':warning: Fill me in!',
)
} }
2019-02-01 17:02:52 +00:00
} // stage(Release)
} // stages
post {
always { dir(env.REPO) {
sh 'make clean-release'
} }
}
}