2019-02-05 09:35:14 +00:00
|
|
|
utils = load('ci/utils.groovy')
|
2018-08-23 12:56:19 +00:00
|
|
|
|
|
|
|
def plutil(name, value) {
|
2019-03-25 16:35:01 +00:00
|
|
|
return """
|
|
|
|
plutil -replace ${name} -string ${value} ios/StatusIm/Info.plist;
|
|
|
|
"""
|
2018-08-23 12:56:19 +00:00
|
|
|
}
|
|
|
|
|
2018-12-06 10:52:44 +00:00
|
|
|
def bundle(type) {
|
|
|
|
if (!type) {
|
2019-02-05 09:35:14 +00:00
|
|
|
type = utils.getBuildType()
|
2018-12-06 10:52:44 +00:00
|
|
|
}
|
2018-11-19 17:37:04 +00:00
|
|
|
def target
|
|
|
|
switch (type) {
|
2018-12-21 12:19:52 +00:00
|
|
|
case 'release': target = 'release'; break;
|
|
|
|
case 'testflight': target = 'release'; break;
|
|
|
|
case 'e2e': target = 'e2e'; break;
|
|
|
|
default: target = 'nightly';
|
2018-09-21 11:57:06 +00:00
|
|
|
}
|
2018-08-23 12:56:19 +00:00
|
|
|
/* configure build metadata */
|
2019-03-25 16:35:01 +00:00
|
|
|
utils.nix_sh(
|
|
|
|
plutil('CFBundleShortVersionString', utils.getVersion('mobile_files')) +
|
|
|
|
plutil('CFBundleVersion', utils.genBuildNumber()) +
|
|
|
|
plutil('CFBundleBuildUrl', currentBuild.absoluteUrl)
|
|
|
|
)
|
2018-11-19 17:37:04 +00:00
|
|
|
/* the dir might not exist */
|
|
|
|
sh 'mkdir -p status-e2e'
|
2018-08-23 12:56:19 +00:00
|
|
|
/* build the actual app */
|
2018-08-21 15:17:25 +00:00
|
|
|
withCredentials([
|
|
|
|
string(credentialsId: "slave-pass-${env.NODE_NAME}", variable: 'KEYCHAIN_PASSWORD'),
|
2019-04-02 16:41:33 +00:00
|
|
|
string(credentialsId: 'fastlane-match-password', variable: 'MATCH_PASSWORD'),
|
|
|
|
usernamePassword(
|
|
|
|
credentialsId: 'fastlane-match-apple-id',
|
|
|
|
usernameVariable: 'FASTLANE_APPLE_ID',
|
|
|
|
passwordVariable: 'FASTLANE_PASSWORD'
|
|
|
|
),
|
2018-08-21 15:17:25 +00:00
|
|
|
]) {
|
2019-03-26 09:01:07 +00:00
|
|
|
utils.nix_sh "bundle exec fastlane ios ${target}"
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
2018-11-19 17:37:04 +00:00
|
|
|
/* rename built file for uploads and archivization */
|
|
|
|
def pkg = ''
|
2019-01-09 15:17:45 +00:00
|
|
|
if (type == 'release') {
|
2019-02-05 09:35:14 +00:00
|
|
|
pkg = utils.pkgFilename('release', 'ipa')
|
2019-01-09 15:17:45 +00:00
|
|
|
sh "cp status_appstore/StatusIm.ipa ${pkg}"
|
|
|
|
} else if (type == 'e2e') {
|
2019-02-05 09:35:14 +00:00
|
|
|
pkg = utils.pkgFilename('e2e', 'app.zip')
|
2018-11-19 17:37:04 +00:00
|
|
|
sh "cp status-e2e/StatusIm.app.zip ${pkg}"
|
|
|
|
} else if (type != 'testflight') {
|
2019-02-05 09:35:14 +00:00
|
|
|
pkg = utils.pkgFilename(type, 'ipa')
|
2018-11-19 17:37:04 +00:00
|
|
|
sh "cp status-adhoc/StatusIm.ipa ${pkg}"
|
2018-09-21 11:57:06 +00:00
|
|
|
}
|
2019-03-06 17:29:32 +00:00
|
|
|
/* necessary for Diawi upload */
|
|
|
|
env.DIAWI_IPA = pkg
|
2018-11-19 17:37:04 +00:00
|
|
|
return pkg
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def uploadToDiawi() {
|
|
|
|
withCredentials([
|
|
|
|
string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'),
|
|
|
|
]) {
|
2019-02-28 10:56:58 +00:00
|
|
|
utils.nix_sh 'bundle exec fastlane ios upload_diawi'
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
|
|
|
diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out"
|
|
|
|
return diawiUrl
|
|
|
|
}
|
|
|
|
|
2018-11-19 17:37:04 +00:00
|
|
|
def uploadToSauceLabs() {
|
2019-02-05 09:35:14 +00:00
|
|
|
def changeId = utils.getParentRunEnv('CHANGE_ID')
|
2018-11-19 17:37:04 +00:00
|
|
|
if (changeId != null) {
|
|
|
|
env.SAUCE_LABS_NAME = "${changeId}.app.zip"
|
|
|
|
} else {
|
2019-02-05 09:35:14 +00:00
|
|
|
env.SAUCE_LABS_NAME = "im.status.ethereum-e2e-${utils.gitCommit()}.app.zip"
|
2018-11-19 17:37:04 +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 ios saucelabs'
|
2018-11-19 17:37:04 +00:00
|
|
|
}
|
|
|
|
return env.SAUCE_LABS_NAME
|
|
|
|
}
|
|
|
|
|
2018-08-21 15:17:25 +00:00
|
|
|
return this
|