status-react/ci/Jenkinsfile.combined

95 lines
2.8 KiB
Plaintext

pipeline {
agent { label 'linux' }
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')
gh = load('ci/github.groovy')
/* just for a shorter access */
btype = cmn.utils.getBuildType()
} }
}
stage('Build') {
parallel {
stage('iOS') { steps { script {
ios = cmn.ci.Build('status-react/combined/mobile-ios')
} } }
stage('Android') { steps { script {
apk = cmn.ci.Build('status-react/combined/mobile-android')
} } }
stage('Android e2e') { steps { script {
apke2e = cmn.ci.Build('status-react/combined/mobile-android-e2e')
} } }
}
}
stage('Archive') {
steps { script {
sh('rm -f pkg/*')
cmn.ci.copyArts(ios)
//cmn.ci.copyArts(iose2e)
cmn.ci.copyArts(apk)
cmn.ci.copyArts(apke2e)
dir('pkg') {
/* generate sha256 checksums for upload */
sh "sha256sum * | tee ${cmn.utils.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),*/
Diawi: cmn.utils.getEnv(ios, 'DIAWI_URL'),
/* upload the sha256 checksums file too */
SHA: cmn.uploadArtifact(cmn.utils.pkgFind('sha256')),
]
/* add URLs to the build description */
cmn.ci.setBuildDesc(urls)
/* Create JSON file with newest build URLs */
switch (btype) {
/* legacy naming, should have named it nightly.json */
case 'nightly': cmn.updateBucketJSON(urls, 'latest.json'); break
}
} }
}
stage('Publish') {
steps { script {
switch (btype) {
case 'nightly': build(job: 'misc/status.im', wait: false); break
case 'release': gh.publishReleaseMobile(); break
}
} }
}
stage('Run e2e') {
when { expression { btype == 'nightly' } }
steps { script {
e2eApk = cmn.utils.getEnv(apke2e, 'SAUCE_URL')
build(
job: 'end-to-end-tests/status-app-nightly', wait: false,
parameters: [string(name: 'APK_NAME', value: e2eApk)]
)
} }
}
}
}