create jenkins pipeline job (#23431)

This commit is contained in:
Emmanuel Cazenave 2018-06-01 10:16:24 +02:00
parent ff9610ff0d
commit 86457dba03
5 changed files with 48 additions and 21 deletions

37
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,37 @@
@Library('eo-jenkins-lib@master') import eo.Utils
pipeline {
agent any
stages {
stage('Unit Tests') {
steps {
echo "Job name : ${env.JOB_NAME}"
sh 'tox -rv'
}
}
stage('Packaging') {
steps {
script {
if (env.BRANCH_NAME == 'master' && env.JOB_NAME == 'combo') {
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')
}
}
success {
cleanWs()
}
}
}

4
get_wcs.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh -xue
test -d wcs || git clone http://git.entrouvert.org/wcs.git
(cd wcs && git pull)

View File

@ -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

View File

@ -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

12
tox.ini
View File

@ -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
@ -23,7 +22,10 @@ deps =
django-webtest<1.9.3
quixote<3.0
vobject
psycopg2
commands =
python manage.py compilemessages
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/}