From 15bbde249bbc48f2f83282fe04e39f1f19044279 Mon Sep 17 00:00:00 2001 From: Emmanuel Cazenave Date: Tue, 9 Oct 2018 18:13:19 +0200 Subject: [PATCH] create a Jenkinsfile (#27159) --- Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++ jenkins.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 Jenkinsfile create mode 100755 jenkins.sh diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..cf57f35c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +@Library('eo-jenkins-lib@master') import eo.Utils + +pipeline { + agent any + stages { + stage('Unit Tests') { + steps { + sh './jenkins.sh' + } + } + stage('Packaging') { + steps { + script { + if (env.JOB_NAME == 'wcs' && env.GIT_BRANCH == 'origin/master') { + sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder wcs' + } + } + } + } + } + post { + always { + script { + utils = new Utils() + utils.mail_notify(currentBuild, env, 'admin+jenkins-wcs@entrouvert.com') + utils.publish_coverage('coverage.xml') + utils.publish_coverage_native('index.html') + utils.publish_pylint('pylint.out') + } + junit '*_results.xml' + } + success { + cleanWs() + } + } +} diff --git a/jenkins.sh b/jenkins.sh new file mode 100755 index 00000000..90a4689a --- /dev/null +++ b/jenkins.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +for DIRECTORY in "htmlcov" "venv" +do + if [ -d "$DIRECTORY" ]; then + rm -r $DIRECTORY + fi +done + +virtualenv --system-site-packages venv +PIP_BIN=venv/bin/pip + +rm -f coverage.xml +rm -f test_results.xml +cat << _EOF_ > .coveragerc +[run] +omit = wcs/ctl/Bouncers/*.py wcs/qommon/vendor/*.py + +[report] +omit = wcs/ctl/Bouncers/*.py wcs/qommon/vendor/*.py +_EOF_ + +# $PIP_BIN install --upgrade 'pip<8' +$PIP_BIN install --upgrade setuptools +$PIP_BIN install --upgrade pytest WebTest mock pytest-cov pyquery pytest-django +$PIP_BIN install --upgrade 'pylint<1.8' # 1.8 broken (cf build #3023) +$PIP_BIN install --upgrade 'Django==1.8' 'gadjo' + +LC_ALL=C LC_TIME=C LANG=C PYTHONPATH=$(pwd):$PYTHONPATH venv/bin/py.test --junitxml=test_results.xml --cov-report xml --cov-report html --cov=wcs/ --cov-config .coveragerc -v tests/ +test -f pylint.out && cp pylint.out pylint.out.prev +(venv/bin/pylint -f parseable --rcfile /var/lib/jenkins/pylint.wcs.rc wcs | tee pylint.out) || /bin/true +test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true -- 2.19.0