2017-09-15 16:14:36 +00:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
@NonCPS
|
2017-09-21 18:38:25 +00:00
|
|
|
def getVersion(branch, sha, buildNumber) {
|
|
|
|
version = branch.replaceAll(/\//, '-')
|
|
|
|
|
2017-09-15 16:14:36 +00:00
|
|
|
if (sha?.trim()) {
|
2017-09-21 18:38:25 +00:00
|
|
|
version = version + '-' + sha
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buildNumber?.trim()) {
|
|
|
|
version = version + '-' + buildNumber
|
2017-09-15 16:14:36 +00:00
|
|
|
}
|
|
|
|
|
2017-09-21 18:38:25 +00:00
|
|
|
return version
|
2017-09-15 16:14:36 +00:00
|
|
|
}
|
|
|
|
|
2017-09-18 16:40:16 +00:00
|
|
|
node('linux') {
|
2017-09-15 16:14:36 +00:00
|
|
|
checkout scm
|
|
|
|
|
|
|
|
def remoteOriginRegex = ~/^remotes\/origin\//
|
|
|
|
|
|
|
|
gitSHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
|
|
|
|
gitShortSHA = gitSHA.take(7)
|
|
|
|
gitBranch = sh(returnStdout: true, script: 'git name-rev --name-only HEAD').trim() - remoteOriginRegex
|
|
|
|
|
|
|
|
stage('Debug') {
|
|
|
|
sh 'env'
|
|
|
|
println(gitBranch)
|
|
|
|
println(gitSHA)
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(adam): enable when unit tests start passing
|
|
|
|
// stage('Test') {
|
|
|
|
// sh 'make ci'
|
|
|
|
// }
|
|
|
|
|
|
|
|
stage('Build') {
|
2017-09-21 18:38:25 +00:00
|
|
|
sh 'go get github.com/karalabe/xgo'
|
|
|
|
|
2017-09-15 16:14:36 +00:00
|
|
|
parallel (
|
|
|
|
'statusgo-android': {
|
|
|
|
sh 'make statusgo-android'
|
|
|
|
},
|
|
|
|
'statusgo-ios-simulator': {
|
|
|
|
sh '''
|
|
|
|
make statusgo-ios-simulator
|
|
|
|
cd build/bin/statusgo-ios-9.3-framework/
|
|
|
|
zip -r status-go-ios.zip Statusgo.framework
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Deploy') {
|
|
|
|
// For branch builds, replace the old artifact. For develop keep all of them.
|
2017-09-21 18:38:25 +00:00
|
|
|
def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA, '') : getVersion(gitBranch, gitShortSHA, env.BUILD_ID)
|
2017-09-15 16:14:36 +00:00
|
|
|
def server = Artifactory.server 'artifactory'
|
|
|
|
def uploadSpec = """{
|
|
|
|
"files": [
|
|
|
|
{
|
|
|
|
"pattern": "build/bin/statusgo-android-16.aar",
|
|
|
|
"target": "libs-release-local/status-im/status-go/${version}/status-go-${version}.aar"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pattern": "build/bin/statusgo-ios-9.3-framework/status-go-ios.zip",
|
|
|
|
"target": "libs-release-local/status-im/status-go-ios-simulator/${version}/status-go-ios-simulator-${version}.zip"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}"""
|
|
|
|
|
|
|
|
def buildInfo = Artifactory.newBuildInfo()
|
|
|
|
buildInfo.env.capture = false
|
2017-09-21 18:38:25 +00:00
|
|
|
buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')'
|
2017-09-15 16:14:36 +00:00
|
|
|
server.upload(uploadSpec, buildInfo)
|
|
|
|
server.publishBuildInfo(buildInfo)
|
|
|
|
}
|
|
|
|
}
|