add Jenkinsfile

This commit is contained in:
Emmanuel Cazenave 2019-10-01 12:05:11 +02:00
parent 327919c0fe
commit 9a4569cd12
3 changed files with 50 additions and 6 deletions

44
Jenkinsfile vendored Normal file
View File

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

View File

@ -18,7 +18,6 @@ def admin(db):
def test_create_user(settings, app, db, admin):
from django.contrib.auth.models import User
settings.PETALE_CHECK_CUT_UUID = False
# Login

11
tox.ini
View File

@ -3,25 +3,26 @@ envlist = coverage-dj18-pylint,coverage-dj18,dj111
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/petale/
[testenv]
usedevelop =
coverage: True
usedevelop=True
basepython = python2
setenv =
DJANGO_SETTINGS_MODULE=petale.settings
PETALE_SETTINGS_FILE=tests/settings.py
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=petale/ --cov-config .coveragerc
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov-report html --cov=petale/ --cov-config .coveragerc
deps =
dj18: django>=1.8,<1.9
dj111: django>=1.11,<1.12
pytest-cov
pytest-django<3.4.6
pytest
pylint
pylint-django
pylint<1.8
pylint-django<0.8.1
mock
django-webtest<1.9.3
dj18: djangorestframework<3.4
psycopg2
pyquery
commands =
python setup.py compile_translations
py.test {env:COVERAGE:} {posargs:tests/}
pylint: ./pylint.sh petale/