2018-12-11 14:27:21 +00:00
|
|
|
cmn = load 'ci/common.groovy'
|
2018-08-21 15:17:25 +00:00
|
|
|
ios = load 'ci/ios.groovy'
|
|
|
|
android = load 'ci/android.groovy'
|
|
|
|
|
2018-08-30 02:23:26 +00:00
|
|
|
def wait(lockFile) {
|
|
|
|
/* Crude wait for a lock file to disappear */
|
|
|
|
def maxAttempts = 20
|
|
|
|
def success = false
|
|
|
|
for (i = 0; i <= maxAttempts; i++) {
|
|
|
|
rval = fileExists(lockFile)
|
|
|
|
if (!rval) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
sleep 10
|
|
|
|
}
|
|
|
|
error("Failed to acquire lock: ${lockFile}")
|
2018-08-29 20:29:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def podUpdate() {
|
|
|
|
/**
|
|
|
|
* This is awful BUT multiple jobs running on the same host can
|
|
|
|
* clash when trying to update the CocoaPods maste repo.
|
|
|
|
* We could set CP_REPOS_DIR, but the would result in
|
|
|
|
* multiple ~3GB directories all over the place and would be slow.
|
|
|
|
**/
|
2018-08-30 02:23:26 +00:00
|
|
|
def lockFile = "${env.HOME}/.cocoapods.lock"
|
|
|
|
try {
|
|
|
|
wait(lockFile)
|
|
|
|
sh "touch ${lockFile}"
|
2018-11-19 17:37:04 +00:00
|
|
|
sh 'pod update --silent --no-ansi'
|
2018-08-30 02:23:26 +00:00
|
|
|
} finally {
|
2018-12-10 12:09:11 +00:00
|
|
|
sh "rm -f ${lockFile}"
|
2018-08-29 20:29:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 12:56:19 +00:00
|
|
|
def prep(type = 'nightly') {
|
2018-12-11 14:27:21 +00:00
|
|
|
cmn.doGitRebase()
|
2018-08-30 12:56:45 +00:00
|
|
|
/* ensure that we start from a known state */
|
2018-12-13 09:49:16 +00:00
|
|
|
cmn.clean()
|
2019-01-17 17:24:44 +00:00
|
|
|
/* Run at start to void mismatched numbers */
|
|
|
|
cmn.genBuildNumber()
|
2018-08-21 15:17:25 +00:00
|
|
|
/* select type of build */
|
|
|
|
switch (type) {
|
2018-08-22 19:20:47 +00:00
|
|
|
case 'nightly':
|
2018-08-21 15:17:25 +00:00
|
|
|
sh 'cp .env.nightly .env'; break
|
|
|
|
case 'release':
|
|
|
|
sh 'cp .env.prod .env'; break
|
|
|
|
case 'e2e':
|
|
|
|
sh 'cp .env.e2e .env'; break
|
2018-08-29 18:39:35 +00:00
|
|
|
default:
|
|
|
|
sh 'cp .env.jenkins .env'; break
|
2018-08-21 15:17:25 +00:00
|
|
|
}
|
2018-09-01 02:36:51 +00:00
|
|
|
/* install ruby dependencies */
|
|
|
|
sh 'bundle install --quiet'
|
2018-12-09 14:58:03 +00:00
|
|
|
/* node deps and status-go download */
|
2018-09-18 12:22:30 +00:00
|
|
|
sh "make prepare-${env.BUILD_PLATFORM}"
|
2018-08-14 18:09:52 +00:00
|
|
|
/* generate ios/StatusIm.xcworkspace */
|
2018-12-12 13:57:28 +00:00
|
|
|
if (env.BUILD_PLATFORM == 'ios') {
|
|
|
|
dir('ios') {
|
2019-01-21 15:13:57 +00:00
|
|
|
try {
|
|
|
|
sh 'pod install --silent'
|
|
|
|
} catch (Exception ex) {
|
|
|
|
println "pod installation failed, trying to upgrade the repo"
|
|
|
|
/* only if pod install fails, we try to upgrade the repo */
|
|
|
|
podUpdate()
|
|
|
|
sh 'pod install --silent'
|
|
|
|
}
|
2018-12-11 14:27:21 +00:00
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-29 12:38:12 +00:00
|
|
|
def leinBuild(platform) {
|
|
|
|
sh "lein prod-build-${platform}"
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return this
|