forked from microsoft/win32metadata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
393 lines (359 loc) · 11.3 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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
trigger:
branches:
include:
- master
pr:
- master
variables:
BuildConfiguration: Release
jobs:
- job: scrape_x64
displayName: "Scrape headers: x64"
timeoutInMinutes: 60
pool:
vmImage: windows-2019
workspace:
clean: all
steps:
- checkout: self
lfs: true
- task: UseDotNet@2
displayName: ⚙ Install .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
- task: PowerShell@2
displayName: Set build version
inputs:
targetType: inline
script: |
. .\scripts\CommonUtils.ps1
Install-DotNetTool nbgv
nbgv cloud
errorActionPreference: 'continue'
pwsh: true
- task: PowerShell@2
displayName: GenerateMetadataSource.ps1 - x64
inputs:
filePath: 'scripts\GenerateMetadataSource.ps1'
arguments: '-arch x64 -scrapeConstants'
errorActionPreference: 'continue'
pwsh: true
- publish: 'generation\WinSDK\obj\generated'
displayName: Publish x64 generated assets
artifact: 'generated_x64'
- job: scrape_x86
displayName: "Scrape headers: x86"
timeoutInMinutes: 60
pool:
vmImage: windows-2019
workspace:
clean: all
steps:
- checkout: self
lfs: true
- task: UseDotNet@2
displayName: ⚙ Install .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
- task: PowerShell@2
displayName: GenerateMetadataSource.ps1 - x86
inputs:
filePath: 'scripts\GenerateMetadataSource.ps1'
arguments: '-arch x86'
errorActionPreference: 'continue'
pwsh: true
- publish: 'generation\WinSDK\obj\generated\x86'
displayName: Publish x86 generated assets
artifact: 'generated_x86'
- job: scrape_arm64
displayName: "Scrape headers: arm64"
timeoutInMinutes: 60
pool:
vmImage: windows-2019
workspace:
clean: all
steps:
- checkout: self
lfs: true
- task: UseDotNet@2
displayName: ⚙ Install .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
- task: PowerShell@2
displayName: GenerateMetadataSource.ps1 - arm64
inputs:
filePath: 'scripts\GenerateMetadataSource.ps1'
arguments: '-arch arm64'
errorActionPreference: 'continue'
pwsh: true
- publish: 'generation\WinSDK\obj\generated\arm64'
displayName: Publish arm64 generated assets
artifact: 'generated_arm64'
- job: build_winmd
displayName: Build, test, sign, package winmd
workspace:
clean: all
dependsOn: ['scrape_x64','scrape_x86','scrape_arm64']
variables:
OutputPackagesDir: $(Build.SourcesDirectory)\bin\Packages\Release\NuGet
pool:
vmImage: windows-2019
steps:
- checkout: self
lfs: true
- task: BatchScript@1
displayName: Set up VS environment
inputs:
filename: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat'
modifyEnvironment: true
- task: UseDotNet@2
displayName: ⚙ Install .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
# ESRP Authenticode sign package DLLs
- task: UseDotNet@2
displayName: Install DotNet 2.1.x for signing tasks
inputs:
packageType: runtime
version: 2.1.x
- script: dotnet --info
displayName: Display .NET SDK/runtime info
- task: DownloadPipelineArtifact@2
displayName: Download x64 generated assets
inputs:
artifact: 'generated_x64'
path: 'generation\WinSDK\obj\generated'
- task: DownloadPipelineArtifact@2
displayName: Download x86 generated assets
inputs:
artifact: 'generated_x86'
path: 'generation\WinSDK\obj\generated\x86'
- task: DownloadPipelineArtifact@2
displayName: Download arm64 generated assets
inputs:
artifact: 'generated_arm64'
path: 'generation\WinSDK\obj\generated\arm64'
- publish: 'generation\WinSDK\obj'
artifact: 'assembled_obj'
- task: PowerShell@2
displayName: Build metadata binary
inputs:
filePath: 'scripts\BuildMetadataBin.ps1'
arguments: '-assetsScrapedSeparately'
pwsh: true
- publish: 'bin'
artifact: 'bin'
- task: EsrpCodeSigning@1
displayName: 'Authenticode Sign Binaries in Metadata package'
inputs:
ConnectedServiceName: 'Undocked RegFree Signing Connection'
FolderPath: '$(Build.SourcesDirectory)\bin'
Pattern: '*.dll,*.winmd'
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolSign",
"parameters": [
{
"parameterName": "OpusName",
"parameterValue": "Microsoft"
},
{
"parameterName": "OpusInfo",
"parameterValue": "http://www.microsoft.com"
},
{
"parameterName": "PageHash",
"parameterValue": "/NPH"
},
{
"parameterName": "FileDigest",
"parameterValue": "/fd sha256"
},
{
"parameterName": "TimeStamp",
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
}
],
"toolName": "signtool.exe",
"toolVersion": "6.2.9304.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '2'
condition: and(succeeded(), eq(variables['SignFiles'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
- task: EsrpCodeSigning@1
displayName: Authenticode sign net5.0 binaries in Generator SDK package
inputs:
ConnectedServiceName: 'Undocked RegFree Signing Connection'
FolderPath: '$(Build.SourcesDirectory)\bin\$(BuildConfiguration)\net5.0'
Pattern: 'ClangSharpSourceToWinmd.dll,ConstantsScraper.dll,MetadataUtils.dll,WinmdUtils.dll,MetadataTasks.dll'
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolSign",
"parameters": [
{
"parameterName": "OpusName",
"parameterValue": "Microsoft"
},
{
"parameterName": "OpusInfo",
"parameterValue": "http://www.microsoft.com"
},
{
"parameterName": "PageHash",
"parameterValue": "/NPH"
},
{
"parameterName": "FileDigest",
"parameterValue": "/fd sha256"
},
{
"parameterName": "TimeStamp",
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
}
],
"toolName": "signtool.exe",
"toolVersion": "6.2.9304.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '2'
condition: and(succeeded(), eq(variables['SignFiles'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
- task: PowerShell@2
displayName: Do packages
inputs:
filePath: $(Build.SourcesDirectory)\scripts\DoPackages.ps1
arguments: -SkipInstallTools
pwsh: true
- task: PowerShell@2
displayName: Do samples
inputs:
filePath: $(Build.SourcesDirectory)\scripts\DoSamples.ps1
arguments: -SkipInstallTools
pwsh: true
- task: PowerShell@2
displayName: Do tests
inputs:
filePath: $(Build.SourcesDirectory)\scripts\DoTests.ps1
arguments: -SkipInstallTools
pwsh: true
- task: EsrpCodeSigning@1
displayName: 'Sign nuget packages'
inputs:
ConnectedServiceName: 'Undocked RegFree Signing Connection'
FolderPath: '$(OutputPackagesDir)'
Pattern: '*.nupkg'
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '2'
condition: and(succeeded(), eq(variables['SignFiles'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
- task: PublishPipelineArtifact@1
displayName: 'Publish NuGet packages to pipeline artifacts'
inputs:
targetPath: '$(OutputPackagesDir)'
artifact: NuGetPackages
# There's a problem on microsoft.visualstudio.com that requires the guid instead of NuGetCommand@2
# Don't publish if we're using pre-generated source
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: 'NuGet push'
inputs:
command: push
packagesToPush: '$(OutputPackagesDir)/**/*.nupkg;!$(OutputPackagesDir)/**/*.symbols.nupkg'
publishVstsFeed: 'c1408dcb-1833-4ae4-9af5-1a891a12cc3c'
allowPackageConflicts: true
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- job: build_docs
displayName: Build API docs
pool:
vmImage: ubuntu-20.04
steps:
- checkout: self
clean: true
submodules: recursive
- task: UseDotNet@2
displayName: ⚙ Install .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
# ESRP Authenticode sign package DLLs
- task: UseDotNet@2
displayName: ⚙ Install .NET Core 2.1.x
inputs:
packageType: runtime
version: 2.1.x
- powershell: dotnet tool install -g nbgv
displayName: ⚙ Install nbgv
- script: dotnet pack -c $(BuildConfiguration)
displayName: 📦 dotnet pack
workingDirectory: apidocs
- task: EsrpCodeSigning@1
displayName: ✒ NuGet sign
inputs:
ConnectedServiceName: Undocked RegFree Signing Connection
FolderPath: $(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet
Pattern: '*.nupkg'
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: 60
MaxConcurrency: 50
MaxRetryAttempts: 5
condition: and(succeeded(), eq(variables['SignFiles'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
- publish: bin/Packages/$(BuildConfiguration)/NuGet
artifact: ApiDocsNuGetPackages
displayName: 📢 Publish package
# There's a problem on microsoft.visualstudio.com that requires the guid instead of NuGetCommand@2
# Don't publish if we're using pre-generated source
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: 📤 NuGet push
inputs:
command: push
packagesToPush: $(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet/*.nupkg
publishVstsFeed: c1408dcb-1833-4ae4-9af5-1a891a12cc3c
allowPackageConflicts: true
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))