Jenkinsfile: use virtualenv and pg_virtualenv

This commit is contained in:
Benjamin Dauvergne 2020-05-15 18:22:29 +02:00
parent ce3a088a24
commit 6b0ba89189
1 changed files with 11 additions and 2 deletions

13
Jenkinsfile vendored
View File

@ -2,10 +2,18 @@
pipeline { pipeline {
agent any agent any
options { disableConcurrentBuilds() }
environment {
TMPDIR = "/tmp/$BUILD_TAG"
}
stages { stages {
stage('Unit Tests') { stage('Unit Tests') {
steps { steps {
sh 'tox -rv' sh "mkdir ${env.TMPDIR}"
sh """
virtualenv -p python3 ${env.TMPDIR}/venv/
${env.TMPDIR}/venv/bin/pip install tox
PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0)); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` pg_virtualenv -o fsync=off ${env.TMPDIR}/venv/bin/tox -r"""
} }
post { post {
always { always {
@ -15,7 +23,7 @@ pipeline {
utils.publish_coverage_native('index.html') utils.publish_coverage_native('index.html')
utils.publish_pylint('pylint.out') utils.publish_pylint('pylint.out')
} }
junit '*_results.xml' mergeJunitResults()
} }
} }
} }
@ -37,6 +45,7 @@ pipeline {
} }
} }
success { success {
sh "rm -rf ${env.TMPDIR}"
cleanWs() cleanWs()
} }
} }