Files

53 lines
1.9 KiB
Groovy
Raw Permalink Normal View History

2021-02-02 15:11:34 +02:00
pipeline {
agent any
options {
parallelsAlwaysFailFast()
2021-02-02 14:31:24 +02:00
}
stages {
2021-02-02 15:17:42 +02:00
stage('BuildAndTest') {
matrix {
agent none
axes {
axis {
name 'PY_VERSION'
values '3.6-alpine', '3.7-alpine', '3.8-alpine', '3.9-alpine'
}
2021-02-02 15:11:34 +02:00
}
2021-02-02 15:17:42 +02:00
stages {
stage('build') {
agent {
docker { image "python:$PY_VERSION"
2021-06-22 22:25:06 +02:00
args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings"'}
}
steps {
sh 'python --version'
}
2021-02-02 15:17:42 +02:00
}
stage('test') {
agent {
docker { image "python:$PY_VERSION"
2022-03-20 16:54:04 +02:00
args '-e DJANGO_SETTINGS_MODULE="locallibrary.settings" -u 0:0'}
}
2022-03-01 15:38:24 +02:00
environment {
PY_ENV = "/tmp/pitestenv"
}
steps {
2022-03-01 15:13:30 +02:00
sh '''
apk --no-cache add --virtual build-dependencies libpq-dev gcc musl-dev
2022-03-01 15:41:53 +02:00
python -m venv ${PY_ENV}
source ${PY_ENV}/bin/activate
2022-03-01 15:38:24 +02:00
export PATH=${PY_ENV}/bin:${PATH}
2022-03-01 21:05:03 +02:00
pip install -U pip
2022-03-01 15:24:23 +02:00
pip install -r requirements.txt
2022-03-01 16:35:28 +02:00
python3 manage.py migrate
2022-03-01 16:07:24 +02:00
python manage.py test
2022-03-20 18:53:47 +02:00
python -m xmlrunner discover -p *_test.py
2022-03-01 15:13:30 +02:00
'''
}
2021-02-02 15:17:42 +02:00
}
2021-02-02 15:11:34 +02:00
}
}
2021-02-02 10:43:26 +02:00
}
}
}