-
Notifications
You must be signed in to change notification settings - Fork 86
/
.azure-pipelines.yml
365 lines (334 loc) · 11 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
trigger:
- master
resources:
containers:
- container: 2.2-bionic
image: mcr.microsoft.com/dotnet/core/sdk:2.2-bionic
- container: 3.0-disco
image: mcr.microsoft.com/dotnet/core/sdk:3.0-disco
- container: 3.0-buster
image: mcr.microsoft.com/dotnet/core/sdk:3.0-buster
- container: 3.1-focal
image: mcr.microsoft.com/dotnet/core/sdk:3.1-focal
- container: 5.0-focal
image: mcr.microsoft.com/dotnet/sdk:5.0-focal
- container: 5.0-buster
image: mcr.microsoft.com/dotnet/sdk:5.0-buster-slim
- container: 5.0-bullseye
image: mcr.microsoft.com/dotnet/sdk:5.0-bullseye-slim
- container: 5.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:5.0-nanoserver-1809
- container: 6.0-focal
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
- container: 6.0-bullseye
image: mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim
- container: 6.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:6.0-nanoserver-1809
- container: 7.0-bullseye
image: mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim
- container: 7.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:7.0-nanoserver-1809
- container: 8.0-jammy
image: mcr.microsoft.com/dotnet/sdk:8.0-jammy
- container: 8.0-nanoserver
image: mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-1809
stages:
- stage: Build
jobs:
- job: build_jammy
container: 8.0-jammy
pool:
vmImage: ubuntu-22.04
steps:
- bash: |
dotnet restore dotnet-packaging.sln
dotnet pack dotnet-packaging.sln -c Release -o $(Build.ArtifactStagingDirectory)
dotnet test Packaging.Targets.Tests/Packaging.Targets.Tests.csproj -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/Packaging.Targets.Tests.trx"
cp demo/Directory.Build.props $(Build.ArtifactStagingDirectory)
cp demo/version.txt $(Build.ArtifactStagingDirectory)
displayName: Build
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: $(Build.ArtifactStagingDirectory)/*.trx
condition: true
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: nuget
- job: build_windows
pool:
vmImage: windows-2019
container: 8.0-nanoserver
# Make sure we can run scripts in PowerShell core:
# https://github.com/microsoft/azure-pipelines-tasks/issues/11448
variables:
agent.preferPowerShellOnContainers: false
steps:
- pwsh: |
dotnet restore dotnet-packaging.sln
dotnet pack dotnet-packaging.sln -c Release -o $(Build.ArtifactStagingDirectory)
dotnet test Packaging.Targets.Tests/Packaging.Targets.Tests.csproj -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/Packaging.Targets.Tests.trx"
displayName: Build
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: $(Build.ArtifactStagingDirectory)/*.trx
- stage: Test
jobs:
- job: build_package
strategy:
maxParallel: 8
matrix:
3.1-focal-deb:
container: 3.1-focal
command: deb
3.1-disco-rpm:
container: 3.1-focal
command: rpm
3.1-focal-zip:
container: 3.1-focal
command: zip
3.1-focal-tarball:
container: 3.1-focal
command: tarball
5.0-focal-deb:
container: 5.0-focal
command: deb
5.0-focal-rpm:
container: 5.0-focal
command: rpm
5.0-focal-zip:
container: 5.0-focal
command: zip
5.0-focal-tarball:
container: 5.0-focal
command: tarball
5.0-buster-deb:
container: 5.0-buster
command: deb
5.0-buster-rpm:
container: 5.0-buster
command: rpm
5.0-buster-zip:
container: 5.0-buster
command: zip
5.0-buster-tarball:
container: 5.0-buster
command: tarball
5.0-bullseye-deb:
container: 5.0-bullseye
command: deb
5.0-bullseye-rpm:
container: 5.0-bullseye
command: rpm
5.0-bullseye-zip:
container: 5.0-bullseye
command: zip
5.0-bullseye-tarball:
container: 5.0-bullseye
command: tarball
6.0-focal-deb:
container: 6.0-focal
command: deb
6.0-focal-rpm:
container: 6.0-focal
command: rpm
6.0-focal-zip:
container: 6.0-focal
command: zip
6.0-focal-tarball:
container: 6.0-focal
command: tarball
6.0-bullseye-deb:
container: 6.0-bullseye
command: deb
6.0-bullseye-rpm:
container: 6.0-bullseye
command: rpm
6.0-bullseye-zip:
container: 6.0-bullseye
command: zip
6.0-bullseye-tarball:
container: 6.0-bullseye
command: tarball
7.0-bullseye-deb:
container: 7.0-bullseye
command: deb
7.0-bullseye-rpm:
container: 7.0-bullseye
command: rpm
7.0-bullseye-zip:
container: 7.0-bullseye
command: zip
7.0-bullseye-tarball:
container: 7.0-bullseye
command: tarball
8.0-jammy-deb:
container: 8.0-jammy
command: deb
8.0-jammy-rpm:
container: 8.0-jammy
command: rpm
8.0-jammy-zip:
container: 8.0-jammy
command: zip
8.0-jammy-tarball:
container: 8.0-jammy
command: tarball
container: $[ variables['container'] ]
pool:
vmImage: ubuntu-22.04
steps:
- template: .azure-pipelines-shared.yml
- job: molecule
pool:
vmImage: ubuntu-22.04
strategy:
maxParallel: 8
matrix:
self-contained-3_1:
suite: self-contained
framework: netcoreapp3.1
framework-dependent-app-3_1:
suite: framework-dependent
framework: netcoreapp3.1
self-contained-5_0:
suite: self-contained
framework: net5.0
framework-dependent-app-5_0:
suite: framework-dependent
framework: net5.0
self-contained-6_0:
suite: self-contained
framework: net6.0
framework-dependent-app-6_0:
suite: framework-dependent
framework: net6.0
self-contained-7_0:
suite: self-contained
framework: net7.0
framework-dependent-app-7_0:
suite: framework-dependent
framework: net7.0
self-contained-8_0:
suite: self-contained
framework: net8.0
framework-dependent-app-8_0:
suite: framework-dependent
framework: net8.0
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core 8.0'
inputs:
packageType: sdk
version: 8.0.x
- bash: |
set -e
export PATH=~/.local/bin/:$PATH
pip3 install --upgrade pip
pip3 install wheel
pip3 install --upgrade --user setuptools
pip3 install --user ansible==4.8.0
pip3 install --user molecule==3.5.2
pip3 install --user molecule-docker==1.1.0
pip3 install --user docker==5.0.3
pip3 install --user pytest==6.2.5
pip3 install --user testinfra==6.0.0
molecule --version
ansible --version
pytest --version
dotnet --version
displayName: Install molecule
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts
inputs:
artifactName: nuget
downloadPath: $(Build.ArtifactStagingDirectory)
- bash: |
set -e
export PATH="$PATH:/$HOME/.dotnet/tools"
cd $(suite)-app
echo "<configuration><packageSources><add key='local' value='$(Build.ArtifactStagingDirectory)/nuget' /></packageSources></configuration>" > NuGet.config
version=$(cat $(Build.ArtifactStagingDirectory)/nuget/version.txt)
# Install the dotnet-rpm and dotnet-deb tools
dotnet tool install --global dotnet-deb --version $version --add-source $(Build.ArtifactStagingDirectory)/nuget
dotnet tool install --global dotnet-rpm --version $version --add-source $(Build.ArtifactStagingDirectory)/nuget
# Create .deb and .rpm packages
dotnet rpm install
dotnet rpm -o $(Build.SourcesDirectory)/molecule/$(suite)/ -f $(framework)
dotnet deb -o $(Build.SourcesDirectory)/molecule/$(suite)/ -f $(framework)
workingDirectory: $(Build.SourcesDirectory)/molecule/$(suite)
displayName: Build $(suite)-app for $(framework)
- bash: |
set -e
export PATH=~/.local/bin/:$PATH
molecule test
workingDirectory: $(Build.SourcesDirectory)/molecule/$(suite)
displayName: Run molecule tests for $(suite)-app
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'pytest.xml'
searchFolder: '$(Build.SourcesDirectory)/molecule/$(suite)/molecule/default/'
condition: always()
displayName: Publish test results
- job: build_macos
pool:
vmImage: macOS-10.15
variables:
container: macos
command: tarball
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core 3.1'
inputs:
packageType: sdk
version: 3.1.415
- template: .azure-pipelines-shared.yml
- job: test_macos
pool:
vmImage: macOS-10.15
dependsOn: build_macos
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts
inputs:
artifactName: packages
downloadPath: $(Build.ArtifactStagingDirectory)/
- task: UseDotNet@2
displayName: 'Use .NET Core 3.1'
inputs:
packageType: sdk
version: 3.1.415
- bash: |
set -e
tar xvzf $(Build.ArtifactStagingDirectory)/packages/macos/test-tarball.1.0.0.tar.gz
displayName: Extract tarball
# .NET Core 3.x adn 5.x don't generate an app host for because the apps won't run on ARM if not notarized.
# See https://github.com/dotnet/sdk/pull/4019/files and https://github.com/dotnet/sdk/issues/4012.
# This means there's no 'test-tarball' executable to run.
- bash: |
set -e
dotnet ./test-tarball.dll
displayName: Execute program
- job: publish_nuget
pool:
vmImage: windows-2019
dependsOn:
- test_macos
- molecule
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: 'nuget'
displayName: 'Download NuGet artifacts'
- task: NuGetToolInstaller@0
displayName: Install NuGet
- task: NuGetCommand@2
inputs:
command: push
packagesToPush: '$(System.ArtifactsDirectory)/nuget/*.nupkg'
publishFeedCredentials: 'NuGet'
nuGetFeedType: external