2018-05-12 15:56:17 +00:00
|
|
|
def pys = [
|
2019-10-28 15:00:38 +00:00
|
|
|
[name: 'Python 3.8', docker:'python:3.8-buster', tox:'py38,flake8', main: true],
|
|
|
|
[name: 'Python 3.7', docker:'python:3.7-buster', tox:'py37', main: false],
|
2019-07-14 10:58:05 +00:00
|
|
|
[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],
|
2018-05-12 15:56:17 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
properties([
|
|
|
|
durabilityHint('PERFORMANCE_OPTIMIZED'),
|
2020-04-11 09:43:29 +00:00
|
|
|
buildDiscarder(logRotator(numToKeepStr: '100')),
|
2018-05-12 15:56:17 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
Map tasks = [failFast: true]
|
|
|
|
|
|
|
|
pys.each { py ->
|
|
|
|
tasks[py.name] = {
|
|
|
|
node {
|
|
|
|
def image
|
|
|
|
|
|
|
|
stage("Prepare docker $py.name") {
|
|
|
|
dir('dockerbuild') {
|
|
|
|
deleteDir()
|
2019-07-14 13:19:57 +00:00
|
|
|
docker.image(py.docker).pull()
|
2018-05-12 15:56:17 +00:00
|
|
|
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
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2019-10-28 15:15:26 +00:00
|
|
|
publishCoverage calculateDiffForChangeRequests: true,
|
|
|
|
sourceFileResolver: sourceFiles('STORE_LAST_BUILD'),
|
|
|
|
adapters: [
|
|
|
|
coberturaAdapter('.tox/cov-*.xml')
|
|
|
|
]
|
|
|
|
|
2019-07-14 11:12:03 +00:00
|
|
|
recordIssues sourceCodeEncoding: 'UTF-8',
|
2020-04-11 09:57:44 +00:00
|
|
|
referenceJobName: 'dosage/master',
|
2019-07-14 11:12:03 +00:00
|
|
|
tool: flake8(pattern: '.tox/flake8.log', reportEncoding: 'UTF-8')
|
2018-05-12 15:56:17 +00:00
|
|
|
}
|
|
|
|
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()
|
|
|
|
writeFile file: 'Dockerfile', text: """
|
|
|
|
FROM $image
|
2020-08-19 09:05:36 +00:00
|
|
|
RUN pip install tox
|
2018-05-12 15:56:17 +00:00
|
|
|
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'
|
2019-07-14 13:19:57 +00:00
|
|
|
def img = docker.image('tobix/pywine')
|
|
|
|
img.pull()
|
|
|
|
img.inside {
|
2019-07-14 10:47:58 +00:00
|
|
|
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;
|
2019-07-14 20:26:46 +00:00
|
|
|
wineserver -w" 2>&1 | tee log.txt
|
2019-07-14 10:47:58 +00:00
|
|
|
'''
|
|
|
|
archiveArtifacts '*/scripts/dist/*'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-12 15:56:17 +00:00
|
|
|
// vim: set ft=groovy:
|