jenkins: use a Jenkinsfile (#33259)

This commit is contained in:
Emmanuel Cazenave 2019-05-20 14:07:12 +02:00
parent c124c1d1a3
commit 39f8f5d3bb
4 changed files with 64 additions and 4 deletions

44
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,44 @@
@Library('eo-jenkins-lib@master') import eo.Utils
pipeline {
agent any
options { disableConcurrentBuilds() }
stages {
stage('Unit Tests') {
steps {
sh 'tox -rv'
}
post {
always {
script {
utils = new Utils()
utils.publish_coverage('coverage.xml')
utils.publish_coverage_native('index.html')
utils.publish_pylint('pylint.out')
}
junit '*_results.xml'
}
}
}
stage('Packaging') {
steps {
script {
if (env.JOB_NAME == 'welco' && env.GIT_BRANCH == 'origin/master') {
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder welco'
}
}
}
}
}
post {
always {
script {
utils = new Utils()
utils.mail_notify(currentBuild, env, 'admin+jenkins-welco@entrouvert.com')
}
}
success {
cleanWs()
}
}
}

13
pylint.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
env
if [ -f /var/lib/jenkins/pylint.django.rc ]; then
PYLINT_RC=/var/lib/jenkins/pylint.django.rc
elif [ -f pylint.django.rc ]; then
PYLINT_RC=pylint.django.rc
else
echo No pylint RC found
exit 0
fi
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true

1
tests/settings.py Normal file
View File

@ -0,0 +1 @@
LANGUAGE_CODE = 'en-en'

10
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = coverage-{django18,django111}
envlist = py27-{django18,django111}
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/welco/
[testenv]
@ -7,8 +7,8 @@ usedevelop =
coverage: True
setenv =
DJANGO_SETTINGS_MODULE=welco.settings
WELCO_SETTINGS_FILE=tests/settings.py
fast: FAST=--nomigrations
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=welco/
deps =
django18: django>=1.8,<1.9
django18: django-taggit<0.23
@ -22,10 +22,12 @@ deps =
httmock
python-dateutil
pylint<1.8
pylint-django<0.9
pylint-django<0.8.1
django-webtest
pyquery
lxml
git+https://git.entrouvert.org/debian/django-ckeditor.git
commands =
py.test {env:FAST:} {env:COVERAGE:} {posargs:tests/}
django18: py.test {posargs: --junitxml=test_{envname}_results.xml tests/}
django111: ./pylint.sh welco/
django111: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=welco/ tests/}