diff --git a/Jenkinsfile b/Jenkinsfile index 9ea165647..408f02d54 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,20 +5,38 @@ pipeline { stages { stage('Unit Tests') { steps { - sh './jenkins.sh' + 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 { - always { + success { script { - utils = new Utils() - utils.publish_coverage('coverage-*.xml') - utils.publish_coverage_native( - 'index.html', 'htmlcov-coverage-dj18-authentic-pg', 'Coverage a2') - utils.publish_coverage_native( - 'index.html', 'htmlcov-coverage-dj18-rbac-pg', , 'Coverage rbac') utils.publish_pylint('pylint.out') } - junit 'junit-*.xml' } } } diff --git a/tox.ini b/tox.ini index c7e4c4116..8253c1149 100644 --- a/tox.ini +++ b/tox.ini @@ -52,12 +52,11 @@ deps = ldaptools>=0.15 commands = ./getlasso.sh - authentic: py.test {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {posargs:tests/ --random} - rbac: py.test {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {posargs:tests_rbac/} + authentic: py.test -o junit_suite_name={envname} {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {posargs:tests/ --random} + rbac: py.test -o junit_suite_name={envname} {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {posargs:tests_rbac/} coverage: mv coverage.xml coverage-{envname}.xml - coverage-dj18-authentic-pg: mv htmlcov htmlcov-coverage-dj18-authentic-pg - coverage-dj18-rbac-pg: mv htmlcov htmlcov-coverage-dj18-rbac-pg - coverage-dj18-authentic-pg: ./pylint.sh src/authentic2/ + coverage: mv htmlcov htmlcov-{envname} + pylint: ./pylint.sh src/authentic2/ [testenv:check]