2018-05-12 15:56:17 +00:00
|
|
|
def pys = [
|
2023-10-26 23:38:58 +00:00
|
|
|
[name: 'Python 3.12', docker: '3.12-bookworm', tox:'py312,flake8', main: true],
|
|
|
|
[name: 'Python 3.11', docker: '3.11-bookworm', tox:'py311', main: false],
|
2023-07-08 23:11:15 +00:00
|
|
|
[name: 'Python 3.10', docker: '3.10-bookworm', tox:'py310', main: false],
|
2023-10-26 23:38:58 +00:00
|
|
|
[name: 'Python 3.9', docker: '3.9-bookworm', tox:'py39', main: false],
|
|
|
|
[name: 'Python 3.8', docker: '3.8-bookworm', tox:'py38', 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 {
|
2022-04-07 23:14:02 +00:00
|
|
|
stage("Checkout $py.name") {
|
|
|
|
checkout scm
|
|
|
|
sh '''
|
|
|
|
git clean -fdx
|
|
|
|
git fetch --tags
|
|
|
|
'''
|
2018-05-12 15:56:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage("Build $py.name") {
|
2022-05-24 21:10:39 +00:00
|
|
|
def image = docker.image('docker.io/python:' + py.docker)
|
2022-04-07 23:14:02 +00:00
|
|
|
image.pull()
|
2018-05-12 15:56:17 +00:00
|
|
|
image.inside {
|
2022-05-24 21:24:01 +00:00
|
|
|
def tmpDir = pwd(tmp: true)
|
|
|
|
warnError('tox failed') {
|
|
|
|
sh """
|
|
|
|
HOME='$tmpDir'
|
|
|
|
pip install --no-warn-script-location tox
|
|
|
|
python -m tox -e $py.tox
|
|
|
|
"""
|
|
|
|
}
|
2018-05-12 15:56:17 +00:00
|
|
|
|
2022-05-24 21:24:01 +00:00
|
|
|
if (py.main) {
|
|
|
|
sh """
|
|
|
|
HOME='$tmpDir'
|
|
|
|
pip install --no-warn-script-location build
|
|
|
|
python -m build
|
|
|
|
"""
|
2018-05-12 15:56:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (py.main) {
|
|
|
|
archiveArtifacts artifacts: 'dist/*', fingerprint: true
|
2018-05-13 22:50:45 +00:00
|
|
|
stash includes: 'dist/*.tar.gz', name: 'bin'
|
2021-05-01 09:08:51 +00:00
|
|
|
dir('.tox/reports') {
|
|
|
|
stash includes: '*/allure-data/**', name: 'allure-data'
|
2020-11-22 22:25:11 +00:00
|
|
|
}
|
2018-05-12 15:56:17 +00:00
|
|
|
def buildVer = findFiles(glob: 'dist/*.tar.gz')[0].name.replaceFirst(/\.tar\.gz$/, '')
|
|
|
|
currentBuild.description = buildVer
|
|
|
|
|
2023-10-26 20:25:25 +00:00
|
|
|
recordCoverage sourceCodeEncoding: 'UTF-8', tools: [
|
|
|
|
[parser: 'COBERTURA', pattern: '.tox/reports/*/coverage.xml']
|
|
|
|
]
|
2019-10-28 15:15:26 +00:00
|
|
|
|
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
|
|
|
}
|
2021-05-01 09:08:51 +00:00
|
|
|
junit '.tox/reports/*/junit.xml'
|
2018-05-12 15:56:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-19 13:27:56 +00:00
|
|
|
// MAIN //
|
|
|
|
|
|
|
|
parallel(tasks)
|
2022-04-20 19:56:23 +00:00
|
|
|
parallel modern: {
|
|
|
|
stage('Modern Windows binary') {
|
2024-06-13 21:18:36 +00:00
|
|
|
windowsBuild('3.12', 'dosage.exe')
|
2022-04-20 19:56:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
legacy: {
|
|
|
|
stage('Legacy Windows binary') {
|
|
|
|
// Still compatible with Windows 7
|
|
|
|
windowsBuild('3.8', 'dosage-legacy.exe')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
report: {
|
|
|
|
stage('Allure report') {
|
|
|
|
processAllure()
|
|
|
|
}
|
|
|
|
}, failFast: true
|
|
|
|
|
2018-05-12 15:56:17 +00:00
|
|
|
|
2022-04-20 19:56:23 +00:00
|
|
|
def windowsBuild(pyver, exename) {
|
2020-11-22 22:25:11 +00:00
|
|
|
warnError('windows build failed') {
|
|
|
|
node {
|
2022-04-20 19:56:23 +00:00
|
|
|
windowsBuildCommands(pyver, exename)
|
2018-05-13 22:50:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-20 19:56:23 +00:00
|
|
|
def windowsBuildCommands(pyver, exename) {
|
2019-07-14 10:47:58 +00:00
|
|
|
deleteDir()
|
|
|
|
unstash 'bin'
|
2022-04-20 19:56:23 +00:00
|
|
|
|
|
|
|
def img = docker.image('docker.io/tobix/pywine:' + pyver)
|
2019-07-14 13:19:57 +00:00
|
|
|
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 "
|
2023-06-04 11:43:16 +00:00
|
|
|
wine python -m pip install .[css] &&
|
2019-07-14 10:47:58 +00:00
|
|
|
cd scripts &&
|
2023-04-10 20:09:36 +00:00
|
|
|
wine python -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
|
|
|
'''
|
2022-04-20 19:56:23 +00:00
|
|
|
sh "mv */scripts/dist/*.exe $exename"
|
|
|
|
archiveArtifacts '*.exe'
|
2019-07-14 10:47:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-22 22:25:11 +00:00
|
|
|
def processAllure() {
|
|
|
|
warnError('allure report failed') {
|
|
|
|
node {
|
|
|
|
deleteDir()
|
2021-05-01 09:08:51 +00:00
|
|
|
unstash 'allure-data'
|
|
|
|
sh 'mv */allure-data .'
|
2021-01-19 07:37:29 +00:00
|
|
|
copyArtifacts filter: 'allure-history.zip', optional: true, projectName: JOB_NAME, selector: lastWithArtifacts()
|
2020-11-27 23:37:05 +00:00
|
|
|
if (fileExists('allure-history.zip')) {
|
|
|
|
unzip dir: 'allure-data', quiet: true, zipFile: 'allure-history.zip'
|
|
|
|
sh 'rm -f allure-history.zip'
|
|
|
|
}
|
2022-05-24 21:11:46 +00:00
|
|
|
sh 'podman run --rm -v $PWD:/work --userns=keep-id docker.io/tobix/allure-cli generate allure-data'
|
2020-11-26 23:00:11 +00:00
|
|
|
zip archive: true, dir: 'allure-report', glob: 'history/**', zipFile: 'allure-history.zip'
|
2020-11-22 22:25:11 +00:00
|
|
|
publishHTML reportDir: 'allure-report', reportFiles: 'index.html', reportName: 'Allure Report'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-12 15:56:17 +00:00
|
|
|
// vim: set ft=groovy:
|