Jenkinsfile: use virtualenv to install tox

This commit is contained in:
Benjamin Dauvergne 2020-05-12 23:08:31 +02:00
parent 4bb0f21480
commit 7881d7c6d0
2 changed files with 14 additions and 6 deletions

10
Jenkinsfile vendored
View File

@ -5,8 +5,11 @@ pipeline {
stages {
stage('Unit Tests') {
steps {
sh 'env'
sh 'tox -rv'
sh "mkdir ${env.TMPDIR}"
sh """
virtualenv -p python3 ${env.TMPDIR}/venv/
${env.TMPDIR}/venv/bin/pip install tox "virtualenv<=20.0.5" "importlib-resources<=1.0.2"
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"""
}
post {
always {
@ -16,7 +19,7 @@ pipeline {
utils.publish_coverage_native('index.html')
utils.publish_pylint('pylint.out')
}
junit '*_results.xml'
mergeJunitResults()
}
}
}
@ -38,6 +41,7 @@ pipeline {
}
}
success {
sh "rm -rf ${env.TMPDIR}"
cleanWs()
}
}

View File

@ -2,15 +2,19 @@ import os
ALLOWED_HOSTS = ['localhost']
LANGUAGE_CODE = 'en'
DATABASES = {
'default': {
'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3'),
'TEST': {
'NAME': 'a2-test',
},
'NAME': 'authentic2',
}
}
if 'postgres' in DATABASES['default']['ENGINE']:
for key in ('PGPORT', 'PGHOST', 'PGUSER', 'PGPASSWORD'):
if key in os.environ:
DATABASES['default'][key[2:]] = os.environ[key]
A2_RBAC_MANAGED_CONTENT_TYPES = ()
A2_RBAC_ROLE_ADMIN_RESTRICT_TO_OU_USERS = True