status-mobile/ci/Jenkinsfile.combined

146 lines
4.6 KiB
Plaintext

pipeline {
agent { label 'master' }
options {
disableConcurrentBuilds()
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')
/* to avoid missing build tag parallel builds */
print "Build Number: ${cmn.tagBuild(true)}"
} }
}
stage('Build') {
parallel {
stage('MacOS') {
when { expression { cmn.getBuildType() != 'release' } }
steps { script {
osx = cmn.buildBranch('status-react/combined/desktop-macos', cmn.getBuildType())
} } }
stage('Linux') {
when { expression { cmn.getBuildType() != 'release' } }
steps { script {
nix = cmn.buildBranch('status-react/combined/desktop-linux', cmn.getBuildType())
} } }
stage('iOS') { steps { script {
ios = cmn.buildBranch('status-react/combined/mobile-ios', cmn.getBuildType())
} } }
stage('Android') { steps { script {
dro = cmn.buildBranch('status-react/combined/mobile-android', cmn.getBuildType())
} } }
stage('Android e2e') { steps { script {
e2e = cmn.buildBranch('status-react/combined/mobile-android', 'e2e')
} } }
}
}
stage('Archive') {
steps { script {
sh('rm -f pkg/*')
if (cmn.getBuildType() != 'release') {
cmn.copyArts('status-react/combined/desktop-macos', osx.number)
cmn.copyArts('status-react/combined/desktop-linux', nix.number)
}
cmn.copyArts('status-react/combined/mobile-android', dro.number)
cmn.copyArts('status-react/combined/mobile-android', e2e.number)
archiveArtifacts('pkg/*')
} }
}
stage('Upload') {
steps { script {
e2eUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*e2e.apk')[0].path)
apkUrl = cmn.uploadArtifact(findFiles(glob: "pkg/*${cmn.getBuildType()}.apk")[0].path)
if (cmn.getBuildType() != 'release') {
dmgUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*.dmg')[0].path)
appUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*.AppImage')[0].path)
} else {
dmgUrl = null
appUrl = null
}
/* special case for iOS Diawi links */
ipaUrl = ios.getBuildVariables().get('DIAWI_URL')
} }
}
stage('Notify') {
steps { script {
def dmgLink = "<${dmgUrl}|MacOS>"
def appLink = "<${appUrl}|AppImage>"
def message = (
(env.CHANGE_ID != null ?
"Build PR #${BRANCH_NAME}(${CHANGE_BRANCH}) success! " :
"Build ${cmn.getBuildType()} success! "
)+
"<${currentBuild.absoluteUrl}|${currentBuild.displayName}> "+
"(${currentBuild.durationString})\n"+
"Packages: <${apkUrl}|Android>, (<${e2eUrl}|e2e>), <${ipaUrl}|iOS>"
)
if (dmgUrl != null) {
message = message + ", <${dmgUrl}|MacOS>"
}
if (appUrl != null) {
message = message + ", <${appUrl}|AppImage>"
}
slackSend(
message: message,
color: 'good'
)
if (env.CHANGE_ID != null) {
cmn.githubNotify(
apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl,
env.CHANGE_ID
)
}
} }
}
stage('Publish') {
steps { script {
switch (cmn.getBuildType()) {
case 'nightly':
build(
job: 'misc/status-im.github.io-update_env',
parameters: [
[name: 'APK_URL', value: apkUrl, $class: 'StringParameterValue'],
[name: 'IOS_URL', value: ipaUrl, $class: 'StringParameterValue'],
[name: 'DMG_URL', value: dmgUrl, $class: 'StringParameterValue'],
[name: 'NIX_URL', value: appUrl, $class: 'StringParameterValue']
]
); break
case 'release':
build(
job: 'misc/cn.status.im',
parameters: [
[name: 'APK_URL', value: apkUrl, $class: 'StringParameterValue'],
]
); break
}
} }
}
stage('Run e2e') {
when { expression { cmn.getBuildType() == 'nightly' } }
steps { script {
e2eApk = e2e.getBuildVariables().get('SAUCE_URL')
build(
job: 'end-to-end-tests/status-app-nightly', wait: false,
parameters: [string(name: 'apk', value: "--apk=${e2eApk}")]
)
} }
}
}
}