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 */
|
2019-06-04 16:50:29 +00:00
|
|
|
def gradleOpt = "-PbuildUrl='${currentBuild.absoluteUrl}' --console plain "
|
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 'e2e':
|
|
|
|
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
|
|
|
|
2019-06-04 16:50:29 +00:00
|
|
|
// The Nix script cannot access the user home directory, so best to copy the file to the Nix store and pass that to the Nix script
|
2019-08-26 16:56:55 +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'
|
|
|
|
)
|
|
|
|
]) {
|
|
|
|
nix.build(
|
|
|
|
args: [
|
|
|
|
'gradle-opts': gradleOpt,
|
|
|
|
'build-number': utils.readBuildNumber(),
|
|
|
|
'build-type': btype
|
|
|
|
],
|
|
|
|
safeEnv: [
|
|
|
|
'STATUS_RELEASE_KEY_ALIAS',
|
|
|
|
'STATUS_RELEASE_STORE_PASSWORD',
|
|
|
|
'STATUS_RELEASE_KEY_PASSWORD'
|
|
|
|
],
|
|
|
|
keep: [
|
|
|
|
'REALM_DISABLE_ANALYTICS', 'NDK_ABI_FILTERS',
|
|
|
|
'STATUS_RELEASE_STORE_FILE'
|
|
|
|
],
|
|
|
|
sbox: [
|
|
|
|
env.STATUS_RELEASE_STORE_FILE
|
|
|
|
],
|
|
|
|
attr: 'targets.mobile.android.release',
|
|
|
|
link: false
|
|
|
|
)
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
2019-07-15 16:34:33 +00:00
|
|
|
/* because nix-build was run in `android` dir that's where `result` is */
|
2019-08-26 16:56:55 +00:00
|
|
|
def outApk = "result/app.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}",
|
2019-06-04 16:50:29 +00:00
|
|
|
attr: 'targets.mobile.fastlane.shell',
|
2019-05-10 15:33:54 +00:00
|
|
|
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',
|
2019-06-04 16:50:29 +00:00
|
|
|
attr: 'targets.mobile.fastlane.shell',
|
2019-05-10 15:33:54 +00:00
|
|
|
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',
|
2019-06-04 16:50:29 +00:00
|
|
|
attr: 'targets.mobile.fastlane.shell',
|
2019-05-10 15:33:54 +00:00
|
|
|
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
|