2023-11-21 15:39:11 +00:00
|
|
|
#!/usr/bin/env groovy
|
2023-11-23 14:55:13 +00:00
|
|
|
library 'status-jenkins-lib@v1.8.10'
|
2021-05-06 15:14:58 +00:00
|
|
|
|
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 {
|
2023-05-29 10:40:00 +00:00
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2023-08-18 11:39:59 +00:00
|
|
|
timeout(time: 40, unit: 'MINUTES')
|
2024-06-21 00:34:44 +00:00
|
|
|
ansiColor('xterm')
|
2018-09-25 13:05:00 +00:00
|
|
|
disableConcurrentBuilds()
|
|
|
|
/* Go requires a certain directory structure */
|
|
|
|
checkoutToSubdirectory('src/github.com/status-im/status-go')
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
2021-03-04 17:08:34 +00:00
|
|
|
numToKeepStr: '5',
|
2018-09-25 13:05:00 +00:00
|
|
|
daysToKeepStr: '30',
|
2024-02-28 14:47:23 +00:00
|
|
|
artifactNumToKeepStr: '1',
|
2018-09-25 13:05:00 +00:00
|
|
|
))
|
|
|
|
}
|
2017-09-15 16:14:36 +00:00
|
|
|
|
2018-09-25 13:05:00 +00:00
|
|
|
environment {
|
2021-09-28 07:52:00 +00:00
|
|
|
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 */
|
2021-05-06 15:14:58 +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 {
|
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 {
|
2021-05-06 15:14:58 +00:00
|
|
|
ios = jenkins.Build('status-go/platforms/ios')
|
2019-02-01 17:02:52 +00:00
|
|
|
} } }
|
|
|
|
stage('Android') { steps { script {
|
2021-05-06 15:14:58 +00:00
|
|
|
android = jenkins.Build('status-go/platforms/android')
|
2019-02-01 17:02:52 +00:00
|
|
|
} } }
|
|
|
|
stage('Linux') { steps { script {
|
2021-05-06 15:14:58 +00:00
|
|
|
linux = jenkins.Build('status-go/platforms/linux')
|
2019-02-01 17:02:52 +00:00
|
|
|
} } }
|
2019-03-25 10:35:38 +00:00
|
|
|
stage('Docker') { steps { script {
|
2021-05-06 15:14:58 +00:00
|
|
|
dock = jenkins.Build('status-go/platforms/docker')
|
2019-03-25 10:35:38 +00:00
|
|
|
} } }
|
2019-02-01 17:02:52 +00:00
|
|
|
} // parallel
|
|
|
|
} // stage(Build)
|
|
|
|
|
|
|
|
stage('Archive') {
|
|
|
|
steps { script {
|
2021-05-06 15:14:58 +00:00
|
|
|
sh "rm -fr ${env.RELEASE_DIR}"
|
|
|
|
sh "mkdir ${env.RELEASE_DIR}"
|
2019-10-05 09:13:53 +00:00
|
|
|
[ios, android, linux].each { platformBuild ->
|
2021-05-06 15:14:58 +00:00
|
|
|
jenkins.copyArts(platformBuild)
|
2019-04-12 10:50:14 +00:00
|
|
|
}
|
|
|
|
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)
|
|
|
|
|
2021-05-06 15:14:58 +00:00
|
|
|
stage('Release') {
|
|
|
|
when { expression { params.RELEASE == true } }
|
2019-04-12 10:50:14 +00:00
|
|
|
steps { script {
|
2021-09-28 07:52:00 +00:00
|
|
|
dir (env.REPO) { version = utils.getVersion() }
|
|
|
|
github.publishReleaseFiles(
|
|
|
|
repo: 'status-go',
|
|
|
|
version: version,
|
|
|
|
desc: ':warning: Fill me in!',
|
|
|
|
)
|
2019-04-12 10:50:14 +00:00
|
|
|
} }
|
2019-02-01 17:02:52 +00:00
|
|
|
} // stage(Release)
|
|
|
|
} // stages
|
2019-07-29 17:28:31 +00:00
|
|
|
|
|
|
|
post {
|
2021-09-28 07:52:00 +00:00
|
|
|
always { dir(env.REPO) {
|
2019-07-29 17:28:31 +00:00
|
|
|
sh 'make clean-release'
|
|
|
|
} }
|
|
|
|
}
|
2017-09-15 16:14:36 +00:00
|
|
|
}
|