Files
python-test/Jenkinsfile
T
admin-tea ccaf719b79
continuous-integration/drone/push Build is passing
ci-tests/python-test/pipeline/head There was a failure building this commit
Added post for junit
2022-08-15 21:00:39 +02:00

59 lines
2.0 KiB
Groovy

pipeline {
agent any
options {
parallelsAlwaysFailFast()
}
stages {
stage('BuildAndTest') {
matrix {
agent none
axes {
axis {
name 'PY_VERSION'
values '3.6-alpine', '3.7-alpine', '3.8-alpine', '3.9-alpine'
}
}
stages {
stage('build') {
agent {
docker { image "python:$PY_VERSION"
args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'}
}
steps {
sh 'python --version'
}
}
stage('test') {
agent {
docker { image "python:$PY_VERSION"
args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings" -u 0:0'}
}
environment {
PY_ENV = "/tmp/pitestenv"
}
steps {
sh '''
apk --no-cache add --virtual build-dependencies libpq-dev gcc musl-dev
python -m venv ${PY_ENV}
source ${PY_ENV}/bin/activate
export PATH=${PY_ENV}/bin:${PATH}
pip install -U pip
pip install -r requirements.txt
python3 manage.py migrate
python manage.py test
python -m xmlrunner discover -p *_test.py
'''
}
}
}
}
}
}
post {
always {
junit 'test-results/TEST-catalog*.xml'
}
}
}