2018-11-08 10:13:40 +00:00
|
|
|
import groovy.json.JsonBuilder
|
|
|
|
|
2019-05-10 15:33:54 +00:00
|
|
|
/* Libraries -----------------------------------------------------------------*/
|
|
|
|
|
2019-02-05 09:35:14 +00:00
|
|
|
gh = load 'ci/github.groovy'
|
|
|
|
ci = load 'ci/jenkins.groovy'
|
|
|
|
gh = load 'ci/github.groovy'
|
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'
|
|
|
|
ghcmgr = load 'ci/ghcmgr.groovy'
|
2018-12-13 13:22:36 +00:00
|
|
|
|
2019-02-05 09:35:14 +00:00
|
|
|
/* Small Helpers -------------------------------------------------------------*/
|
2018-12-11 14:27:21 +00:00
|
|
|
|
|
|
|
def pkgUrl(build) {
|
2019-02-05 09:35:14 +00:00
|
|
|
return utils.getEnv(build, 'PKG_URL')
|
2018-10-02 20:40:36 +00:00
|
|
|
}
|
|
|
|
|
2019-02-22 20:35:22 +00:00
|
|
|
def updateBucketJSON(urls, fileName) {
|
2018-12-11 14:27:21 +00:00
|
|
|
/* latest.json has slightly different key names */
|
2019-02-22 20:35:22 +00:00
|
|
|
def content = [
|
|
|
|
DIAWI: urls.Diawi,
|
2018-12-11 14:27:21 +00:00
|
|
|
APK: urls.Apk, IOS: urls.iOS,
|
|
|
|
APP: urls.App, MAC: urls.Mac,
|
|
|
|
WIN: urls.Win, SHA: urls.SHA
|
|
|
|
]
|
2019-02-22 20:35:22 +00:00
|
|
|
def filePath = "${pwd()}/pkg/${fileName}"
|
2018-11-08 10:13:40 +00:00
|
|
|
/* it might not exist */
|
|
|
|
sh 'mkdir -p pkg'
|
2019-02-22 20:35:22 +00:00
|
|
|
def contentJson = new JsonBuilder(content).toPrettyString()
|
|
|
|
println "${fileName}:\n${contentJson}"
|
|
|
|
new File(filePath).write(contentJson)
|
2019-02-05 09:35:14 +00:00
|
|
|
return utils.uploadArtifact(filePath)
|
2018-09-25 17:01:48 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 09:35:14 +00:00
|
|
|
def notifyPR(success) {
|
|
|
|
if (utils.changeId() == null) { return }
|
|
|
|
try {
|
|
|
|
ghcmgr.postBuild(success)
|
|
|
|
} catch (ex) { /* fallback to posting directly to GitHub */
|
|
|
|
println "Failed to use GHCMGR: ${ex}"
|
|
|
|
switch (success) {
|
2019-04-24 14:30:37 +00:00
|
|
|
case true: gh.notifyPRSuccess(); break
|
|
|
|
case false: gh.notifyPRFailure(); break
|
2019-02-05 09:35:14 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-13 09:49:16 +00:00
|
|
|
}
|
|
|
|
|
2019-03-22 13:24:58 +00:00
|
|
|
def prep(type = 'nightly') {
|
2019-04-11 11:29:37 +00:00
|
|
|
/* build/downloads all nix deps in advance */
|
2019-05-10 15:33:54 +00:00
|
|
|
nix.prepEnv()
|
2019-04-11 11:29:37 +00:00
|
|
|
/* rebase unless this is a release build */
|
2019-03-22 13:24:58 +00:00
|
|
|
utils.doGitRebase()
|
|
|
|
/* ensure that we start from a known state */
|
|
|
|
sh 'make clean'
|
2019-04-11 11:29:37 +00:00
|
|
|
/* pick right .env and update from params */
|
|
|
|
utils.updateEnv(type)
|
|
|
|
|
2019-04-12 14:38:08 +00:00
|
|
|
if (env.TARGET_OS == 'android' || env.TARGET_OS == 'ios') {
|
2019-03-22 13:24:58 +00:00
|
|
|
/* Run at start to void mismatched numbers */
|
|
|
|
utils.genBuildNumber()
|
2019-04-03 20:12:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (env.TARGET_OS == 'ios') {
|
2019-03-22 13:24:58 +00:00
|
|
|
/* install ruby dependencies */
|
2019-05-10 15:33:54 +00:00
|
|
|
nix.shell 'bundle install --gemfile=fastlane/Gemfile --quiet'
|
2019-03-22 13:24:58 +00:00
|
|
|
}
|
|
|
|
|
2019-04-12 14:38:08 +00:00
|
|
|
def prepareTarget=env.TARGET_OS
|
|
|
|
if (env.TARGET_OS == 'macos' || env.TARGET_OS == 'linux' || env.TARGET_OS == 'windows') {
|
2019-03-22 13:24:58 +00:00
|
|
|
prepareTarget='desktop'
|
|
|
|
}
|
|
|
|
/* node deps, pods, and status-go download */
|
2019-05-10 15:33:54 +00:00
|
|
|
utils.nix.shell("scripts/prepare-for-platform.sh ${prepareTarget}", pure: false)
|
2019-06-01 06:47:37 +00:00
|
|
|
sh("cp -R translations status-modules/translations && cp -R status-modules node_modules/status-modules")
|
2019-03-22 13:24:58 +00:00
|
|
|
}
|
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
return this
|