2019-02-05 09:35:14 +00:00
|
|
|
utils = load 'ci/utils.groovy'
|
2018-08-21 15:17:25 +00:00
|
|
|
|
2018-12-06 10:52:44 +00:00
|
|
|
def bundle(type = 'nightly') {
|
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"
|
|
|
|
|
|
|
|
if (type in ['pr', 'e2e']) {
|
|
|
|
/* PR builds shouldn't replace normal releases */
|
|
|
|
target = 'pr'
|
|
|
|
} else if (type == '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-02-05 09:35:14 +00:00
|
|
|
def pkg = utils.pkgFilename(type, '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-02-28 10:56:58 +00:00
|
|
|
utils.nix_sh "bundle exec fastlane 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-02-28 10:56:58 +00:00
|
|
|
utils.nix_sh 'bundle exec fastlane 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-02-28 10:56:58 +00:00
|
|
|
utils.nix_sh 'bundle exec fastlane 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
|