57 lines
2.0 KiB
Groovy
57 lines
2.0 KiB
Groovy
@Library('eo-jenkins-lib@master') import eo.Utils
|
|
|
|
pipeline {
|
|
agent any
|
|
options { disableConcurrentBuilds() }
|
|
environment {
|
|
TMPDIR = "/tmp/$BUILD_TAG"
|
|
}
|
|
stages {
|
|
stage('Unit Tests') {
|
|
steps {
|
|
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 -rv"""
|
|
}
|
|
post {
|
|
always {
|
|
script {
|
|
utils = new Utils()
|
|
utils.publish_coverage('coverage.xml')
|
|
utils.publish_coverage_native('index.html')
|
|
utils.publish_pylint('pylint.out')
|
|
sh './merge-junit-results.py junit-*.xml >junit.xml'
|
|
sh 'rm junit-*.xml'
|
|
}
|
|
junit 'junit.xml'
|
|
}
|
|
}
|
|
}
|
|
stage('Packaging') {
|
|
steps {
|
|
script {
|
|
if (env.JOB_NAME == 'authentic' && env.GIT_BRANCH == 'origin/master') {
|
|
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder authentic'
|
|
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
|
|
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d stretch --branch ${env.GIT_BRANCH} --hotfix authentic"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
script {
|
|
utils = new Utils()
|
|
utils.mail_notify(currentBuild, env, 'admin+jenkins-authentic@entrouvert.com')
|
|
}
|
|
}
|
|
cleanup {
|
|
sh "rm -rf ${env.TMPDIR}"
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|