ZeroTierOne/Jenkinsfile

85 lines
2.3 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env groovy
passedBuilds = []
def changelog = lastSuccessfulBuild(passedBuilds, currentBuild)
slackSend "Building ${env.JOB_NAME} #${env.BUILD_NUMBER} \n ${changelog}"
parallel 'centos7': {
node('centos7') {
2016-10-25 21:35:31 +00:00
try {
checkout scm
2016-10-25 21:35:31 +00:00
stage('Build Centos 7') {
sh 'make -f make-linux.mk'
}
}
catch (err) {
currentBuild.result = "FAILURE"
2016-10-25 21:38:57 +00:00
slackSend color: '#ff0000', message: "${env.JOB_NAME} broken on Centos 7 (<${env.BUILD_URL}|Open>)"
2016-10-25 21:35:31 +00:00
throw err
2016-10-25 18:18:26 +00:00
}
}
}, 'android-ndk': {
node('android-ndk') {
2016-10-25 21:35:31 +00:00
try {
checkout scm
2016-10-25 18:18:26 +00:00
2016-10-25 21:35:31 +00:00
stage('Build Android NDK') {
sh "/android/android-ndk-r13/ndk-build -C $WORKSPACE/java ZT1=${WORKSPACE}"
}
}
catch (err) {
currentBuild.result = "FAILURE"
2016-10-25 21:38:57 +00:00
slackSend color: '#ff0000', message: "${env.JOB_NAME} broken on Android NDK (<${env.BUILD_URL}|Open>)"
2016-10-25 21:35:31 +00:00
throw err
2016-10-25 18:18:26 +00:00
}
}
2016-10-25 19:40:03 +00:00
}, 'macOS': {
node('macOS') {
2016-10-25 21:35:31 +00:00
try {
checkout scm
stage('Build macOS') {
sh 'make -f make-mac.mk'
}
2016-10-25 19:40:03 +00:00
2016-10-25 21:35:31 +00:00
stage('Build macOS UI') {
sh 'cd macui && xcodebuild -target "ZeroTier One" -configuration Debug'
}
2016-10-25 19:40:03 +00:00
}
2016-10-25 21:35:31 +00:00
catch (err) {
currentBuild.result = "FAILURE"
2016-10-25 21:38:57 +00:00
slackSend color: '#ff0000', message: "${env.JOB_NAME} broken on macOS (<${env.BUILD_URL}|Open>)"
2016-10-25 21:35:31 +00:00
throw err
}
2016-10-25 19:40:03 +00:00
}
}
2016-10-25 21:35:31 +00:00
slackSend "${env.JOB_NAME} #${env.BUILD_NUMBER} Complete (<${env.BUILD_URL}|Show More...>)"
def lastSuccessfulBuild(passedBuilds, build) {
if ((build != null) && (build.result != 'SUCCESS')) {
passedBuilds.add(build)
lastSuccessfulBuild(passedBuilds, build.getPreviousBuild())
}
}
@NonCPS
def getChangeLog(passedBuilds) {
def log = ""
for (int x = 0; x < passedBuilds.size(); x++) {
def currentBuild = passedBuilds[x];
def changeLogSets = currentBuild.rawBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
log += "* ${entry.msg} by ${entry.author} \n"
}
}
}
return log;
}