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-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
|
|
|
}
|
|
|
|
|
2019-04-11 11:29:37 +00:00
|
|
|
def bundle() {
|
|
|
|
def btype = utils.getBuildType()
|
2018-11-19 17:37:04 +00:00
|
|
|
def target
|
2019-04-11 11:29:37 +00:00
|
|
|
switch (btype) {
|
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-11-29 10:20:08 +00:00
|
|
|
nix.shell(plutil('CFBundleShortVersionString', utils.getVersion()), attr: 'shells.ios')
|
|
|
|
nix.shell(plutil('CFBundleVersion', utils.genBuildNumber()), attr: 'shells.ios')
|
|
|
|
nix.shell(plutil('CFBundleBuildUrl', currentBuild.absoluteUrl), attr: 'shells.ios')
|
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-05-10 15:33:54 +00:00
|
|
|
nix.shell(
|
|
|
|
"bundle exec --gemfile=fastlane/Gemfile fastlane ios ${target}",
|
|
|
|
keep: [
|
|
|
|
'FASTLANE_DISABLE_COLORS',
|
|
|
|
'FASTLANE_PASSWORD', 'KEYCHAIN_PASSWORD',
|
|
|
|
'MATCH_PASSWORD', 'FASTLANE_APPLE_ID',
|
2019-11-29 10:20:08 +00:00
|
|
|
],
|
|
|
|
attr: 'shells.ios'
|
2019-05-10 15:33:54 +00:00
|
|
|
)
|
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-04-11 11:29:37 +00:00
|
|
|
if (btype == '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}"
|
2019-04-11 11:29:37 +00:00
|
|
|
} else if (btype == '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}"
|
2019-04-11 11:29:37 +00:00
|
|
|
} else if (btype != 'testflight') {
|
|
|
|
pkg = utils.pkgFilename(btype, '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-05-10 15:33:54 +00:00
|
|
|
nix.shell(
|
|
|
|
'bundle exec --gemfile=fastlane/Gemfile fastlane ios upload_diawi',
|
2019-11-29 10:20:08 +00:00
|
|
|
keep: ['FASTLANE_DISABLE_COLORS', 'DIAWI_TOKEN'],
|
|
|
|
attr: 'shells.fastlane'
|
2019-05-10 15:33:54 +00:00
|
|
|
)
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
|
|
|
diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out"
|
2019-09-03 14:48:11 +00:00
|
|
|
/* Save the URL in the build description */
|
|
|
|
currentBuild.description = "<a href=\"${diawiUrl}\">Diawi Link</a>"
|
2018-08-21 15:17:25 +00:00
|
|
|
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([
|
2019-07-01 15:39:16 +00:00
|
|
|
usernamePassword(
|
|
|
|
credentialsId: 'sauce-labs-api',
|
|
|
|
usernameVariable: 'SAUCE_USERNAME',
|
|
|
|
passwordVariable: 'SAUCE_ACCESS_KEY'
|
|
|
|
),
|
2018-11-19 17:37:04 +00:00
|
|
|
]) {
|
2019-05-10 15:33:54 +00:00
|
|
|
nix.shell(
|
|
|
|
'bundle exec --gemfile=fastlane/Gemfile fastlane ios saucelabs',
|
2019-11-29 10:20:08 +00:00
|
|
|
keep: ['FASTLANE_DISABLE_COLORS', 'SAUCE_ACCESS_KEY', 'SAUCE_USERNAME'],
|
|
|
|
attr: 'shells.fastlane'
|
2019-05-10 15:33:54 +00:00
|
|
|
)
|
2018-11-19 17:37:04 +00:00
|
|
|
}
|
|
|
|
return env.SAUCE_LABS_NAME
|
|
|
|
}
|
|
|
|
|
2018-08-21 15:17:25 +00:00
|
|
|
return this
|