summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Cazenave <ecazenave@entrouvert.com>2019-05-20 12:07:12 (GMT)
committerEmmanuel Cazenave <ecazenave@entrouvert.com>2019-05-28 08:56:03 (GMT)
commit39f8f5d3bb2fa48dc9df2c578d5bcb3b4b09c15f (patch)
tree1334e37b75e44f3a541f2e0a9b2a94c8de967fec
parentc124c1d1a3f7c7e7ae149e2368c262d5468cba05 (diff)
downloadwelco-39f8f5d3bb2fa48dc9df2c578d5bcb3b4b09c15f.zip
welco-39f8f5d3bb2fa48dc9df2c578d5bcb3b4b09c15f.tar.gz
welco-39f8f5d3bb2fa48dc9df2c578d5bcb3b4b09c15f.tar.bz2
jenkins: use a Jenkinsfile (#33259)
-rw-r--r--Jenkinsfile44
-rwxr-xr-xpylint.sh13
-rw-r--r--tests/settings.py1
-rw-r--r--tox.ini10
4 files changed, 64 insertions, 4 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..ae34198
--- /dev/null
+++ b/Jenkinsfile
@@ -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()
+ }
+ }
+}
diff --git a/pylint.sh b/pylint.sh
new file mode 100755
index 0000000..d7295cc
--- /dev/null
+++ b/pylint.sh
@@ -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
diff --git a/tests/settings.py b/tests/settings.py
new file mode 100644
index 0000000..3c02312
--- /dev/null
+++ b/tests/settings.py
@@ -0,0 +1 @@
+LANGUAGE_CODE = 'en-en'
diff --git a/tox.ini b/tox.ini
index a0a48f7..1f0a84a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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/}