status-mobile/ci/Jenkinsfile.combined

126 lines
3.9 KiB
Plaintext
Raw Normal View History

pipeline {
agent { label 'master' }
options {
timestamps()
disableConcurrentBuilds()
/* Prevent Jenkins jobs from running forever */
timeout(time: 45, unit: 'MINUTES')
/* Limit builds retained */
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '10',
))
}
stages {
stage('Prep') {
steps { script {
println "Current JOB: ${env.JOB_NAME}"
/* load common lib */
cmn = load('ci/common.groovy')
/* just for a shorter access */
btype = cmn.getBuildType()
} }
}
stage('Build') {
parallel {
stage('MacOS') { steps { script {
osx = cmn.buildBranch('status-react/combined/desktop-macos')
} } }
stage('Linux') { steps { script {
nix = cmn.buildBranch('status-react/combined/desktop-linux')
} } }
stage('Windows') { steps { script {
win = cmn.buildBranch('status-react/combined/desktop-windows')
} } }
stage('iOS') { steps { script {
ios = cmn.buildBranch('status-react/combined/mobile-ios')
} } }
stage('iOS e2e') { steps { script {
iose2e = cmn.buildBranch('status-react/combined/mobile-ios', 'e2e')
} } }
stage('Android') { steps { script {
apk = cmn.buildBranch('status-react/combined/mobile-android')
} } }
stage('Android e2e') { steps { script {
apke2e = cmn.buildBranch('status-react/combined/mobile-android', 'e2e')
} } }
}
}
stage('Archive') {
steps { script {
sh('rm -f pkg/*')
if (btype != 'release') {
cmn.copyArts('status-react/combined/desktop-macos', osx.number)
cmn.copyArts('status-react/combined/desktop-linux', nix.number)
cmn.copyArts('status-react/combined/desktop-windows', win.number)
}
cmn.copyArts('status-react/combined/mobile-ios', ios.number)
cmn.copyArts('status-react/combined/mobile-ios', iose2e.number)
cmn.copyArts('status-react/combined/mobile-android', apk.number)
cmn.copyArts('status-react/combined/mobile-android', apke2e.number)
dir('pkg') {
/* generate sha256 checksums for upload */
sh "sha256sum * | tee ${cmn.pkgFilename(btype, 'sha256')}"
archiveArtifacts('*')
}
} }
}
stage('Upload') {
steps { script {
/* object for easier URLs handling */
urls = [
/* mobile */
Apk: cmn.pkgUrl(apk), Apke2e: cmn.pkgUrl(apke2e),
iOS: cmn.pkgUrl(ios), iOSe2e: cmn.pkgUrl(iose2e),
/* desktop */
App: cmn.pkgUrl(nix), Mac: cmn.pkgUrl(ios), Win: cmn.pkgUrl(win),
/* upload the sha256 checksums file too */
SHA: cmn.uploadArtifact(cmn.pkgFind('sha256')),
]
/* add URLs to the build description */
cmn.setBuildDesc(urls)
/* Create latest.json with newest nightly URLs */
if (btype == 'nightly') {
cmn.updateLatestNightlies(urls)
}
} }
}
stage('Notify') { when { expression { env.CHANGE_ID != null } }
steps { script {
cmn.gitHubNotifyFull(urls)
} }
}
stage('Publish') {
steps { script {
switch (btype) {
case 'nightly':
build('misc/status.im')
break
case 'release':
build(
job: 'misc/cn.status.im',
parameters: [
[name: 'APK_URL', value: urls.Apk, $class: 'StringParameterValue'],
]
)
break
}
} }
}
stage('Run e2e') {
when { expression { btype == 'nightly' } }
steps { script {
e2eApk = cmn.getEnv(apke2e, 'SAUCE_URL')
build(
job: 'end-to-end-tests/status-app-nightly', wait: false,
parameters: [string(name: 'apk', value: "--apk=${e2eApk}")]
)
} }
}
}
}