From 5fdd66364034f61fb4e9355229892fc5cc42ce27 Mon Sep 17 00:00:00 2001 From: Emmanuel Cazenave Date: Wed, 25 Apr 2018 20:02:02 +0200 Subject: [PATCH] create jenkins pipeline job (#23431) --- .gitignore | 1 + Jenkinsfile | 33 +++++++++++++++++++++++++++++++++ get_wcs.sh | 4 ++++ jenkins.sh | 13 ------------- pylint.sh | 2 -- tox.ini | 15 ++++++++------- 6 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 Jenkinsfile create mode 100755 get_wcs.sh delete mode 100755 jenkins.sh diff --git a/.gitignore b/.gitignore index bf645b4..c02092d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ combo/apps/maps/static/css/combo.map.css.map .cache .coverage .pytest_cache/ +.tox diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..5730f3f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,33 @@ +@Library('eo-jenkins-lib@v0.2') import eo.Utils + +pipeline { + agent any + stages{ + stage('unit test'){ + steps{ + sh 'tox -rv' + } + } + stage('packaging'){ + steps{ + script { + if (env.BRANCH_NAME == 'master') { + sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d jessie,stretch combo' + } + } + } + } + } + post { + always { + junit '*_results.xml' + script { + utils = new Utils() + utils.publish_coverage('coverage.xml') + utils.publish_pylint('pylint.out') + utils.mail_notify(currentBuild, env, 'admin+jenkins-combo@entrouvert.com') + } + cleanWs() + } + } +} diff --git a/get_wcs.sh b/get_wcs.sh new file mode 100755 index 0000000..d939cfd --- /dev/null +++ b/get_wcs.sh @@ -0,0 +1,4 @@ +#!/bin/sh -xue + +test -d wcs || git clone http://git.entrouvert.org/wcs.git +(cd wcs && git pull) diff --git a/jenkins.sh b/jenkins.sh deleted file mode 100755 index a920c4e..0000000 --- a/jenkins.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -set -e - -rm -f pylint.out -rm -f coverage.xml -rm -f test_results.xml - -test -d wcs || git clone http://git.entrouvert.org/wcs.git -(cd wcs && git pull) - -pip install --upgrade tox -tox -rv diff --git a/pylint.sh b/pylint.sh index babdf18..3dbea71 100755 --- a/pylint.sh +++ b/pylint.sh @@ -11,6 +11,4 @@ else 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 diff --git a/tox.ini b/tox.ini index 3e849d7..103514b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] -envlist = coverage-{django18,django111}-pylint -toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/ +envlist = dj{18,111} [testenv] usedevelop = True @@ -8,21 +7,23 @@ setenv = WCSCTL=wcs/wcsctl.py DJANGO_SETTINGS_MODULE=combo.settings COMBO_SETTINGS_FILE=tests/settings.py - coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=combo/ deps = - django18: django>=1.8,<1.9 - django111: django>=1.11,<1.12 + dj18: django>=1.8,<1.9 + dj111: django>=1.11,<1.12 pytest-cov pytest-django pytest WebTest mock httmock + psycopg2 pylint<1.8 pylint-django<0.9 django-webtest quixote<3.0 vobject commands = - py.test {env:COVERAGE:} {posargs:tests/} - pylint: ./pylint.sh combo/ + ./get_wcs.sh + dj18: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov=combo/ tests/} + dj18: ./pylint.sh combo/ + dj111: py.test {posargs: --junitxml=test_{envname}_results.xml tests/} -- 2.17.0