2021-10-15 08:20:40 +02:00
|
|
|
# Python Django
|
|
|
|
# Test a Django project on multiple versions of Python.
|
|
|
|
# Add steps that analyze code, save build artifacts, deploy, and more:
|
|
|
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
|
|
|
|
|
|
|
|
trigger:
|
2021-11-22 05:52:46 +01:00
|
|
|
- unstable
|
|
|
|
- stable
|
2021-10-19 05:05:03 +02:00
|
|
|
- 0.3
|
|
|
|
|
|
|
|
pr:
|
2021-11-22 05:52:46 +01:00
|
|
|
- unstable
|
|
|
|
- stable
|
2021-10-19 05:05:03 +02:00
|
|
|
- 0.3
|
2021-10-15 08:20:40 +02:00
|
|
|
|
|
|
|
pool:
|
|
|
|
vmImage: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-10-18 05:34:23 +02:00
|
|
|
Python38Django22:
|
2021-10-15 08:20:40 +02:00
|
|
|
PYTHON_VERSION: '3.8'
|
2021-10-18 05:34:23 +02:00
|
|
|
DJANGO_VERSION: '22'
|
|
|
|
Python39Django22:
|
2021-10-15 08:20:40 +02:00
|
|
|
PYTHON_VERSION: '3.9'
|
2021-10-18 05:34:23 +02:00
|
|
|
DJANGO_VERSION: '22'
|
|
|
|
Python38Django32:
|
|
|
|
PYTHON_VERSION: '3.8'
|
|
|
|
DJANGO_VERSION: '32'
|
|
|
|
Python39Django32:
|
|
|
|
PYTHON_VERSION: '3.9'
|
|
|
|
DJANGO_VERSION: '32'
|
2021-10-19 08:54:52 +02:00
|
|
|
maxParallel: 10
|
2021-10-15 08:20:40 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- task: UsePythonVersion@0
|
|
|
|
inputs:
|
|
|
|
versionSpec: '$(PYTHON_VERSION)'
|
|
|
|
architecture: 'x64'
|
|
|
|
|
|
|
|
- task: PythonScript@0
|
2021-10-19 08:54:52 +02:00
|
|
|
displayName: 'Export quicktest.py path'
|
2021-10-15 08:20:40 +02:00
|
|
|
inputs:
|
|
|
|
scriptSource: 'inline'
|
|
|
|
script: |
|
2021-10-19 08:54:52 +02:00
|
|
|
"""Search all subdirectories for `quicktest.py`."""
|
2021-10-15 08:20:40 +02:00
|
|
|
from glob import iglob
|
|
|
|
from os import path
|
|
|
|
# Python >= 3.5
|
2021-10-19 08:54:52 +02:00
|
|
|
quicktest_py = next(iglob(path.join('**', 'quicktest.py'), recursive=True), None)
|
2021-10-19 09:31:22 +02:00
|
|
|
if not quicktest_py:
|
2021-10-19 08:54:52 +02:00
|
|
|
raise SystemExit('Could not find quicktest.py for django-helpdesk')
|
2021-10-19 09:31:22 +02:00
|
|
|
project_location = path.dirname(path.abspath(quicktest_py))
|
2021-10-19 08:54:52 +02:00
|
|
|
print('Found quicktest.py in', project_location)
|
2021-10-15 08:20:40 +02:00
|
|
|
print('##vso[task.setvariable variable=projectRoot]{}'.format(project_location))
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
python -m pip install --upgrade pip setuptools wheel
|
2021-10-19 05:05:03 +02:00
|
|
|
pip install -c constraints-Django$(DJANGO_VERSION).txt -r requirements.txt
|
2022-07-02 12:22:40 +02:00
|
|
|
pip install -c constraints-Django$(DJANGO_VERSION).txt -r requirements-testing.txt
|
2021-10-15 08:20:40 +02:00
|
|
|
pip install unittest-xml-reporting
|
|
|
|
displayName: 'Install prerequisites'
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
pushd '$(projectRoot)'
|
2021-10-19 05:05:03 +02:00
|
|
|
python quicktest.py helpdesk
|
2021-10-15 08:20:40 +02:00
|
|
|
displayName: 'Run tests'
|