diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3657da2 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,35 @@ +@Library('eo-jenkins-lib@master') import eo.Utils + +pipeline { + agent any + stages { + stage('Unit Tests') { + steps { + sh 'tox -rv' + } + } + stage('Packaging') { + steps { + script { + if (env.JOB_NAME == 'eopayment' && env.GIT_BRANCH == 'origin/master') { + sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder eopayment' + } + } + } + } + } + post { + always { + script { + utils = new Utils() + utils.mail_notify(currentBuild, env, 'admin+jenkins-eopayment@entrouvert.com') + utils.publish_coverage('coverage.xml') + utils.publish_coverage_native('index.html') + } + junit '*_results.xml' + } + success { + cleanWs() + } + } +} diff --git a/tox.ini b/tox.ini index 61acc97..7a7f70e 100644 --- a/tox.ini +++ b/tox.ini @@ -5,13 +5,15 @@ [tox] envlist = py2,py3 -toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/eopayment/ +toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/eopayment/{env:BRANCH_NAME:} [testenv] # django.contrib.auth is not tested it does not work with our templates +basepython = python2 commands = - py.test --junitxml=junit.xml --cov-report xml --cov=eopayment/ tests + py2: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=eopayment/ tests} + py3: py.test {posargs: --junitxml=test_{envname}_results.xml tests} usedevelop = True deps = coverage pytest - pytest-cov + py2: pytest-cov