From 87e86df58992736f62f25efd076c3aaf60a57d1a Mon Sep 17 00:00:00 2001 From: Emmanuel Cazenave Date: Thu, 26 Apr 2018 18:48:55 +0200 Subject: [PATCH] create jenkins pipeline job (#23431) --- Jenkinsfile | 34 ++++++++++++++++++++++++++++++++++ get_wcs.sh | 4 ++++ jenkins.sh | 13 ------------- pylint.sh | 3 --- tox.ini | 11 ++++++----- 5 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 Jenkinsfile create mode 100755 get_wcs.sh delete mode 100755 jenkins.sh diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..7f474d8 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,34 @@ +@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.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_coverage_native('index.html') + 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..d7295cc 100755 --- a/pylint.sh +++ b/pylint.sh @@ -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 diff --git a/tox.ini b/tox.ini index 3e849d7..cf85f51 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] -envlist = coverage-{django18,django111}-pylint -toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/ +toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/combo/{env:BRANCH_NAME:} +envlist = django{18,111} [testenv] usedevelop = True @@ -8,7 +8,6 @@ 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 @@ -24,5 +23,7 @@ deps = quixote<3.0 vobject commands = - py.test {env:COVERAGE:} {posargs:tests/} - pylint: ./pylint.sh combo/ + ./get_wcs.sh + django18: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=combo/ tests/} + django18: ./pylint.sh combo/ + django111: py.test {posargs: --junitxml=test_{envname}_results.xml tests/} -- 2.17.0