Switch to Jenkinsfile for jenkins job configuration (#108)

* Switch to Jenkinsfile for jenkins job configuration

* exclude Jenkinsfile from the package

* add freebsd and separate scm checkout stage

* try to add some color

* prettier ansicolor wrapper + a build timeout

* try a thing

* what is going on

* this should be dumb and wrong

* how 'bout this

* this should work
This commit is contained in:
Paul Kehrer 2017-04-28 11:34:27 -05:00 committed by Alex Gaynor
parent a955ab7b62
commit 2c36d3a096
2 changed files with 65 additions and 1 deletions

64
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,64 @@
def configs = [
[
label: 'windows',
toxenvs: ['py26', 'py27', 'py33', 'py34', 'py35', 'py36'],
],
[
label: 'windows64',
toxenvs: ['py26', 'py27', 'py33', 'py34', 'py35', 'py36'],
],
[
label: 'freebsd11',
toxenvs: ['py27'],
],
]
def build(label, toxenv) {
try {
timeout(time: 5, unit: 'MINUTES') {
if (label.startsWith("windows")) {
bat """
@set PATH="C:\\Python27";"C:\\Python27\\Scripts";%PATH%
tox -r -e $toxenv
"""
} else {
ansiColor('xterm') {
sh "tox -r -e $toxenv -- --color=yes"
}
}
}
} catch (e) {
currentBuild.result = 'FAILURE'
throw e
} finally {
deleteDir()
}
}
def builders = [:]
for (config in configs) {
def label = config["label"]
def toxenvs = config["toxenvs"]
// We need to use a temporary variable here and then
// bind it in the for loop so that it is properly captured
// by the closure
for (_toxenv in toxenvs) {
def toxenv = _toxenv
def combinedName = "${label}-${toxenv}"
builders[combinedName] = {
node(label) {
stage("Checkout") {
checkout scm
}
stage(combinedName) {
build(label, toxenv)
}
}
}
}
}
parallel builders

View File

@ -6,7 +6,7 @@ include src/build_bcrypt.py
recursive-include src/_csrc *
recursive-include tests *.py
exclude requirements.txt tasks.py .travis.yml wheel-scripts
exclude requirements.txt tasks.py .travis.yml wheel-scripts Jenkinsfile
recursive-exclude wheel-scripts *