2018-04-14 14:38:26 +00:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
2018-04-14 14:49:11 +00:00
|
|
|
// The stages we run one by one
|
|
|
|
// Please don't add more than 2 items in a single stage; this hurts performance
|
|
|
|
def ci_stages = [
|
|
|
|
"Checkers": [
|
|
|
|
"commit-checker": "openttd/compile-farm-ci:commit-checker",
|
|
|
|
],
|
|
|
|
"Compilers": [
|
|
|
|
"linux-amd64-gcc-6": "openttd/compile-farm-ci:linux-amd64-gcc-6",
|
|
|
|
"linux-amd64-clang-3.8": "openttd/compile-farm-ci:linux-amd64-clang-3.8",
|
|
|
|
],
|
|
|
|
"Archs": [
|
|
|
|
"linux-i386-gcc-6": "openttd/compile-farm-ci:linux-i386-gcc-6",
|
|
|
|
],
|
2018-04-21 13:10:06 +00:00
|
|
|
"OS": [
|
|
|
|
"osx-10.9": "openttd/compile-farm-ci:osx-10.9",
|
|
|
|
],
|
2018-04-08 15:39:45 +00:00
|
|
|
]
|
|
|
|
|
2018-04-14 14:49:11 +00:00
|
|
|
def generateStage(targets) {
|
|
|
|
return targets.collectEntries{ key, target ->
|
|
|
|
["${key}": generateCI(key, target)]
|
|
|
|
}
|
2018-03-24 16:58:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def generateCI(display_name, image_name) {
|
|
|
|
return {
|
2018-04-14 14:00:25 +00:00
|
|
|
githubNotify context: 'openttd/' + display_name, description: 'This commit is being built', status: 'PENDING'
|
2018-04-08 15:39:45 +00:00
|
|
|
|
2018-04-14 14:00:25 +00:00
|
|
|
try {
|
|
|
|
dir("${display_name}") {
|
|
|
|
unstash "source"
|
|
|
|
|
2018-04-21 13:15:02 +00:00
|
|
|
docker.image("${image_name}").pull()
|
2018-04-14 14:49:11 +00:00
|
|
|
docker.image("${image_name}").withRun("--volumes-from ${hostname} --workdir " + pwd()) { c ->
|
2018-04-21 13:15:30 +00:00
|
|
|
sh "docker logs --follow ${c.id}; exit `docker wait ${c.id}`"
|
2018-04-14 14:00:25 +00:00
|
|
|
}
|
2018-03-24 16:58:40 +00:00
|
|
|
}
|
2018-04-14 14:00:25 +00:00
|
|
|
|
|
|
|
githubNotify context: 'openttd/' + display_name, description: 'The commit looks good', status: 'SUCCESS'
|
|
|
|
}
|
|
|
|
catch (error) {
|
|
|
|
githubNotify context: 'openttd/' + display_name, description: 'The commit cannot be built', status: 'FAILURE'
|
|
|
|
throw error
|
2018-03-24 16:58:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
node {
|
2018-04-14 14:38:48 +00:00
|
|
|
ansiColor('xterm') {
|
|
|
|
stage("Checkout") {
|
|
|
|
checkout scm
|
2018-04-08 15:39:45 +00:00
|
|
|
|
2018-04-15 20:22:32 +00:00
|
|
|
// Ensure user.email and user.name is set, otherwise rebase cannot work
|
|
|
|
sh "git config user.email 'info@openttd.org'"
|
|
|
|
sh "git config user.name 'OpenTTD CI'"
|
|
|
|
|
2018-04-14 14:38:48 +00:00
|
|
|
// Ensure we also have origin/master available
|
|
|
|
sh "git fetch --no-tags origin master:refs/remotes/origin/master"
|
2018-04-08 15:39:45 +00:00
|
|
|
|
2018-04-14 20:14:10 +00:00
|
|
|
// Try to rebase to origin/master; if this fails, fail the CI
|
|
|
|
sh "git rebase origin/master"
|
|
|
|
|
2018-04-14 14:38:48 +00:00
|
|
|
stash name: "source", useDefaultExcludes: false
|
|
|
|
}
|
2018-03-24 16:58:40 +00:00
|
|
|
|
2018-04-14 14:49:11 +00:00
|
|
|
ci_stages.each { ci_stage ->
|
|
|
|
stage(ci_stage.key) {
|
|
|
|
parallel generateStage(ci_stage.value)
|
|
|
|
}
|
2018-04-14 14:38:48 +00:00
|
|
|
}
|
2018-03-24 16:58:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|