diff --git a/Jenkinsfile b/Jenkinsfile index 485539c..71e2ee3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,14 +2,36 @@ pipeline { agent any + options { disableConcurrentBuilds() } + environment { + TMPDIR = "/tmp/$BUILD_TAG" + } stages { + stage('Unit Tests') { + steps { + sh "mkdir ${env.TMPDIR}" + sh """ +python3 -m venv ${env.TMPDIR}/venv/ +${env.TMPDIR}/venv/bin/pip install tox +PGPORT=`python3 -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 { + always { + script { + utils = new Utils() + utils.publish_coverage('coverage.xml') + utils.publish_coverage_native('index.html') + utils.publish_pylint('pylint.out') + } + mergeJunitResults() + } + } + } stage('Packaging') { steps { script { if (env.JOB_NAME == 'authentic2-auth-fedict' && env.GIT_BRANCH == 'origin/main') { sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d buster,bullseye authentic2-auth-fedict' - } else if (env.GIT_BRANCH.startsWith('hotfix/')) { - sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d buster,bullseye --branch ${env.GIT_BRANCH} --hotfix authentic2-auth-fedict" } } } @@ -22,7 +44,8 @@ pipeline { utils.mail_notify(currentBuild, env, 'ci+jenkins-authentic2-auth-fedict@entrouvert.org') } } - success { + cleanup { + sh "find ${env.TMPDIR} -type f -delete; rm -rf ${env.TMPDIR}" cleanWs() } }