misc: add tox & Jenkinsfile (#29879)
This commit is contained in:
parent
a36a8b1cdb
commit
aa5335f169
|
@ -0,0 +1,43 @@
|
|||
@Library('eo-jenkins-lib@master') import eo.Utils
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
sh 'tox -rv'
|
||||
}
|
||||
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 == 'barbacompta' && env.GIT_BRANCH == 'origin/master') {
|
||||
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder barbacompta'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
utils = new Utils()
|
||||
utils.mail_notify(currentBuild, env, 'admin+jenkins-barbacompta@entrouvert.com')
|
||||
}
|
||||
}
|
||||
success {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Get venv site-packages path
|
||||
DSTDIR=`python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
|
||||
|
||||
# Get not venv site-packages path
|
||||
# Remove first path (assuming that is the venv path)
|
||||
NONPATH=`echo $PATH | sed 's/^[^:]*://'`
|
||||
SRCDIR=`PATH=$NONPATH python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'`
|
||||
|
||||
# Clean up
|
||||
rm -f $DSTDIR/lasso.*
|
||||
rm -f $DSTDIR/_lasso.*
|
||||
|
||||
# Link
|
||||
ln -sv $SRCDIR/lasso.py $DSTDIR
|
||||
ln -sv $SRCDIR/_lasso.* $DSTDIR
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e -x
|
||||
env
|
||||
if [ -f /var/lib/jenkins/pylint.django.rc ]; then
|
||||
PYLINT_RC=/var/lib/jenkins/pylint.django.rc
|
||||
elif [ -f pylint.django.rc ]; then
|
||||
PYLINT_RC=pylint.django.rc
|
||||
else
|
||||
echo No pylint RC found
|
||||
exit 0
|
||||
fi
|
||||
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
|
2
setup.py
2
setup.py
|
@ -10,7 +10,7 @@ install_requires=[
|
|||
'Django>=1.8,<1.12',
|
||||
'reportlab<3',
|
||||
'html5lib',
|
||||
'xhtml2pdf==0.0.4',
|
||||
'xhtml2pdf',
|
||||
'django-mellon',
|
||||
'django-model-utils',
|
||||
'pyPdf',
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
[tox]
|
||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/barbacompta/{env:BRANCH_NAME:}
|
||||
envlist = py2-django18,py2-django111-pylint
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
basepython = python2
|
||||
setenv =
|
||||
DJANGO_SETTINGS_MODULE=eo_gestion.settings
|
||||
BARBACOMPTA_SETTINGS_FILE=tests/settings.py
|
||||
deps =
|
||||
django18: django>=1.8,<1.9
|
||||
django111: django>=1.11,<1.12
|
||||
pytest-cov
|
||||
pytest-django
|
||||
pytest<4
|
||||
WebTest
|
||||
mock
|
||||
httmock
|
||||
pylint<1.8
|
||||
pylint-django<0.8.1
|
||||
django-webtest<1.9.3
|
||||
django-mellon
|
||||
xhtml2pdf==0.2
|
||||
html5lib<1.0
|
||||
commands =
|
||||
./getlasso.sh
|
||||
django18: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=eo_gestion/ tests/}
|
||||
django111: ./pylint.sh eo_gestion/
|
||||
django111: py.test {posargs: --junitxml=test_{envname}_results.xml tests/}
|
Loading…
Reference in New Issue