add Jenkinsfile
This commit is contained in:
parent
05f395e887
commit
568b59b447
|
@ -0,0 +1,46 @@
|
|||
@Library('eo-jenkins-lib@master') import eo.Utils
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
options { disableConcurrentBuilds() }
|
||||
stages {
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
sh './jenkins.sh'
|
||||
}
|
||||
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 == 'wcs' && env.GIT_BRANCH == 'origin/master') {
|
||||
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder auquotidien'
|
||||
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
|
||||
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder --branch ${env.GIT_BRANCH} --hotfix auquotidien"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
utils = new Utils()
|
||||
utils.mail_notify(currentBuild, env, 'admin+jenkins-auquotidien@entrouvert.com')
|
||||
}
|
||||
}
|
||||
success {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
for DIRECTORY in "htmlcov" "venv"
|
||||
do
|
||||
if [ -d "$DIRECTORY" ]; then
|
||||
rm -r $DIRECTORY
|
||||
fi
|
||||
done
|
||||
|
||||
test -d wcs || git clone git://repos.entrouvert.org/wcs.git
|
||||
(cd wcs && git pull)
|
||||
(cd wcs && git clean -xdf)
|
||||
|
||||
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<4.3' 'more-itertools<6' WebTest mock pytest-cov
|
||||
$PIP_BIN install --upgrade 'pylint<1.8' # 1.8 broken (cf wcs build #3023)
|
||||
$PIP_BIN install --upgrade 'Django<1.12' 'gadjo' 'pyproj<2' 'requests' 'django-ratelimit<3'
|
||||
$PIP_BIN install git+https://git.entrouvert.org/debian/django-ckeditor.git
|
||||
|
||||
DJANGO_SETTINGS_MODULE=wcs.settings \
|
||||
WCS_SETTINGS_FILE=tests/settings.py \
|
||||
LC_ALL=C LC_TIME=C LANG=C PYTHONPATH=$(pwd)/wcs/:$PYTHONPATH venv/bin/py.test --junitxml=test_results.xml --cov-report xml --cov-report html --cov=auquotidien/ --cov-config .coveragerc tests/
|
||||
test -f pylint.out && cp pylint.out pylint.out.prev
|
||||
(PYTHONPATH=$(pwd)/wcs/:$(pwd)/wcs/wcs/:$PYTHONPATH venv/bin/pylint -f parseable --rcfile /var/lib/jenkins/pylint.wcs.rc --ignore=pyatom.py auquotidien/modules/ | tee pylint.out) || /bin/true
|
||||
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
|
Reference in New Issue