2018-08-14 18:09:52 +00:00
|
|
|
pipeline {
|
2018-12-09 14:58:03 +00:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
label 'linux'
|
|
|
|
image 'statusteam/status-build-android:1.0.0'
|
|
|
|
args (
|
|
|
|
"-v /home/jenkins/tmp:/var/tmp:rw "+
|
|
|
|
"-v /home/jenkins/status-im.keystore:/tmp/status-im.keystore:ro"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
|
|
|
|
options {
|
2018-11-13 11:58:34 +00:00
|
|
|
timestamps()
|
2018-12-11 14:27:21 +00:00
|
|
|
disableConcurrentBuilds()
|
2018-10-30 09:38:52 +00:00
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2018-11-14 12:35:15 +00:00
|
|
|
timeout(time: 35, unit: 'MINUTES')
|
2018-10-30 09:38:52 +00:00
|
|
|
/* Limit builds retained */
|
2018-08-14 18:09:52 +00:00
|
|
|
buildDiscarder(logRotator(
|
2018-12-13 09:49:16 +00:00
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '20',
|
|
|
|
artifactNumToKeepStr: '10',
|
2018-08-14 18:09:52 +00:00
|
|
|
))
|
|
|
|
}
|
2018-09-25 17:01:48 +00:00
|
|
|
|
2018-12-11 11:00:22 +00:00
|
|
|
parameters {
|
2018-12-11 14:27:21 +00:00
|
|
|
string(
|
2018-12-11 11:00:22 +00:00
|
|
|
name: 'BUILD_TYPE',
|
2018-12-11 14:27:21 +00:00
|
|
|
description: 'Specify build type. Values: pr / e2e / nightly / release',
|
2018-12-11 11:00:22 +00:00
|
|
|
defaultValue: 'pr',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
environment {
|
2018-09-18 12:22:30 +00:00
|
|
|
BUILD_PLATFORM = 'android'
|
2018-12-09 14:58:03 +00:00
|
|
|
LANG = 'en_US.UTF-8'
|
2018-08-14 18:09:52 +00:00
|
|
|
LANGUAGE = 'en_US.UTF-8'
|
2018-12-09 14:58:03 +00:00
|
|
|
LC_ALL = 'en_US.UTF-8'
|
2018-08-14 18:09:52 +00:00
|
|
|
FASTLANE_DISABLE_COLORS = 1
|
|
|
|
REALM_DISABLE_ANALYTICS = 1
|
2018-12-09 14:58:03 +00:00
|
|
|
/* since we are mounting it we need to specify location */
|
|
|
|
STATUS_RELEASE_STORE_FILE = '/tmp/status-im.keystore'
|
|
|
|
ANDROID_HOME = '/usr/lib/android-sdk'
|
|
|
|
ANDROID_SDK_ROOT = '/usr/lib/android-sdk'
|
|
|
|
ANDROID_NDK = '/usr/lib/android-ndk'
|
|
|
|
ANDROID_NDK_HOME = '/usr/lib/android-ndk'
|
|
|
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
|
|
|
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
|
|
|
|
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
|
|
|
|
BUNDLE_PATH = "/var/tmp/bundle-${EXECUTOR_NUMBER}"
|
|
|
|
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2018-09-25 17:01:48 +00:00
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
stages {
|
|
|
|
stage('Prep') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
/* Necessary to load methods */
|
|
|
|
mobile = load 'ci/mobile.groovy'
|
2018-08-29 07:43:21 +00:00
|
|
|
cmn = load 'ci/common.groovy'
|
2018-12-11 14:27:21 +00:00
|
|
|
print "Running ${cmn.getBuildType()} build!"
|
2018-11-27 10:15:33 +00:00
|
|
|
/* Run at start to void mismatched numbers */
|
|
|
|
cmn.buildNumber()
|
2019-01-15 14:44:50 +00:00
|
|
|
/* Read the valid NodeJS version */
|
|
|
|
env.NODE_VERSION = cmn.getToolVersion('node')
|
|
|
|
/* Cleanup and Prep */
|
|
|
|
nvm(env.NODE_VERSION) {
|
|
|
|
mobile.prep(cmn.getBuildType())
|
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-27 15:32:54 +00:00
|
|
|
stage('Lint') {
|
2019-01-15 14:44:50 +00:00
|
|
|
steps { nvm(env.NODE_VERSION) {
|
2018-09-25 17:01:48 +00:00
|
|
|
script { cmn.runLint() }
|
2019-01-15 14:44:50 +00:00
|
|
|
} }
|
2018-08-27 15:32:54 +00:00
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
stage('Tests') {
|
2019-01-15 14:44:50 +00:00
|
|
|
steps { nvm(env.NODE_VERSION) {
|
2018-09-25 17:01:48 +00:00
|
|
|
script { cmn.runTests() }
|
2019-01-15 14:44:50 +00:00
|
|
|
} }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
stage('Build') {
|
2019-01-15 14:44:50 +00:00
|
|
|
steps { nvm(env.NODE_VERSION) {
|
2018-08-29 12:38:12 +00:00
|
|
|
script { mobile.leinBuild('android') }
|
2019-01-15 14:44:50 +00:00
|
|
|
} }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2018-12-06 10:52:44 +00:00
|
|
|
stage('Bundle') {
|
2019-01-15 14:44:50 +00:00
|
|
|
steps { nvm(env.NODE_VERSION) {
|
2018-12-06 10:52:44 +00:00
|
|
|
script { apk = mobile.android.bundle(cmn.getBuildType()) }
|
2019-01-15 14:44:50 +00:00
|
|
|
} }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2018-08-21 15:17:25 +00:00
|
|
|
stage('Archive') {
|
2018-08-14 18:09:52 +00:00
|
|
|
steps {
|
2018-12-11 14:27:21 +00:00
|
|
|
archiveArtifacts apk
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
2018-08-21 15:17:25 +00:00
|
|
|
stage('Upload') {
|
2018-08-14 18:09:52 +00:00
|
|
|
steps {
|
2018-08-27 15:32:54 +00:00
|
|
|
script {
|
2018-12-11 14:27:21 +00:00
|
|
|
env.PKG_URL = cmn.uploadArtifact(apk)
|
|
|
|
/* build type specific */
|
2018-08-29 07:43:21 +00:00
|
|
|
switch (cmn.getBuildType()) {
|
2018-08-27 15:32:54 +00:00
|
|
|
case 'release':
|
|
|
|
mobile.android.uploadToPlayStore(); break;
|
|
|
|
case 'nightly':
|
2018-08-31 11:56:55 +00:00
|
|
|
env.DIAWI_URL = mobile.android.uploadToDiawi(); break;
|
2018-08-27 15:32:54 +00:00
|
|
|
case 'e2e':
|
2018-08-29 15:39:49 +00:00
|
|
|
env.SAUCE_URL = mobile.android.uploadToSauceLabs()
|
2018-09-25 17:01:48 +00:00
|
|
|
}
|
2018-08-27 15:32:54 +00:00
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-13 09:49:16 +00:00
|
|
|
stage('Cleanup') {
|
|
|
|
steps {
|
|
|
|
script { cmn.clean() }
|
|
|
|
}
|
|
|
|
}
|
2018-12-11 14:27:21 +00:00
|
|
|
}
|
|
|
|
post {
|
2018-12-13 13:22:36 +00:00
|
|
|
failure { script { load('ci/common.groovy').notifyPRFailure() } }
|
2019-01-09 10:53:59 +00:00
|
|
|
success { script { load('ci/common.groovy').notifyPRSuccess() } }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|