-
Notifications
You must be signed in to change notification settings - Fork 29
/
azure-pipelines.yml
150 lines (124 loc) · 3.86 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# 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:
- main
- release/*
stages:
- stage: Unit_Tests
displayName: Unit Tests
jobs:
- job: pytest
displayName: pytest
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
py3.8_wag3:
PYTHON_VERSION: '3.8'
WAGTAIL: '3.*'
py3.9_wag4:
PYTHON_VERSION: '3.9'
WAGTAIL: '4.*'
py3.10_wag5:
PYTHON_VERSION: '3.10'
WAGTAIL: '5.*'
py3.11_wag5:
PYTHON_VERSION: '3.11'
WAGTAIL: '5.*'
py3.12_wag6:
PYTHON_VERSION: "3.12"
WAGTAIL: '6.*'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python version'
inputs:
versionSpec: '$(PYTHON_VERSION)'
architecture: 'x64'
- script: python -m pip install -r requirements-dev.txt wagtail==$(WAGTAIL)
displayName: 'CR-QC: Install from local repo'
- script: |
cd testproject/
python manage.py makemigrations --check
displayName: 'CR-QC: Check migrations'
- script: pytest ./testproject/
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@2
displayName: 'Publish code coverage report'
condition: succeededOrFailed()
inputs:
summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
- stage: Static_Analysis
displayName: Static Analysis
dependsOn: Unit_Tests
condition: succeeded('Unit_Tests')
jobs:
- job: lint
displayName: Linters
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python version'
inputs:
versionSpec: '3.12'
architecture: 'x64'
- script: python -m pip install -r requirements-dev.txt
displayName: 'CR-QC: Install from local repo'
- script: codespell ./docs/ ./wagtailcache/
displayName: 'CR-QC: Spell check'
- script: ruff check .
displayName: 'CR-QC: Static analysis (ruff)'
- script: ruff format --check .
displayName: 'CR-QC: Format check'
- script: mypy ./wagtailcache/
displayName: 'CR-QC: Type check (mypy)'
- job: codecov
displayName: Code Coverage
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download code coverage from current build'
inputs:
buildType: 'current'
project: '$(System.TeamProjectId)'
pipeline: '$(System.DefinitionId)'
downloadType: 'specific'
downloadPath: '$(Agent.WorkFolder)/current-artifacts'
- pwsh: ./ci/compare-codecov.ps1 -wd $Env:WorkDir
displayName: 'CR-QC: Compare code coverage'
failOnStderr: false
env:
WorkDir: $(Agent.WorkFolder)
- job: docs
displayName: Documentation
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python version'
inputs:
versionSpec: '3.12'
architecture: 'x64'
- script: python -m pip install -r requirements-dev.txt
displayName: 'CR-QC: Install from local repo'
- pwsh: sphinx-build -M html ./docs/ ./docs/_build/ -W
displayName: 'CR-QC: Build documentation'