status-mobile/ci/Jenkinsfile.combined

115 lines
3.6 KiB
Plaintext

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')
gh = load('ci/github.groovy')
/* just for a shorter access */
btype = cmn.utils.getBuildType()
} }
}
stage('Build') {
parallel {
//stage('MacOS') { steps { script {
// osx = cmn.ci.Build('status-react/combined/desktop-macos')
//} } }
//stage('Linux') { steps { script {
// nix = cmn.ci.Build('status-react/combined/desktop-linux')
//} } }
//stage('Windows') { steps { script {
// win = cmn.ci.Build('status-react/combined/desktop-windows')
//} } }
//stage('iOS e2e') { steps { script {
// iose2e = cmn.ci.Build('status-react/combined/mobile-ios-e2e')
//} } }
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/*')
//if (btype != 'release') {
// cmn.ci.copyArts(osx)
// cmn.ci.copyArts(nix)
// cmn.ci.copyArts(win)
//}
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'),
/* desktop */
//App: cmn.pkgUrl(nix), Mac: cmn.pkgUrl(osx), Win: cmn.pkgUrl(win),
/* upload the sha256 checksums file too */
SHA: cmn.utils.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
case 'release': cmn.updateBucketJSON(urls, 'release.json'); break
}
} }
}
stage('Publish') {
steps { script {
switch (btype) {
case 'nightly': build('misc/status.im'); 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)]
)
} }
}
}
}