2017-03-24 15:27:09 +00:00
|
|
|
def macos_versions = ["sierra", "el_capitan", "yosemite"]
|
|
|
|
|
|
|
|
def cleanup() {
|
|
|
|
sh 'rm -f *.bottle*.*'
|
|
|
|
}
|
|
|
|
|
|
|
|
def checkout() {
|
|
|
|
brew_bin = "/usr/local/bin"
|
|
|
|
brew_cellar = "/usr/local/Cellar"
|
|
|
|
brew_repo = "/usr/local/Homebrew"
|
|
|
|
brew_tap_repo = "${brew_repo}/Library/Taps/homebrew/homebrew-core"
|
2017-04-07 18:56:38 +00:00
|
|
|
brew_test_bot_repo = "${brew_repo}/Library/Taps/homebrew/homebrew-test-bot"
|
|
|
|
sh "mkdir -p ${brew_bin} ${brew_cellar} ${brew_tap_repo} ${brew_test_bot_repo}"
|
2017-03-24 15:27:09 +00:00
|
|
|
dir(brew_repo) {
|
|
|
|
git url: 'https://github.com/Homebrew/brew.git', changelog: false
|
|
|
|
}
|
2017-04-07 18:56:38 +00:00
|
|
|
dir(brew_test_bot_repo) {
|
|
|
|
git url: 'https://github.com/Homebrew/homebrew-test-bot.git', changelog: false
|
|
|
|
}
|
2017-03-24 15:27:09 +00:00
|
|
|
sh "ln -sf ${brew_repo}/bin/brew ${brew_bin}/brew"
|
|
|
|
dir(brew_tap_repo) {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def test_bot(args) {
|
2017-04-08 05:22:20 +00:00
|
|
|
timeout(time: 5, unit: 'HOURS') {
|
2017-03-24 15:27:09 +00:00
|
|
|
withEnv(["PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
|
|
|
|
'HOMEBREW_DEVELOPER=1']) {
|
2017-04-07 20:15:11 +00:00
|
|
|
sh "brew test-bot --tap=homebrew/core ${args}"
|
2017-03-24 15:27:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def test() {
|
2017-04-07 17:28:04 +00:00
|
|
|
test_bot("--ci-auto")
|
2017-03-24 15:27:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def archive(stash_name) {
|
|
|
|
def test_bot_junit = 'brew-test-bot.xml'
|
|
|
|
if (fileExists(test_bot_junit)) {
|
|
|
|
junit test_bot_junit
|
|
|
|
}
|
|
|
|
|
|
|
|
def bottle_glob = '*.bottle*.*'
|
|
|
|
if (findFiles(glob: bottle_glob).length >= 1) {
|
|
|
|
stash includes: bottle_glob, name: stash_name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def build(stash_name) {
|
|
|
|
cleanup()
|
|
|
|
checkout()
|
2017-04-07 20:15:11 +00:00
|
|
|
try {
|
|
|
|
test()
|
|
|
|
}
|
2017-04-07 20:45:34 +00:00
|
|
|
catch (err) {
|
|
|
|
currentBuild.result = "FAILURE"
|
|
|
|
}
|
2017-04-07 20:15:11 +00:00
|
|
|
finally {
|
|
|
|
archive(stash_name)
|
|
|
|
cleanup()
|
|
|
|
}
|
2017-03-24 15:27:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
stage("Build") {
|
|
|
|
// TODO: figure out how to use macos_versions here.
|
|
|
|
parallel (
|
|
|
|
sierra: { node("sierra") { build("sierra") }},
|
|
|
|
el_capitan: { node("el_capitan") { build("el_capitan") }},
|
|
|
|
yosemite: { node("yosemite") { build("yosemite") }},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2017-04-07 20:15:11 +00:00
|
|
|
stage("Upload") {
|
|
|
|
node("master") {
|
|
|
|
cleanup()
|
|
|
|
checkout()
|
2017-04-07 20:26:49 +00:00
|
|
|
|
2017-04-08 18:31:29 +00:00
|
|
|
stash_count = 0
|
2017-04-08 19:02:30 +00:00
|
|
|
for (version in macos_versions) {
|
|
|
|
try {
|
2017-03-24 15:27:09 +00:00
|
|
|
unstash version
|
2017-04-08 19:02:30 +00:00
|
|
|
stash_count += 1
|
|
|
|
}
|
|
|
|
catch (err) {
|
2017-03-24 15:27:09 +00:00
|
|
|
}
|
2017-04-08 18:39:02 +00:00
|
|
|
}
|
2017-04-07 20:26:49 +00:00
|
|
|
|
2017-04-08 18:31:29 +00:00
|
|
|
if (stash_count != 0) {
|
2017-04-08 18:11:22 +00:00
|
|
|
try {
|
|
|
|
withCredentials([[
|
|
|
|
$class: 'UsernamePasswordMultiBinding',
|
|
|
|
credentialsId: '5b6903a9-9f39-4c1b-9de6-ba0dd99c82a0',
|
|
|
|
passwordVariable: 'BINTRAY_KEY', usernameVariable: 'BINTRAY_USER']]) {
|
|
|
|
test_bot("--ci-upload")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
cleanup()
|
2017-04-07 20:26:49 +00:00
|
|
|
}
|
2017-04-08 16:47:18 +00:00
|
|
|
}
|
2017-03-24 15:27:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
// TODO: decide who to email and when
|
|
|
|
// mail to: '',
|
|
|
|
// from: 'Brew Test Bot <brewtestbot@icloud.com>',
|
|
|
|
// subject: "${env.JOB_NAME} ${env.BUILD_DISPLAY_NAME} failed!",
|
|
|
|
// body: "Build: ${env.BUILD_URL}\nConsole: ${env.BUILD_URL}console\nTests: ${env.BUILD_URL}testReport/"
|
|
|
|
throw err
|
|
|
|
}
|