add Jenkinsfile

This commit is contained in:
Emmanuel Cazenave 2019-10-01 11:42:24 +02:00
parent 5d6cb71bbe
commit c42bd44ea5
2 changed files with 45 additions and 1 deletions

44
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,44 @@
@Library('eo-jenkins-lib@master') import eo.Utils
pipeline {
agent any
stages {
stage('Unit Tests') {
steps {
sh 'tox -r'
}
post {
always {
script {
utils = new Utils()
utils.publish_coverage('coverage.xml')
utils.publish_coverage_native('index.html')
}
junit '*_results.xml'
}
}
}
stage('Packaging') {
steps {
script {
if (env.JOB_NAME == 'ldaptools' && env.GIT_BRANCH == 'origin/master') {
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d stretch ldaptools'
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d stretch --branch ${env.GIT_BRANCH} --hotfix ldaptools"
}
}
}
}
}
post {
always {
script {
utils = new Utils()
utils.mail_notify(currentBuild, env, 'admin+jenkins-ldaptools@entrouvert.com')
}
}
success {
cleanWs()
}
}
}

View File

@ -10,7 +10,7 @@ envlist = py2-coverage-ldap2,py{2,3}-coverage-ldap3
[testenv]
usedevelop = true
setenv =
coverage: COVERAGE=--junit-xml=junit.xml --cov=src --cov-report xml
coverage: COVERAGE=--junit-xml=test_results.xml --cov=src --cov-report xml --cov-report html
deps =
coverage
pytest