From 162a4188073c468dcb00c0a5a3341a9f23467d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80ngel=20=C3=80lvarez?= Date: Sat, 11 Apr 2020 18:13:49 +0200 Subject: [PATCH] Modify tox and add Jenkisfile --- Jenkinsfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ tox.ini | 18 +++++++++++------- 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..2b03bfc --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,50 @@ +pipeline { + agent { + docker { + image 'python:3.7' + args '--user 0:0' + } + } + stages { + stage('setup') { + steps { + sh 'pip install tox coverage' + } + } + stage('test'){ + steps { + sh 'tox' + } + + } + stage("Extract test results") { + steps{ + cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', conditionalCoverageTargets: '70, 0, 0', enableNewApi: true, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false + } + } + } + post { + changed { + emailext subject: '$DEFAULT_SUBJECT', + body: '$DEFAULT_CONTENT', + recipientProviders: [ + [$class: 'CulpritsRecipientProvider'], + [$class: 'DevelopersRecipientProvider'], + [$class: 'RequesterRecipientProvider'] + ], + replyTo: '$DEFAULT_REPLYTO', + to: '$DEFAULT_RECIPIENTS' + } + failure { + emailext subject: '$DEFAULT_SUBJECT', + body: '$DEFAULT_CONTENT', + recipientProviders: [ + [$class: 'CulpritsRecipientProvider'], + [$class: 'DevelopersRecipientProvider'], + [$class: 'RequesterRecipientProvider'] + ], + replyTo: '$DEFAULT_REPLYTO', + to: '$DEFAULT_RECIPIENTS' + } + } +} diff --git a/tox.ini b/tox.ini index 2082ab4..9548776 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,19 @@ [tox] -envlist = {py27,py34,py35,py36}-{sqlite,postgresql},pypy-{sqlite,postgresql} +envlist = py37-sqlite, stats [testenv] -commands = {envpython} setup.py test +basepython=python3.7 +commands = coverage run setup.py test deps = - {py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5 - pypy-postgresql: psycopg2cffi >= 2.5 sqlite: sqlitebck + coverage setenv = sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://} - postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://} sqlite: DB_NAME={env:SQLITE_NAME::memory:} - postgresql: DB_NAME={env:POSTGRESQL_NAME:test} -install_command = pip install --pre --process-dependency-links {opts} {packages} +install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages} + +[testenv:stats] +basepython=python3.7 +commands = + coverage report --omit=.tox/* + coverage xml