2018-08-14 18:09:52 +00:00
|
|
|
pipeline {
|
2019-04-11 18:03:36 +00:00
|
|
|
agent { label 'linux' }
|
2018-08-14 18:09:52 +00:00
|
|
|
|
|
|
|
options {
|
2018-11-13 11:58:34 +00:00
|
|
|
timestamps()
|
2018-10-30 09:38:52 +00:00
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2019-03-25 16:35:01 +00:00
|
|
|
timeout(time: 45, 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 {
|
2019-05-10 15:33:54 +00:00
|
|
|
LANG = "en_US.UTF-8"
|
|
|
|
LC_ALL = "en_US.UTF-8"
|
|
|
|
LANGUAGE = "en_US.UTF-8"
|
2019-04-12 14:38:08 +00:00
|
|
|
TARGET_OS = 'android'
|
2019-05-10 15:33:54 +00:00
|
|
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
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 */
|
2019-04-11 18:03:36 +00:00
|
|
|
STATUS_RELEASE_STORE_FILE = '/home/jenkins/status-im.keystore'
|
2019-03-21 08:33:26 +00:00
|
|
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
2019-06-04 16:50:29 +00:00
|
|
|
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
|
2019-07-03 19:00:51 +00:00
|
|
|
/* coverage report identification */
|
|
|
|
COVERALLS_SERVICE_NAME = "jenkins"
|
|
|
|
COVERALLS_SERVICE_JOB_ID = "${JOB_NAME}#${BUILD_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 */
|
2019-06-07 14:49:36 +00:00
|
|
|
android = load 'ci/android.groovy'
|
|
|
|
cmn = load 'ci/common.groovy'
|
|
|
|
btype = cmn.utils.getBuildType()
|
2019-02-05 09:35:14 +00:00
|
|
|
print "Running ${btype} build!"
|
|
|
|
cmn.ci.abortPreviousRunningBuilds()
|
2019-01-15 14:44:50 +00:00
|
|
|
/* Cleanup and Prep */
|
2019-03-22 13:24:58 +00:00
|
|
|
cmn.prep(btype)
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-04 16:50:29 +00:00
|
|
|
stage('Implicit dependencies') {
|
|
|
|
steps {
|
|
|
|
/* Build implicit dependencies if needed (we run `lein deps :tree` but it's not really required, for this purpose)
|
|
|
|
Implicit dependencies include building a patched node_modules, fetching maven dependencies, and anything else required.
|
|
|
|
We do this before the parallel steps so we have a known starting situation. */
|
|
|
|
script { cmn.nix.shell('lein deps :tree', attr: 'targets.leiningen.shell') }
|
|
|
|
}
|
|
|
|
}
|
2019-06-07 16:48:54 +00:00
|
|
|
stage('Parallel') {
|
|
|
|
parallel {
|
|
|
|
stage('Checks') { stages {
|
|
|
|
stage('Lint') {
|
|
|
|
steps {
|
2019-06-04 16:50:29 +00:00
|
|
|
script { cmn.nix.shell('lein cljfmt check', attr: 'targets.leiningen.shell') }
|
2019-06-07 16:48:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Tests') {
|
|
|
|
steps {
|
2019-06-04 16:50:29 +00:00
|
|
|
script { cmn.nix.shell('lein test-cljs', attr: 'targets.leiningen.shell') }
|
2019-06-07 16:48:54 +00:00
|
|
|
}
|
|
|
|
}
|
2019-07-03 19:00:51 +00:00
|
|
|
stage('Coverage') {
|
|
|
|
steps {
|
|
|
|
script { android.coverage() }
|
|
|
|
}
|
|
|
|
}
|
2019-06-07 16:48:54 +00:00
|
|
|
} }
|
|
|
|
stage('Build') { stages {
|
2019-07-23 20:54:17 +00:00
|
|
|
stage('JSBundle') {
|
2019-06-07 16:48:54 +00:00
|
|
|
steps {
|
2019-07-23 20:54:17 +00:00
|
|
|
script { cmn.nix.build(attr: 'targets.mobile.jsbundle') }
|
2019-06-07 16:48:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Bundle') {
|
|
|
|
steps {
|
|
|
|
script { apk = android.bundle() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} }
|
2019-01-18 00:31:07 +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 {
|
2019-02-05 09:35:14 +00:00
|
|
|
env.PKG_URL = cmn.utils.uploadArtifact(apk)
|
2018-12-11 14:27:21 +00:00
|
|
|
/* build type specific */
|
2019-02-05 09:35:14 +00:00
|
|
|
switch (btype) {
|
2018-08-27 15:32:54 +00:00
|
|
|
case 'release':
|
2019-06-07 14:49:36 +00:00
|
|
|
android.uploadToPlayStore(); break;
|
2018-08-27 15:32:54 +00:00
|
|
|
case 'nightly':
|
2019-06-07 14:49:36 +00:00
|
|
|
env.DIAWI_URL = android.uploadToDiawi(); break;
|
2018-08-27 15:32:54 +00:00
|
|
|
case 'e2e':
|
2019-06-07 14:49:36 +00:00
|
|
|
env.SAUCE_URL = 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') {
|
2019-06-04 16:50:29 +00:00
|
|
|
steps { sh 'make clean' }
|
2018-12-13 09:49:16 +00:00
|
|
|
}
|
2018-12-11 14:27:21 +00:00
|
|
|
}
|
|
|
|
post {
|
2019-06-07 14:49:36 +00:00
|
|
|
success { script { load('ci/github.groovy').notifyPR(true) } }
|
|
|
|
failure { script { load('ci/github.groovy').notifyPR(false) } }
|
2019-06-04 16:50:29 +00:00
|
|
|
always { sh 'make _fix-perms' }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|