65 lines
1.9 KiB
Groovy
65 lines
1.9 KiB
Groovy
@Library('eo-jenkins-lib@master') import eo.Utils
|
|
|
|
pipeline {
|
|
agent any
|
|
stages {
|
|
stage('Unit Tests') {
|
|
steps {
|
|
sh """
|
|
rm -rf htmlcov* coverage* junit*.xml
|
|
rm -rf venv
|
|
virtualenv venv
|
|
. venv/bin/activate
|
|
pip install tox"""
|
|
script {
|
|
def envs = sh(returnStdout: true, script: "./venv/bin/tox -l").trim().split('\n')
|
|
for (env in envs) {
|
|
try {
|
|
stage('Unit Tests ' + env) {
|
|
sh './venv/bin/tox -e ' + env
|
|
}
|
|
} finally {
|
|
utils = new Utils()
|
|
utils.publish_coverage('coverage-'+env+'.xml')
|
|
utils.publish_coverage_native('index.html', 'htmlcov-' + env, 'Coverage ' + env)
|
|
junit 'junit-'+env+'.xml'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Linting') {
|
|
steps {
|
|
sh './venv/bin/tox -e pylint'
|
|
}
|
|
post {
|
|
success {
|
|
script {
|
|
utils.publish_pylint('pylint.out')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Packaging') {
|
|
steps {
|
|
script {
|
|
if (env.JOB_NAME == 'authentic' && env.GIT_BRANCH == 'origin/master') {
|
|
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder authentic'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
script {
|
|
utils = new Utils()
|
|
utils.mail_notify(currentBuild, env, 'admin+jenkins-authentic@entrouvert.com')
|
|
}
|
|
}
|
|
success {
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|