Skip to content

Commit

Permalink
Set up CI with Azure Pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrncic authored and domdinicola committed Dec 16, 2019
1 parent fb1dd7c commit be689ce
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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:
- master

pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python38:
PYTHON_VERSION: '3.8'
maxParallel: 3

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(PYTHON_VERSION)'
architecture: 'x64'

- task: PythonScript@0
displayName: 'Export project path'
inputs:
scriptSource: 'inline'
script: |
"""Search all subdirectories for `manage.py`."""
from glob import iglob
from os import path
# Python >= 3.5
manage_py = next(iglob(path.join('**', 'manage.py'), recursive=True), None)
if not manage_py:
raise SystemExit('Could not find a Django project')
project_location = path.dirname(path.abspath(manage_py))
print('Found Django project in', project_location)
print('##vso[task.setvariable variable=projectRoot]{}'.format(project_location))
- script: |
python -m pip install --upgrade pip setuptools wheel pipenv
python -m pipenv lock -r > requirements.txt
python -m pipenv lock --dev -r > dev_requirements.txt
pip install -r requirements.txt
pip install -r dev_requirements.txt
pip install unittest-xml-reporting
displayName: 'Install prerequisites'

- script: |
psql -c "CREATE DATABASE donor_reporting_portal;" -U postgres
displayName: 'Create DB'

- script: |
pushd '$(projectRoot)'
tox
displayName: 'Run tests'

- task: PublishTestResults@2
inputs:
testResultsFiles: "**/TEST-*.xml"
testRunTitle: 'Python $(PYTHON_VERSION)'
condition: succeededOrFailed()

0 comments on commit be689ce

Please sign in to comment.