Modify tox and add Jenkisfile

This commit is contained in:
Àngel Àlvarez 2020-04-11 18:24:12 +02:00
parent ffbbf74012
commit 11f6a45e8f
2 changed files with 61 additions and 10 deletions

50
Jenkinsfile vendored Normal file
View file

@ -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'
}
}
}

21
tox.ini
View file

@ -1,18 +1,19 @@
[tox] [tox]
envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} envlist = py37-sqlite, stats
[testenv] [testenv]
commands = {envpython} setup.py test basepython=python3.7
commands = coverage run setup.py test
deps = deps =
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy-postgresql: psycopg2cffi >= 2.5
mysql: MySQL-python
sqlite: sqlitebck sqlite: sqlitebck
coverage
setenv = setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://} sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
mysql: TRYTOND_DATABASE_URI={env:MYSQL_URI:mysql://}
sqlite: DB_NAME={env:SQLITE_NAME::memory:} sqlite: DB_NAME={env:SQLITE_NAME::memory:}
postgresql: DB_NAME={env:POSTGRESQL_NAME:test} install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages}
mysql: DB_NAME={env:MYSQL_NAME:test}
install_command = pip install --pre --find-links https://trydevpi.tryton.org/ --process-dependency-links {opts} {packages} [testenv:stats]
basepython=python3.7
commands =
coverage report --omit=.tox/*
coverage xml