pipeline { agent { label 'linux' } options { /* Prevent Jenkins jobs from running forever */ timeout(time: 25, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( numToKeepStr: '90', daysToKeepStr: '30', artifactNumToKeepStr: '90', )) } environment { BUILD_PLATFORM = 'android' LANG = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8' LC_ALL = 'en_US.UTF-8' FASTLANE_DISABLE_COLORS = 1 REALM_DISABLE_ANALYTICS = 1 BUNDLE_PATH = "${HOME}/.bundle" 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' } stages { stage('Prep') { steps { script { print "Running ${params.BUILD_TYPE} build!" /* Necessary to load methods */ mobile = load 'ci/mobile.groovy' cmn = load 'ci/common.groovy' mobile.prep(cmn.getBuildType()) } } } stage('Lint') { steps { script { cmn.runLint() } } } stage('Tests') { steps { script { cmn.runTests() } } } stage('Build') { steps { script { mobile.leinBuild('android') } } } stage('Compile') { steps { script { apk = mobile.android.compile(cmn.getBuildType()) } } } stage('Archive') { steps { script { archiveArtifacts apk } } } stage('Upload') { steps { script { switch (cmn.getBuildType()) { case 'release': mobile.android.uploadToPlayStore(); break; case 'nightly': env.DIAWI_URL = mobile.android.uploadToDiawi(); break; case 'e2e': env.SAUCE_URL = mobile.android.uploadToSauceLabs() } } } } } }