add Jenkinsfile and tox.ini

This commit is contained in:
Emmanuel Cazenave 2019-09-30 17:43:12 +02:00
parent 3d09fd6400
commit 51cf28a5ed
2 changed files with 52 additions and 0 deletions

39
Jenkinsfile vendored Normal file
View File

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

13
tox.ini Normal file
View File

@ -0,0 +1,13 @@
[tox]
envlist = py2-junit
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/mail2redmine/{env:BRANCH_NAME:}
[testenv]
setenv =
junit: JUNIT=--junitxml=test_results.xml -v
deps =
pytest
mock
python-redmine
commands =
py.test {env:JUNIT:} {posargs:}