1
|
#! /bin/bash
|
2
|
|
3
|
set -e
|
4
|
|
5
|
for DIRECTORY in "htmlcov" "venv"
|
6
|
do
|
7
|
if [ -d "$DIRECTORY" ]; then
|
8
|
rm -r $DIRECTORY
|
9
|
fi
|
10
|
done
|
11
|
|
12
|
test -d wcs || git clone git://repos.entrouvert.org/wcs.git
|
13
|
(cd wcs && git pull)
|
14
|
(cd wcs && git clean -xdf)
|
15
|
|
16
|
virtualenv -p /usr/bin/python3 --system-site-packages venv
|
17
|
PIP_BIN=venv/bin/pip
|
18
|
|
19
|
rm -f coverage.xml
|
20
|
rm -f test_results.xml
|
21
|
cat << _EOF_ > .coveragerc
|
22
|
[run]
|
23
|
omit = wcs/qommon/vendor/*.py
|
24
|
|
25
|
[report]
|
26
|
omit = wcs/qommon/vendor/*.py
|
27
|
_EOF_
|
28
|
|
29
|
$PIP_BIN install --upgrade 'pip!=20.3.2'
|
30
|
$PIP_BIN install --upgrade setuptools
|
31
|
$PIP_BIN install --upgrade 'pytest' 'attrs' 'more-itertools' WebTest mock pytest-cov
|
32
|
$PIP_BIN install --upgrade 'pylint'
|
33
|
$PIP_BIN install --upgrade 'Quixote>=3.0,<3.2' 'Django>=2.2,<2.3' 'gadjo' 'vobject' 'pyproj' 'requests' 'django-ratelimit<3' 'bleach' 'unidecode' 'pyquery' 'lxml' 'phonenumbers'
|
34
|
$PIP_BIN install git+https://git.entrouvert.org/debian/django-ckeditor.git
|
35
|
|
36
|
DJANGO_SETTINGS_MODULE=wcs.settings \
|
37
|
WCS_SETTINGS_FILE=tests/settings.py \
|
38
|
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/
|
39
|
test -f pylint.out && cp pylint.out pylint.out.prev
|
40
|
(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
|
41
|
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
|