2019-05-10 15:33:54 +00:00
|
|
|
nix = load 'ci/nix.groovy'
|
2019-02-05 09:35:14 +00:00
|
|
|
utils = load 'ci/utils.groovy'
|
2018-08-21 15:17:25 +00:00
|
|
|
|
2019-04-11 11:29:37 +00:00
|
|
|
def bundle() {
|
|
|
|
def btype = utils.getBuildType()
|
2018-11-27 10:15:33 +00:00
|
|
|
/* Disable Gradle Daemon https://stackoverflow.com/questions/38710327/jenkins-builds-fail-using-the-gradle-daemon */
|
2018-11-21 07:02:53 +00:00
|
|
|
def gradleOpt = "-PbuildUrl='${currentBuild.absoluteUrl}' -Dorg.gradle.daemon=false "
|
2019-02-11 21:24:36 +00:00
|
|
|
def target = "release"
|
2019-05-31 18:39:53 +00:00
|
|
|
/* we don't need x86 for any builds except e2e */
|
|
|
|
env.NDK_ABI_FILTERS="armeabi-v7a;arm64-v8a"
|
2019-02-11 21:24:36 +00:00
|
|
|
|
2019-05-31 18:39:53 +00:00
|
|
|
switch (btype) {
|
|
|
|
case 'pr': /* PR builds shouldn't replace normal releases */
|
|
|
|
target = 'pr'; break;
|
|
|
|
case 'e2e':
|
|
|
|
target = 'pr';
|
|
|
|
env.NDK_ABI_FILTERS="x86"; break
|
|
|
|
case 'release':
|
2019-06-14 15:06:38 +00:00
|
|
|
gradleOpt += "-PreleaseVersion='${utils.getVersion()}'"
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
2019-05-31 18:39:53 +00:00
|
|
|
|
2018-08-21 15:17:25 +00:00
|
|
|
dir('android') {
|
2018-12-09 14:58:03 +00:00
|
|
|
withCredentials([
|
|
|
|
string(
|
|
|
|
credentialsId: 'android-keystore-pass',
|
|
|
|
variable: 'STATUS_RELEASE_STORE_PASSWORD'
|
|
|
|
),
|
|
|
|
usernamePassword(
|
|
|
|
credentialsId: 'android-keystore-key-pass',
|
|
|
|
usernameVariable: 'STATUS_RELEASE_KEY_ALIAS',
|
|
|
|
passwordVariable: 'STATUS_RELEASE_KEY_PASSWORD'
|
|
|
|
)
|
|
|
|
]) {
|
2019-05-10 15:33:54 +00:00
|
|
|
nix.shell(
|
|
|
|
"./gradlew assemble${target.capitalize()} ${gradleOpt}",
|
|
|
|
keep: [
|
2019-05-31 18:39:53 +00:00
|
|
|
'REALM_DISABLE_ANALYTICS', 'NDK_ABI_FILTERS',
|
2019-05-10 15:33:54 +00:00
|
|
|
'STATUS_RELEASE_STORE_FILE', 'STATUS_RELEASE_STORE_PASSWORD',
|
|
|
|
'STATUS_RELEASE_KEY_ALIAS', 'STATUS_RELEASE_KEY_PASSWORD'
|
|
|
|
]
|
|
|
|
)
|
2018-12-09 14:58:03 +00:00
|
|
|
}
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
2019-02-11 21:24:36 +00:00
|
|
|
sh 'find android/app/build/outputs/apk'
|
|
|
|
def outApk = "android/app/build/outputs/apk/${target}/app-${target}.apk"
|
2019-04-11 11:29:37 +00:00
|
|
|
def pkg = utils.pkgFilename(btype, 'apk')
|
2019-02-11 21:24:36 +00:00
|
|
|
/* rename for upload */
|
|
|
|
sh "cp ${outApk} ${pkg}"
|
|
|
|
/* necessary for Fastlane */
|
|
|
|
env.APK_PATH = pkg
|
2018-08-21 15:17:25 +00:00
|
|
|
return pkg
|
|
|
|
}
|
|
|
|
|
2018-09-21 11:57:06 +00:00
|
|
|
def uploadToPlayStore(type = 'nightly') {
|
2018-08-21 15:17:25 +00:00
|
|
|
withCredentials([
|
|
|
|
string(credentialsId: "SUPPLY_JSON_KEY_DATA", variable: 'GOOGLE_PLAY_JSON_KEY'),
|
|
|
|
]) {
|
2019-05-10 15:33:54 +00:00
|
|
|
nix.shell(
|
|
|
|
"fastlane android ${type}",
|
|
|
|
keep: ['FASTLANE_DISABLE_COLORS', 'GOOGLE_PLAY_JSON_KEY']
|
|
|
|
)
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def uploadToSauceLabs() {
|
2019-02-05 09:35:14 +00:00
|
|
|
def changeId = utils.changeId()
|
2018-08-30 10:46:37 +00:00
|
|
|
if (changeId != null) {
|
2018-11-19 17:37:04 +00:00
|
|
|
env.SAUCE_LABS_NAME = "${changeId}.apk"
|
2018-08-30 10:46:37 +00:00
|
|
|
} else {
|
2019-02-05 09:35:14 +00:00
|
|
|
def pkg = utils.pkgFilename(utils.getBuildType(), 'apk')
|
2019-01-15 14:53:05 +00:00
|
|
|
env.SAUCE_LABS_NAME = "${pkg}"
|
2018-08-30 10:46:37 +00:00
|
|
|
}
|
2018-08-21 15:17:25 +00:00
|
|
|
withCredentials([
|
2019-07-01 15:39:16 +00:00
|
|
|
usernamePassword(
|
|
|
|
credentialsId: 'sauce-labs-api',
|
|
|
|
usernameVariable: 'SAUCE_USERNAME',
|
|
|
|
passwordVariable: 'SAUCE_ACCESS_KEY'
|
|
|
|
),
|
2018-08-21 15:17:25 +00:00
|
|
|
]) {
|
2019-05-10 15:33:54 +00:00
|
|
|
nix.shell(
|
|
|
|
'fastlane android saucelabs',
|
|
|
|
keep: [
|
|
|
|
'FASTLANE_DISABLE_COLORS', 'APK_PATH',
|
|
|
|
'SAUCE_ACCESS_KEY', 'SAUCE_USERNAME', 'SAUCE_LABS_NAME'
|
|
|
|
]
|
|
|
|
)
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
2018-11-19 17:37:04 +00:00
|
|
|
return env.SAUCE_LABS_NAME
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def uploadToDiawi() {
|
|
|
|
withCredentials([
|
2018-08-27 15:32:54 +00:00
|
|
|
string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'),
|
2018-08-21 15:17:25 +00:00
|
|
|
]) {
|
2019-05-10 15:33:54 +00:00
|
|
|
nix.shell(
|
|
|
|
'fastlane android upload_diawi',
|
|
|
|
keep: ['FASTLANE_DISABLE_COLORS', 'APK_PATH', 'DIAWI_TOKEN']
|
|
|
|
)
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
2018-08-27 15:32:54 +00:00
|
|
|
diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out"
|
|
|
|
return diawiUrl
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
|
|
|
|
2019-07-03 19:00:51 +00:00
|
|
|
def coverage() {
|
|
|
|
withCredentials([
|
|
|
|
string(credentialsId: 'coveralls-status-react-token', variable: 'COVERALLS_REPO_TOKEN'),
|
|
|
|
]) {
|
|
|
|
nix.shell(
|
|
|
|
'make coverage',
|
|
|
|
keep: ['COVERALLS_REPO_TOKEN', 'COVERALLS_SERVICE_NAME', 'COVERALLS_SERVICE_JOB_ID']
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-21 15:17:25 +00:00
|
|
|
return this
|