create a Jenkinsfile (#24646)

This commit is contained in:
Emmanuel Cazenave 2018-08-09 17:24:50 +02:00
parent ced979f0ae
commit 690c048f18
3 changed files with 43 additions and 10 deletions

36
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,36 @@
@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 == 'passerelle' && env.GIT_BRANCH == 'origin/master') {
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d jessie,stretch passerelle'
}
}
}
}
}
post {
always {
script {
utils = new Utils()
utils.mail_notify(currentBuild, env, 'admin+jenkins-passerelle@entrouvert.com')
utils.publish_coverage('coverage.xml')
utils.publish_coverage_native('index.html')
utils.publish_pylint('pylint.out')
}
junit '*_results.xml'
}
success {
cleanWs()
}
}
}

View File

@ -10,7 +10,4 @@ else
echo No pylint RC found
exit 0
fi
test -f pylint.out && cp pylint.out pylint.out.prev
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true

14
tox.ini
View File

@ -1,15 +1,14 @@
[tox]
envlist = coverage-{django18,django111}-pylint
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/{env:BRANCH_NAME:}
envlist = django{18,111}
[testenv]
usedevelop =
coverage: True
usedevelop = True
basepython = python2
setenv =
DJANGO_SETTINGS_MODULE=passerelle.settings
PASSERELLE_SETTINGS_FILE=tests/settings.py
fast: FAST=--nomigrations
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=passerelle/ --cov-config .coveragerc
deps =
django18: django>=1.8,<1.9
django111: django>=1.11,<1.12
@ -26,5 +25,6 @@ deps =
lxml
mohawk
commands =
py.test {env:FAST:} {env:COVERAGE:} {posargs:tests/}
pylint: ./pylint.sh passerelle/
django18: py.test {posargs: {env:FAST:} --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=passerelle/ --cov-config .coveragerc tests/}
django18: ./pylint.sh passerelle/
django111: py.test {posargs: --junitxml=test_{envname}_results.xml tests/}