123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- # 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
- # NOTES:
- #
- # Display name of each step should be prefixed with one of the following:
- # CR-QC: for quality control measures.
- # CR-BUILD: for build-related tasks.
- # CR-DEPLOY: for publication or deployment.
- # [no prefix]: for unrelated CI setup/tooling.
- #
- # Use PowerShell Core for any utility scripts so they are re-usable across
- # Windows, macOS, and Linux.
- #
- trigger:
- - master
- stages:
- - stage: Unit_Tests
- displayName: Unit Tests
- jobs:
- - job: pytest
- displayName: pytest
- pool:
- vmImage: 'ubuntu-latest'
- strategy:
- matrix:
- py3.5:
- PYTHON_VERSION: '3.5'
- py3.6:
- PYTHON_VERSION: '3.6'
- py3.7:
- PYTHON_VERSION: '3.7'
- py3.8:
- PYTHON_VERSION: '3.8'
- steps:
- - task: UsePythonVersion@0
- displayName: 'Use Python version'
- inputs:
- versionSpec: '$(PYTHON_VERSION)'
- architecture: 'x64'
- - script: python -m pip install -r requirements-ci.txt
- displayName: 'CR-QC: Install coderedcms from local repo'
- - script: coderedcms start testproject
- displayName: 'CR-QC: Create starter project from template'
- - pwsh: ./ci/run-tests.ps1
- displayName: 'CR-QC: Run unit tests'
- - task: PublishTestResults@2
- displayName: 'Publish unit test report'
- condition: succeededOrFailed()
- inputs:
- testResultsFiles: '**/test-*.xml'
- testRunTitle: 'Publish test results for Python $(python.version)'
- - task: PublishCodeCoverageResults@1
- displayName: 'Publish code coverage report'
- condition: succeededOrFailed()
- inputs:
- codeCoverageTool: Cobertura
- summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
- - stage: Static_Analysis
- displayName: Static Analysis
- dependsOn: Unit_Tests
- condition: succeeded('Unit_Tests')
- jobs:
- - job: flake8
- displayName: flake8
- pool:
- vmImage: 'ubuntu-latest'
- steps:
- - task: UsePythonVersion@0
- displayName: 'Use Python version'
- inputs:
- versionSpec: '3.8'
- architecture: 'x64'
- - script: python -m pip install -r requirements-ci.txt
- displayName: 'CR-QC: Install coderedcms from local repo'
- - script: coderedcms start testproject
- displayName: 'CR-QC: Generate a test project'
- - pwsh: ./ci/run-flake8.ps1
- displayName: 'CR-QC: Static analysis (flake8)'
- - job: codecov
- displayName: Code Coverage
- pool:
- vmImage: 'ubuntu-latest'
- steps:
- - task: DownloadPipelineArtifact@2
- displayName: 'Download code coverage from current build'
- inputs:
- source: 'current'
- path: '$(Agent.WorkFolder)/current-artifacts'
- project: '$(System.TeamProjectId)'
- pipeline: '$(System.DefinitionId)'
- - pwsh: ./ci/compare-codecov.ps1 -wd $Env:WorkDir
- displayName: 'CR-QC: Compare code coverage'
- env:
- WorkDir: $(Agent.WorkFolder)
- - job: docs
- displayName: Documentation
- pool:
- vmImage: 'ubuntu-latest'
- steps:
- - task: UsePythonVersion@0
- displayName: 'Use Python version'
- inputs:
- versionSpec: '3.8'
- architecture: 'x64'
- - script: python -m pip install -r requirements-ci.txt
- displayName: 'CR-QC: Install coderedcms from local repo'
- - pwsh: ./ci/make-docs.ps1
- displayName: 'CR-QC: Build documentation'
|