-
Notifications
You must be signed in to change notification settings - Fork 114
/
azure-pipelines.yml
237 lines (205 loc) · 7.38 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
trigger:
- master
- dev
- 1ES
schedules:
- cron: "0 9 * * *"
displayName: Daily midnight build
branches:
include:
- dev
always: true
variables:
- group: DjangoTestApp
jobs:
- job: Windows
pool:
name: Django-1ES-pool
demands:
- imageOverride -equals JDBC-MMS2019-SQL2019-2
timeoutInMinutes: 120
strategy:
matrix:
Python3.12 - Django 5.0:
python.version: '3.12'
tox.env: 'py312-django50'
Python3.11 - Django 5.0:
python.version: '3.11'
tox.env: 'py311-django50'
Python3.10 - Django 5.0:
python.version: '3.10'
tox.env: 'py310-django50'
Python3.11 - Django 4.2:
python.version: '3.11'
tox.env: 'py311-django42'
Python3.10 - Django 4.2:
python.version: '3.10'
tox.env: 'py310-django42'
Python 3.9 - Django 4.2:
python.version: '3.9'
tox.env: 'py39-django42'
Python 3.8 - Django 4.2:
python.version: '3.8'
tox.env: 'py38-django42'
Python3.11 - Django 4.1:
python.version: '3.11'
tox.env: 'py311-django41'
Python3.10 - Django 4.1:
python.version: '3.10'
tox.env: 'py310-django41'
Python 3.9 - Django 4.1:
python.version: '3.9'
tox.env: 'py39-django41'
Python 3.8 - Django 4.1:
python.version: '3.8'
tox.env: 'py38-django41'
Python3.11 - Django 4.0:
python.version: '3.11'
tox.env: 'py311-django40'
Python3.10 - Django 4.0:
python.version: '3.10'
tox.env: 'py310-django40'
Python 3.9 - Django 4.0:
python.version: '3.9'
tox.env: 'py39-django40'
Python 3.8 - Django 4.0:
python.version: '3.8'
tox.env: 'py38-django40'
Python3.11 - Django 3.2:
python.version: '3.11'
tox.env: 'py311-django32'
Python 3.9 - Django 3.2:
python.version: '3.9'
tox.env: 'py39-django32'
Python 3.8 - Django 3.2:
python.version: '3.8'
tox.env: 'py38-django32'
steps:
- task: CredScan@3
inputs:
toolMajorVersion: 'V2'
- task: UsePythonVersion@0
inputs:
versionSpec: "$(python.version)"
displayName: Use Python $(python.version)
- powershell: |
$IP=Get-NetIPAddress -AddressFamily IPv4 -InterfaceIndex $(Get-NetConnectionProfile -IPv4Connectivity Internet | Select-Object -ExpandProperty InterfaceIndex) | Select-Object -ExpandProperty IPAddress
(Get-Content $pwd/testapp/settings.py).replace('localhost', $IP) | Set-Content $pwd/testapp/settings.py
Invoke-WebRequest https://download.microsoft.com/download/6/f/f/6ffefc73-39ab-4cc0-bb7c-4093d64c2669/en-US/17.10.5.1/x64/msodbcsql.msi -OutFile msodbcsql.msi
msiexec /quiet /passive /qn /i msodbcsql.msi IACCEPTMSODBCSQLLICENSETERMS=YES
Get-OdbcDriver
displayName: Install ODBC
- powershell: |
Import-Module "sqlps"
Invoke-Sqlcmd @"
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2
ALTER LOGIN [sa] ENABLE;
ALTER LOGIN [sa] WITH PASSWORD = '$(TestAppPassword)', CHECK_POLICY=OFF;
"@
displayName: Set up SQL Server
- powershell: |
Restart-Service -Name MSSQLSERVER -Force
displayName: Restart SQL Server
- powershell: |
(Get-Content -ReadCount 0 testapp\settings.py) -replace 'MyPassword42', '$(TestAppPassWord)' | Set-Content testapp\settings.py
displayName: Change PASSWORD in settings.py
- powershell: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install tox
git clone https://github.com/django/django.git
python -m tox -e $(tox.env)
displayName: Run tox
- job: Linux
pool:
name: Django-1ES-pool
demands:
- imageOverride -equals Ubuntu22.04-AzurePipelines
timeoutInMinutes: 120
strategy:
matrix:
Python3.12 - Django 5.0:
python.version: '3.12'
tox.env: 'py312-django50'
Python3.11 - Django 5.0:
python.version: '3.11'
tox.env: 'py311-django50'
Python3.10 - Django 5.0:
python.version: '3.10'
tox.env: 'py310-django50'
Python3.11 - Django 4.2:
python.version: '3.11'
tox.env: 'py311-django42'
Python3.10 - Django 4.2:
python.version: '3.10'
tox.env: 'py310-django42'
Python 3.9 - Django 4.2:
python.version: '3.9'
tox.env: 'py39-django42'
Python 3.8 - Django 4.2:
python.version: '3.8'
tox.env: 'py38-django42'
Python3.11 - Django 4.1:
python.version: '3.11'
tox.env: 'py311-django41'
Python3.10 - Django 4.1:
python.version: '3.10'
tox.env: 'py310-django41'
Python 3.9 - Django 4.1:
python.version: '3.9'
tox.env: 'py39-django41'
Python 3.8 - Django 4.1:
python.version: '3.8'
tox.env: 'py38-django41'
Python3.11 - Django 4.0:
python.version: '3.11'
tox.env: 'py311-django40'
Python3.10 - Django 4.0:
python.version: '3.10'
tox.env: 'py310-django40'
Python 3.9 - Django 4.0:
python.version: '3.9'
tox.env: 'py39-django40'
Python 3.8 - Django 4.0:
python.version: '3.8'
tox.env: 'py38-django40'
Python3.11 - Django 3.2:
python.version: '3.11'
tox.env: 'py311-django32'
Python 3.9 - Django 3.2:
python.version: '3.9'
tox.env: 'py39-django32'
Python 3.8 - Django 3.2:
python.version: '3.8'
tox.env: 'py38-django32'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "$(python.version)"
displayName: Use Python $(python.version)
- script: |
docker version
docker pull mcr.microsoft.com/mssql/server:2022-latest
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=$(TestAppPassword)' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
displayName: Install SQL Server
- script: |
python -m pip install --upgrade pip wheel setuptools
pip install tox
git clone https://github.com/django/django.git
displayName: Install requirements
- script: |
sed -i 's/MyPassword42/$(TestAppPassword)/g' testapp/settings.py
displayName: Change PASSWORD in settings.py
- script: tox -e $(tox.env)
displayName: Run tox
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: 'django/coverage.xml'
- task: PublishTestResults@2
displayName: Publish test results via jUnit
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'django/result.xml'
testRunTitle: 'junit-$(Agent.OS)-$(Agent.OSArchitecture)-$(tox.env)'