2018-05-12 15:56:17 +00:00
|
|
|
def pys = [
|
2019-07-14 10:58:05 +00:00
|
|
|
[name: 'Python 3.7', docker:'python:3.7-buster', tox:'py37,flake8', main: true],
|
|
|
|
[name: 'Python 3.6', docker:'python:3.6-buster', tox:'py36', main: false],
|
|
|
|
[name: 'Python 3.5', docker:'python:3.5-buster', tox:'py35', main: false],
|
|
|
|
[name: 'Python 2.7', docker:'python:2.7-buster', tox:'py27', main: false]
|
2018-05-12 15:56:17 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
properties([
|
|
|
|
durabilityHint('PERFORMANCE_OPTIMIZED'),
|
|
|
|
buildDiscarder(logRotator(numToKeepStr: '5')),
|
|
|
|
])
|
|
|
|
|
|
|
|
Map tasks = [failFast: true]
|
|
|
|
|
|
|
|
pys.each { py ->
|
|
|
|
tasks[py.name] = {
|
|
|
|
node {
|
|
|
|
def image
|
|
|
|
|
|
|
|
stage("Prepare docker $py.name") {
|
|
|
|
dir('dockerbuild') {
|
|
|
|
deleteDir()
|
|
|
|
buildDockerfile(py.docker)
|
|
|
|
image = docker.build("dosage-$py.docker")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage("Build $py.name") {
|
|
|
|
image.inside {
|
|
|
|
checkout scm
|
|
|
|
sh '''
|
|
|
|
git clean -fdx
|
|
|
|
git fetch --tags
|
|
|
|
'''
|
|
|
|
|
2019-07-14 10:57:06 +00:00
|
|
|
warnError('tox failed') {
|
2018-05-12 15:56:17 +00:00
|
|
|
sh "tox -e $py.tox"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (py.main) {
|
|
|
|
sh """
|
|
|
|
python setup.py sdist bdist_wheel
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage ("Archive $py.name") {
|
|
|
|
archiveArtifacts artifacts: '.tox/dist/*.zip', fingerprint: true
|
|
|
|
if (py.main) {
|
|
|
|
archiveArtifacts artifacts: 'dist/*', fingerprint: true
|
2018-05-13 22:50:45 +00:00
|
|
|
stash includes: 'dist/*.tar.gz', name: 'bin'
|
2018-05-12 15:56:17 +00:00
|
|
|
def buildVer = findFiles(glob: 'dist/*.tar.gz')[0].name.replaceFirst(/\.tar\.gz$/, '')
|
|
|
|
currentBuild.description = buildVer
|
|
|
|
|
|
|
|
cobertura autoUpdateHealth: false,
|
|
|
|
autoUpdateStability: false,
|
|
|
|
coberturaReportFile: '.tox/cov-*.xml',
|
|
|
|
failUnhealthy: false,
|
|
|
|
failUnstable: false,
|
|
|
|
maxNumberOfBuilds: 0,
|
|
|
|
onlyStable: false,
|
|
|
|
zoomCoverageChart: false
|
|
|
|
warnings consoleParsers: [[parserName: 'flake8']]
|
|
|
|
}
|
|
|
|
junit '.tox/junit-*.xml'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
timestamps {
|
|
|
|
ansiColor('xterm') {
|
|
|
|
parallel(tasks)
|
2018-05-13 22:50:45 +00:00
|
|
|
windowsBuild()
|
2018-05-12 15:56:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def buildDockerfile(image) {
|
|
|
|
def uid = sh(returnStdout: true, script: 'id -u').trim()
|
|
|
|
def toxInst = 'apt-get update && apt-get -y install tox'
|
|
|
|
writeFile file: 'Dockerfile', text: """
|
|
|
|
FROM $image
|
|
|
|
RUN $toxInst
|
|
|
|
RUN useradd -mu $uid dockerjenkins
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
|
2018-05-13 22:50:45 +00:00
|
|
|
def windowsBuild() {
|
2019-07-14 10:47:58 +00:00
|
|
|
stage('Windows binary') {
|
|
|
|
warnError('windows build failed') {
|
|
|
|
node {
|
|
|
|
windowsBuildCommands()
|
|
|
|
}
|
2018-05-13 22:50:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-14 10:47:58 +00:00
|
|
|
def windowsBuildCommands() {
|
|
|
|
deleteDir()
|
|
|
|
unstash 'bin'
|
|
|
|
docker.image('tobix/pywine').inside {
|
|
|
|
sh '''
|
|
|
|
. /opt/mkuserwineprefix
|
|
|
|
tar xvf dist/dosage-*.tar.gz
|
|
|
|
cd dosage-*
|
|
|
|
xvfb-run sh -c "
|
|
|
|
wine py -m pip install -e .[css] &&
|
|
|
|
cd scripts &&
|
|
|
|
wine py -m PyInstaller -y dosage.spec;
|
|
|
|
wineserver -w" | tee log.txt
|
|
|
|
'''
|
|
|
|
archiveArtifacts '*/scripts/dist/*'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-12 15:56:17 +00:00
|
|
|
// vim: set ft=groovy:
|