status-mobile/ci/Jenkinsfile.combined

110 lines
3.6 KiB
Plaintext
Raw Normal View History

pipeline {
agent { label 'master' }
parameters {
string(
name: 'BUILD_TYPE',
description: 'Values: nightly / e2e / release'
)
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
artifactNumToKeepStr: '10',
))
}
stages {
stage('Tag') {
steps { script {
cmn = load('ci/common.groovy')
/* to avoid missing build tag parallel builds */
print "Build Number: ${cmn.tagBuild(true)}"
} }
}
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('iOS') { steps { script {
ios = cmn.buildBranch('status-react/combined/mobile-ios')
} } }
stage('Android') { steps { script {
dro = cmn.buildBranch('status-react/combined/mobile-android')
} } }
stage('Android e2e') { steps { script {
e2e = cmn.buildBranch('status-react/combined/mobile-android', 'e2e')
} } }
}
}
stage('Archive') {
steps { script {
sh('rm -f pkg/*')
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') {
when { expression { params.BUILD_TYPE == 'nightly' } }
steps { script {
e2eUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*.e2e.apk')[0].path)
apkUrl = cmn.uploadArtifact(findFiles(glob: "pkg/*.${params.BUILD_TYPE}.apk")[0].path)
dmgUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*.dmg')[0].path)
appUrl = cmn.uploadArtifact(findFiles(glob: 'pkg/*.AppImage')[0].path)
/* special case for iOS Diawi links */
ipaUrl = ios.getBuildVariables().get('DIAWI_URL')
} }
}
stage('Notify') {
steps { script {
slackSend(
message: (
(env.CHANGE_ID != null ?
"Build PR #${BRANCH_NAME}(${CHANGE_BRANCH}) success! " :
"Build ${params.BUILD_TYPE} success! "
)+
"<${currentBuild.absoluteUrl}|${currentBuild.displayName}> "+
"(${currentBuild.durationString})\n"+
(params.BUILD_TYPE == 'nightly' ?
"Packages: "+
"<${apkUrl}|Android>, "+
"(<${e2eUrl}|e2e>), "+
"<${ipaUrl}|iOS>, "+
"<${dmgUrl}|MacOS>, "+
"<${appUrl}|AppImage>" :
"Packages: "+
"<${dro.getBuildVariables().get('DIAWI_URL')}|Android>, "+
"<${ios.getBuildVariables().get('DIAWI_URL')}|iOS>"
)
),
color: 'good'
)
} }
}
stage('Publish') {
when { expression { params.BUILD_TYPE == 'nightly' } }
steps {
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']
]
)
}
}
}
}