2021-04-30 09:22:21 +02:00
|
|
|
library 'status-jenkins-lib@v1.2.16'
|
2020-03-06 16:43:04 +01:00
|
|
|
|
2018-08-14 14:09:52 -04:00
|
|
|
pipeline {
|
2019-04-11 20:03:36 +02:00
|
|
|
agent { label 'linux' }
|
2018-08-14 14:09:52 -04:00
|
|
|
|
|
|
|
options {
|
2018-11-13 12:58:34 +01:00
|
|
|
timestamps()
|
2018-10-30 10:38:52 +01:00
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2020-07-02 11:58:45 +02:00
|
|
|
timeout(time: 20, unit: 'MINUTES')
|
2018-10-30 10:38:52 +01:00
|
|
|
/* Limit builds retained */
|
2018-08-14 14:09:52 -04:00
|
|
|
buildDiscarder(logRotator(
|
2018-12-13 10:49:16 +01:00
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '20',
|
|
|
|
artifactNumToKeepStr: '10',
|
2018-08-14 14:09:52 -04:00
|
|
|
))
|
2020-05-11 11:04:11 +02:00
|
|
|
/* Allows combined build to copy */
|
|
|
|
copyArtifactPermission('/status-react/*')
|
2018-08-14 14:09:52 -04:00
|
|
|
}
|
2018-09-25 20:01:48 +03:00
|
|
|
|
2018-12-11 12:00:22 +01:00
|
|
|
parameters {
|
2018-12-11 15:27:21 +01:00
|
|
|
string(
|
2018-12-11 12:00:22 +01:00
|
|
|
name: 'BUILD_TYPE',
|
2018-12-11 15:27:21 +01:00
|
|
|
description: 'Specify build type. Values: pr / e2e / nightly / release',
|
2018-12-11 12:00:22 +01:00
|
|
|
defaultValue: 'pr',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-08-14 14:09:52 -04:00
|
|
|
environment {
|
2019-05-10 17:33:54 +02:00
|
|
|
LANG = "en_US.UTF-8"
|
|
|
|
LC_ALL = "en_US.UTF-8"
|
|
|
|
LANGUAGE = "en_US.UTF-8"
|
2019-11-29 11:20:08 +01:00
|
|
|
TARGET = 'android'
|
2019-07-15 18:34:33 +02:00
|
|
|
BUILD_ENV = 'prod'
|
2019-05-10 17:33:54 +02:00
|
|
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
2018-08-14 14:09:52 -04:00
|
|
|
FASTLANE_DISABLE_COLORS = 1
|
2019-07-03 21:00:51 +02:00
|
|
|
/* coverage report identification */
|
|
|
|
COVERALLS_SERVICE_NAME = "jenkins"
|
|
|
|
COVERALLS_SERVICE_JOB_ID = "${JOB_NAME}#${BUILD_NUMBER}"
|
2018-08-14 14:09:52 -04:00
|
|
|
}
|
2018-09-25 20:01:48 +03:00
|
|
|
|
2018-08-14 14:09:52 -04:00
|
|
|
stages {
|
|
|
|
stage('Prep') {
|
|
|
|
steps {
|
|
|
|
script {
|
2020-03-06 16:43:04 +01:00
|
|
|
btype = utils.getBuildType()
|
2019-02-05 10:35:14 +01:00
|
|
|
print "Running ${btype} build!"
|
2020-03-06 16:43:04 +01:00
|
|
|
jenkins.abortPreviousRunningBuilds()
|
2019-01-15 15:44:50 +01:00
|
|
|
/* Cleanup and Prep */
|
2020-03-06 16:43:04 +01:00
|
|
|
commonPrep(btype)
|
2018-08-14 14:09:52 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-09 18:37:58 +03:00
|
|
|
stage('Parallel Assemble') {
|
2019-06-07 12:48:54 -04:00
|
|
|
parallel {
|
|
|
|
stage('Checks') { stages {
|
|
|
|
stage('Lint') {
|
|
|
|
steps {
|
2020-03-26 14:37:41 +01:00
|
|
|
script {
|
|
|
|
/* We want the build result to be uploaded */
|
|
|
|
catchError(
|
|
|
|
message: 'Linting check failed!',
|
|
|
|
buildResult: 'FAILURE',
|
|
|
|
stageResult: 'FAILURE'
|
|
|
|
) {
|
2019-09-07 14:57:22 +02:00
|
|
|
sh 'make lint'
|
2020-03-26 14:37:41 +01:00
|
|
|
}
|
|
|
|
}
|
2019-06-07 12:48:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Tests') {
|
|
|
|
steps {
|
2019-09-07 14:57:22 +02:00
|
|
|
script {
|
|
|
|
sh 'make test'
|
|
|
|
}
|
2019-06-07 12:48:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
stage('Build') { stages {
|
|
|
|
stage('Bundle') {
|
|
|
|
steps {
|
2019-09-13 13:16:13 -04:00
|
|
|
script { apks = android.bundle() }
|
2019-06-07 12:48:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} }
|
2019-01-18 01:31:07 +01:00
|
|
|
}
|
2018-08-14 14:09:52 -04:00
|
|
|
}
|
2019-10-09 18:37:58 +03:00
|
|
|
stage('Parallel Upload') {
|
|
|
|
parallel {
|
|
|
|
stage('Archive') {
|
|
|
|
steps { script {
|
|
|
|
apks.each { archiveArtifacts it }
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
stage('Upload') {
|
|
|
|
steps {
|
|
|
|
script {
|
2020-03-06 16:43:04 +01:00
|
|
|
def urls = apks.collect { s3.uploadArtifact(it) }
|
2019-10-09 18:37:58 +03:00
|
|
|
/* return only the universal APK */
|
|
|
|
if (urls.size() > 1) {
|
|
|
|
env.PKG_URL = urls.find { it.contains('universal') }
|
|
|
|
} else { /* if no universal is available pick first */
|
|
|
|
env.PKG_URL = urls.first()
|
|
|
|
}
|
2020-10-01 15:01:28 +02:00
|
|
|
jenkins.setBuildDesc(APK: env.PKG_URL)
|
|
|
|
/* e2e builds get tested in SauceLabs */
|
2020-07-08 16:08:51 +02:00
|
|
|
if (utils.isE2EBuild()) {
|
|
|
|
env.SAUCE_URL = android.uploadToSauceLabs()
|
2019-10-09 18:37:58 +03:00
|
|
|
}
|
2020-10-01 15:01:28 +02:00
|
|
|
if (utils.isNightlyBuild()) {
|
|
|
|
env.DIAWI_URL = android.uploadToDiawi()
|
|
|
|
}
|
2019-10-09 18:37:58 +03:00
|
|
|
}
|
2018-09-25 20:01:48 +03:00
|
|
|
}
|
2018-08-27 11:32:54 -04:00
|
|
|
}
|
2018-08-14 14:09:52 -04:00
|
|
|
}
|
|
|
|
}
|
2018-12-13 10:49:16 +01:00
|
|
|
stage('Cleanup') {
|
2019-10-09 18:37:58 +03:00
|
|
|
steps {
|
2020-12-21 09:20:38 +01:00
|
|
|
sh 'make purge'
|
2019-10-09 18:37:58 +03:00
|
|
|
}
|
2018-12-13 10:49:16 +01:00
|
|
|
}
|
2018-12-11 15:27:21 +01:00
|
|
|
}
|
|
|
|
post {
|
2020-03-06 16:43:04 +01:00
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
2019-07-23 08:19:48 +02:00
|
|
|
always { sh 'make _fix-node-perms' }
|
2018-08-14 14:09:52 -04:00
|
|
|
}
|
|
|
|
}
|