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-04-11 10:40:36 +00:00
|
|
|
if (params.BUILD_TYPE == 'pr') {
|
2019-02-11 21:24:36 +00:00
|
|
|
/* PR builds shouldn't replace normal releases */
|
|
|
|
target = 'pr'
|
2019-04-11 11:29:37 +00:00
|
|
|
} else if (btype == 'release') {
|
2019-02-05 09:35:14 +00:00
|
|
|
gradleOpt += "-PreleaseVersion='${utils.getVersion('mobile_files')}'"
|
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-02-11 21:24:36 +00:00
|
|
|
utils.nix_sh "./gradlew assemble${target.capitalize()} ${gradleOpt}"
|
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
|
2019-03-06 17:29:32 +00:00
|
|
|
env.DIAWI_APK = 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-04-03 20:12:31 +00:00
|
|
|
utils.nix_fastlane_sh "android ${type}"
|
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([
|
|
|
|
string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'),
|
|
|
|
string(credentialsId: 'SAUCE_USERNAME', variable: 'SAUCE_USERNAME'),
|
|
|
|
]) {
|
2019-04-03 20:12:31 +00:00
|
|
|
utils.nix_fastlane_sh 'android saucelabs'
|
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() {
|
2018-11-19 17:37:04 +00:00
|
|
|
env.SAUCE_LABS_NAME = "im.status.ethereum-e2e-${GIT_COMMIT.take(6)}.apk"
|
2018-08-21 15:17:25 +00:00
|
|
|
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-04-03 20:12:31 +00:00
|
|
|
utils.nix_fastlane_sh 'android upload_diawi'
|
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
|
|
|
}
|
|
|
|
|
|
|
|
return this
|