jenkins: make the build more standard (#49900)

This commit is contained in:
Emmanuel Cazenave 2021-01-12 15:11:01 +01:00 committed by Frédéric Péters
parent 6231fac7e5
commit 6bfffa0cc5
4 changed files with 20 additions and 22 deletions

13
Jenkinsfile vendored
View File

@ -2,18 +2,14 @@
pipeline {
agent any
environment {
TMPDIR = "/tmp/${JOB_NAME.take(32)}-${BUILD_NUMBER}"
options {
disableConcurrentBuilds()
timeout(time: 20, unit: 'MINUTES')
}
stages {
stage('Unit Tests') {
steps {
sh "mkdir ${env.TMPDIR}"
sh """
python3 -m venv ${env.TMPDIR}/venv/
${env.TMPDIR}/venv/bin/pip install tox
PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0)); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` pg_virtualenv -o fsync=off ${env.TMPDIR}/venv/bin/tox -r"""
sh """${env.TMPDIR}/venv/bin/tox -r -e pylint"""
sh 'tox -r'
}
post {
always {
@ -45,7 +41,6 @@ PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt
}
}
cleanup {
sh "rm -rf ${env.TMPDIR}"
cleanWs()
}
}

View File

@ -11,7 +11,7 @@ from setuptools import setup, find_packages
from setuptools.command.install_lib import install_lib as _install_lib
install_requires = [
'Django>=1.11',
'django>=1.11,<1.12',
'weasyprint<0.43',
'django-model-utils<4',
'factur-x',

View File

@ -14,4 +14,16 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
ALLOWED_HOSTS = ["localhost"]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'TEST': {
'NAME': 'barbacompta-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:45],
},
}
}

15
tox.ini
View File

@ -1,13 +1,12 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/barbacompta/{env:BRANCH_NAME:}
envlist = py3
envlist = py3-pylint
[testenv]
setenv =
DJANGO_SETTINGS_MODULE=eo_gestion.settings
BARBACOMPTA_SETTINGS_FILE=tests/settings.py
deps =
Django<2
psycopg2-binary
pytest
pytest-cov
@ -19,8 +18,10 @@ deps =
django-webtest
django-mellon
pdbpp
uwsgidecorators
commands =
py.test {posargs: --junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=eo_gestion/ tests/}
pylint: ./pylint.sh eo_gestion/
[testenv:manage]
setenv =
@ -28,16 +29,6 @@ setenv =
commands =
./manage.py {posargs:--help}
[testenv:pylint]
basepython = python3
deps=
django>=1.11,<1.12
pylint
pylint-django
uwsgidecorators
commands =
./pylint.sh eo_gestion/
[pytest]
filterwarnings=
ignore:Using or importing the ABCs from