forked from csoltenborn/GoogleTestAdapter
-
Notifications
You must be signed in to change notification settings - Fork 44
/
TestAdapterforGoogle.TestDev17.yml
448 lines (447 loc) · 20.8 KB
/
TestAdapterforGoogle.TestDev17.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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected.
# The SBOM tasks have been removed because they are not required for the unofficial template.
# You can manually enable SBOM in the unofficial template if needed, othewise its automatically enabled when using official template. https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sbom
# This pipeline will be extended to the OneESPT template
# If you are not using the E+D shared hosted pool with windows-2022, replace the pool section with your hosted pool, os, and image name. If you are using a Linux image, you must specify an additional windows image for SDL: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/sdlanalysis/overview#how-to-specify-a-windows-pool-for-the-sdl-source-analysis-stage
# The Task 'PublishBuildArtifacts@1' has been converted to an output named 'Publish Artifact: drop to pipelines' in the templateContext section.
trigger:
- refs/heads/dev17
- refs/heads/dev15
pr:
autoCancel: true
branches:
include:
- refs/heads/dev17
- refs/heads/dev15
- dev/*
schedules:
- cron: "0 7 1 * *"
displayName: Monthly Run
branches:
include:
- refs/heads/dev17
always: true
name: $(date:yyyyMMdd)$(rev:.r)
resources:
repositories:
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
ref: refs/tags/release
- repository: googletest
type: git
name: googletest
ref: refs/heads/main
- repository: VCLS-Extensions
type: git
name: VCLS-Extensions
ref: refs/heads/dev17
variables:
- name: ApiScanClientId
value: d318cba7-db4d-4fb3-99e1-01879cb74e91
- name: ArchiveSymbols
value: "$(TAfGTArchiveSymbols)"
- name: ArtifactServices.Symbol.AccountName
value: microsoft
- name: ArtifactServices.Symbol.PAT
value: "$(GoogleTestSymbolsPat)"
- name: ArtifactServices.Symbol.UseAAD
value: False
- name: BuildConfiguration
value: "$(TAfGTBuildConfiguration)"
- name: BuildPlatform
value: Any CPU
- name: CodeQL.Enabled
value: true
- name: Codeql.Language
value: csharp,cpp,python,java
- name: CodeQL.TSAEnabled
value: true
- name: Codeql.TSAOptionsPath
value: $(Build.SourcesDirectory)\TestAdapterForGoogleTest\TSAOptions.json
- name: DiaNugetVersion
value: "$(TAfGTDiaNugetVersion)"
- name: DropRoot
value: '\\cpvsbuild\drops'
- name: NUGET_RESTORE_MSBUILD_ARGS
value: /p:Configuration="$(BuildConfiguration)"
- name: Packaging.EnableSBOMSigning
value: "$(TAfGTEnableSBOMSigning)"
- name: DropPAT
value: "$(TAfGTDropPAT)"
- name: ProductComponent
value: "$(TAfGTProductComponent)"
- name: Publish
value: "$(TAfGTPublish)"
# Quick build is used to skip some compliance tasks to quickly generate a .vsix for testing.
- name: RunAdditionalComplianceChecks
value: "$(TAfGTRunAdditionalComplianceChecks)"
- name: TAfGTRealSign
value: "$(RealSign)"
- name: RetainBuild
value: "$(TAfGTRetainBuild)"
- name: SignType
value: "$(TAfGTSignType)"
- name: SYMBOLS_PAT
value: "$(GoogleTestSymbolsPat)"
- name: smPassword
value: "$(TAfGTADOUserPassword)"
- name: smUsername
value: davidraygoza
- name: TeamName
value: VCLS
- name: VersionNumber
value: "$(TAfGTVersionNumber)"
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
pool:
name: VSEngSS-MicroBuild2022-1ES
demands:
- vstest
- msbuild
- visualstudio
- DotNetFramework
- Cmd
- npm
sdl:
sourceAnalysisPool:
name: VSEngSS-MicroBuild2022-1ES
sourceRepositoriesToScan:
exclude:
# No need to scan VCLS-Extensions source as we only use this repo to copy the public signing key.
- repository: VCLS-Extensions
# No need to scan googletest source here as it is scanned in its own independent pipeline.
- repository: googletest
tsa:
enabled: true
configFile: '$(Build.SourcesDirectory)\TSAOptions.json'
binskim:
enabled: true
scanOutputDirectoryOnly: true
analyzeTargetGlob: '$(Build.ArtifactStagingDirectory)\drop\FilesToScanDrop\**\*.dll'
codeSignValidation:
additionalTargetsGlobPattern: -:f|$(Build.ArtifactStagingDirectory)\drop\out\**;-:f|$(Build.ArtifactStagingDirectory)\drop\_manifest\**;-:f|$(Build.ArtifactStagingDirectory)\drop\gdn-Packaging.TAfGT.vsix\**;-:f|$(Build.ArtifactStagingDirectory)\drop\*.dll # Include only the files we own, build, and ship (located in /FilesToScanDrop). All other dependency binaries shipped in the .vsix are already signed by Microsoft directly.
codeql:
compiled:
enabled: false
justificationForDisabling: 'There is a bug in the 1ES template that auto injects multiple CodeQL Initialize tasks when checking out multiple repos. This causes an endless CodeQL hang during pipeline builds.'
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: stage
jobs:
- job: Phase_1
displayName: Phase 1
timeoutInMinutes: 0
cancelTimeoutInMinutes: 1
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish Artifact: drop'
targetPath: $(Build.ArtifactStagingDirectory)\drop
artifactName: drop
mb:
signing:
enabled: true
signType: $(SignType)
localization:
enabled: true
steps:
- checkout: self
displayName: 'Checkout TestAdapterForGoogleTest Git Repo'
clean: true
fetchDepth: 1
persistCredentials: true
- checkout: googletest
displayName: 'Checkout googletest ADO Repo'
clean: true
fetchDepth: 1
persistCredentials: true
- checkout: VCLS-Extensions
displayName: 'Checkout VCLS-Extensions ADO Repo to copy public key'
clean: true
fetchDepth: 1
persistCredentials: true
# After checking out the TestAdapterForGoogleTest repo copy all files up one directory to avoid having to change all paths in scripts.
- task: CopyFiles@2
displayName: 'Copy TestAdapterForGoogleTest Files to: $(Build.SourcesDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)\TestAdapterForGoogleTest'
TargetFolder: '$(Build.SourcesDirectory)'
- task: ms-vseng.MicroBuildTasks.32f78468-e895-4f47-962c-58a699361df8.MicroBuildSwixPlugin@4
displayName: Install Swix Plugin
- task: NuGetToolInstaller@1
displayName: Install NuGet
inputs:
versionSpec: 5.9.1
# Have to use manual CodeQL Init task for now because the 1ES template auto injected CodeQL contains bug that hangs during pipeline builds.
- task: MS-CST-E.codeql-3000-release.init-task.CodeQL3000Init@0
displayName: CodeQL 3000 Init
- task: VSBuild@1
displayName: Build ResolveTTs.proj
inputs:
solution: 'ResolveTTs.proj'
vsVersion: 'latest'
msbuildArgs: '-v:diag'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PowerShell@2
displayName: Generate TAfGT specific sln
inputs:
targetType: filePath
filePath: Tools\RemoveGtaProjects.ps1
- task: NuGetCommand@2
displayName: NuGet restore to sign packages
inputs:
solution: GoogleTestNuget/packages.config
selectOrConfig: config
nugetConfigPath: NuGet.config
packagesDirectory: packages
- task: NuGetCommand@2
displayName: NuGet restore for GoogleTestAdapter.sln
inputs:
solution: GoogleTestAdapter/GoogleTestAdapter.sln
selectOrConfig: config
nugetConfigPath: NuGet.config
- task: PowerShell@2
displayName: Set Version
inputs:
targetType: filePath
filePath: './GoogleTestAdapter/SetVersion.ps1'
arguments: '-version $(VersionNumber)'
- task: PowerShell@2
displayName: Add Keys for RealSign to TAfGT
inputs:
targetType: inline
script: |-
$projects_to_sign = @(
"GoogleTestAdapter\Common\Common.csproj",
"GoogleTestAdapter\Common.Dynamic.TAfGT\Common.Dynamic.TAfGT.csproj",
"GoogleTestAdapter\Core\Core.csproj",
"GoogleTestAdapter\DiaResolver\DiaResolver.csproj",
"GoogleTestAdapter\NewProjectWizard\NewProjectWizard.csproj",
"GoogleTestAdapter\TestAdapter\TestAdapter.csproj",
"GoogleTestAdapter\VsPackage.TAfGT\VsPackage.TAfGT.csproj",
"GoogleTestAdapter\Packaging.TAfGT\Packaging.TAfGT.csproj"
)
$projects_to_sign | ForEach-Object {
$xml = [xml](Get-Content $_)
$KeyFile = $xml.CreateElement("AssemblyOriginatorKeyFile", "http://schemas.microsoft.com/developer/msbuild/2003")
$KeyFile.set_InnerXML("`$(EnlistmentRoot)FinalPublicKey.snk")
$xml | ForEach-Object { $_.Project.PropertyGroup | ForEach-Object { if ($_.Condition -like '*(RealSign)'' == ''True''') { $_.AppendChild($KeyFile) } } }
$xml.Save("$pwd\$_")
}
- task: PowerShell@2
displayName: Add Keys for RealSign to googletest
inputs:
targetType: inline
script: |-
$build_script = 'GoogleTestNuGet\Build.ps1'
$match_string = '*$DelaySign.set_InnerXML("true")*'
(Get-Content $build_script) | ForEach-Object {
if ($_ -like $match_string) {
$_ + '
$KeyFile = $xml.CreateElement("AssemblyOriginatorKeyFile", "http://schemas.microsoft.com/developer/msbuild/2003")
$KeyFile.set_InnerXML("`$(EnlistmentRoot)FinalPublicKey.snk")
$RealSignGroup.AppendChild($KeyFile) | Out-Null'
} else {
$_
}
} | Set-Content $build_script
- task: PowerShell@2
displayName: Update token for template
inputs:
targetType: inline
script: |-
$project_template = 'GoogleTestAdapter\GoogleTestProjectTemplate\GoogleTest.vstemplate'
(Get-Content $project_template) | ForEach-Object {
$_ -Replace "1924acebdd4c8a75", "b03f5f7f11d50a3a"
} | Set-Content $project_template
- task: CopyFiles@2
displayName: 'Copy FinalPublicKey.snk to TestAdapterForGoogleTest'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/VCLS-Extensions/InternalAPIs/DevDiv'
Contents: 'FinalPublicKey.snk'
TargetFolder: '$(Build.SourcesDirectory)'
- task: PowerShell@2
displayName: Build GoogleTest NuGet packages
inputs:
targetType: filePath
filePath: GoogleTestNuGet\Build.ps1
arguments: -Verbose -VSPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\"
failOnStandardError: false
- task: MSBuild@1
displayName: Sign NuGet packages
inputs:
solution: GoogleTestNuGet\googletest.SignNuGet.proj
- task: BatchScript@1
displayName: Set up developer command prompt environment
inputs:
filename: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat
modifyEnvironment: true
- task: NuGetCommand@2
displayName: NuGet install dia amd64
inputs:
command: custom
arguments: install VS.Redist.Vctools.Amd64 -Version $(DiaNugetVersion) -OutputDirectory vctools -ExcludeVersion -Source https://pkgs.dev.azure.com/devdiv/_packaging/VS-CoreXtFeeds/nuget/v3/index.json -NoCache -DirectDownload -Verbosity Detailed -NonInteractive
- task: NuGetCommand@2
displayName: NuGet install dia arm64
inputs:
command: custom
arguments: install VS.Redist.Vctools.Arm64 -Version $(DiaNugetVersion) -OutputDirectory vctools -ExcludeVersion -Source https://pkgs.dev.azure.com/devdiv/_packaging/VS-CoreXtFeeds/nuget/v3/index.json -NoCache -DirectDownload -Verbosity Detailed -NonInteractive
- task: NuGetCommand@2
displayName: NuGet install dia x86
inputs:
command: custom
arguments: install VS.Redist.Vctools.X86Files -Version $(DiaNugetVersion) -OutputDirectory vctools -ExcludeVersion -Source https://pkgs.dev.azure.com/devdiv/_packaging/VS-CoreXtFeeds/nuget/v3/index.json -NoCache -DirectDownload -Verbosity Detailed -NonInteractive
- task: PowerShell@2
displayName: Build and copy dia binaries
inputs:
targetType: inline
script: |-
.\compile_typelib.ps1
Copy-Item -path '$(Build.Repository.LocalPath)\vctools\VS.Redist.Vctools.Amd64\msdia140.dll' -Destination '..\x64\msdia140.dll' -verbose
Copy-Item -path '$(Build.Repository.LocalPath)\vctools\VS.Redist.Vctools.Arm64\msdia140.dll' -Destination '..\arm64\msdia140.dll' -verbose
Copy-Item -path '$(Build.Repository.LocalPath)\vctools\VS.Redist.Vctools.X86Files\msdia140.dll' -Destination '..\x86\msdia140.dll' -verbose
workingDirectory: GoogleTestAdapter/DiaResolver/dia2
- task: VSBuild@1
displayName: Build GoogleTestAdapter.sln
inputs:
solution: GoogleTestAdapter/GoogleTestAdapter.sln
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
clean: true
maximumCpuCount: true
createLogFile: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)\drop'
inputs:
Contents: '**\out\binaries\**'
TargetFolder: $(Build.ArtifactStagingDirectory)\drop
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Manifest Generator '
inputs:
BuildDropPath: '$(Build.ArtifactStagingDirectory)\drop'
- task: NuGetCommand@2
displayName: NuGet restore vsmanproj
inputs:
solution: swix/packages.config
selectOrConfig: config
nugetConfigPath: NuGet.config
packagesDirectory: ..\NugetPackages
- task: VSBuild@1
displayName: 'Build core vsmanproj'
continueOnError: true
inputs:
solution: swix/core/Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest.vsmanproj
msbuildArgs: /p:ArtifactsDir=$(Build.ArtifactStagingDirectory)
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
maximumCpuCount: true
- task: PublishSymbols@1
displayName: 'Publish Symbols Path'
inputs:
SearchPattern: out\binaries\**\*.pdb
continueOnError: true
- task: CopyFiles@2
displayName: Copy setup files to drop root
inputs:
SourceFolder: out\binaries\GoogleTestAdapter\$(BuildConfiguration)\Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest
Contents: '*'
TargetFolder: $(Build.ArtifactStagingDirectory)\drop
continueOnError: true
- task: CopyFiles@2
displayName: Copy vsix to root
inputs:
SourceFolder: out\binaries\GoogleTestAdapter\$(BuildConfiguration)\Packaging.TAfGT
Contents: Packaging.TAfGT.vsix
TargetFolder: $(Build.ArtifactStagingDirectory)\drop
continueOnError: true
# Pull a list only of files we build and ship to be scanned in FilesToScanDrop.
- task: PowerShell@2
displayName: 'Copy Scannable Files to: $(Build.ArtifactStagingDirectory)\drop\FilesToScanDrop'
inputs:
filePath: './FilesToScan.ps1'
arguments: '-buildArtifactStagingDirectory $(Build.ArtifactStagingDirectory)\drop -directoryToSearch $(Build.ArtifactStagingDirectory)\drop'
# This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task.
- task: SDLNativeRules@3
displayName: 'Run the PREfast SDL Native Rules for MSBuild'
condition: eq (variables.RunAdditionalComplianceChecks, True)
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
publishXML: true
userProvideBuildInfo: auto
rulesetName: Recommended
setupCommandlinePicker: 'vs2022'
# This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task.
- task: PoliCheck@2
displayName: 'PoliCheck on TestAdapterForGoogleTest repo'
condition: eq (variables.RunAdditionalComplianceChecks, True)
inputs:
targetType: 'F'
targetArgument: '$(Build.SourcesDirectory)/TestAdapterForGoogleTest'
# This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task.
- task: securedevelopmentteam.vss-secure-development-tools.build-task-apiscan.APIScan@2
displayName: 'Run APIScan'
condition: eq (variables.RunAdditionalComplianceChecks, True)
inputs:
softwareFolder: '$(Build.ArtifactStagingDirectory)\drop\FilesToScanDrop'
softwareName: GoogleTest
softwareVersionNum: 1.0
isLargeApp: false
toolVersion: 'Latest'
verbosityLevel: silent
continueOnError: true
env:
AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId)
# Have to use manual CodeQL Init task for now because the 1ES template auto injected CodeQL contains bug that hangs during pipeline builds.
- task: MS-CST-E.codeql-3000-release.finalize-task.CodeQL3000Finalize@0
displayName: CodeQL 3000 Finalize
# This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task.
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3
displayName: 'Publish Guardian Artifacts'
condition: eq (variables.RunAdditionalComplianceChecks, True)
inputs:
PublishProcessedResults: true
continueOnError: true
- task: VSTest@2
displayName: Run Tests
inputs:
testAssemblyVer2: |-
out\binaries\GoogleTestAdapter\Release\**\*.Tests.*dll
**\*.Tests.Common.*dll
vsTestVersion: 15.0
runInParallel: false
diagnosticsEnabled: True
continueOnError: true
- task: 1ES.MicroBuildVstsDrop@1
displayName: Upload VSTS Drop
inputs:
dropFolder: $(Build.ArtifactStagingDirectory)\drop
dropName: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
accessToken: $(DropPAT)
dropServiceUri: https://devdiv.artifacts.visualstudio.com/DefaultCollection
vsDropServiceUri: "https://vsdrop.corp.microsoft.com/file/v1"
- task: ms-vseng.MicroBuildShipTasks.4a4e1dc3-01d0-484f-94ac-f918aaf7d509.MicroBuildRetainVstsDrops@1
displayName: Retain VSTS Drops
condition: and(succeeded(), eq(variables['RetainBuild'], true))
inputs:
DropNames: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
AccessToken: $(DropPAT)
DropServiceUri: https://devdiv.artifacts.visualstudio.com/DefaultCollection
- task: ms-vseng.MicroBuildShipTasks.0ffdda1d-8c7b-40da-b8b1-061660eaeea3.MicroBuildArchiveSymbols@5
displayName: 'Archive TestAdapterForGoogleTest on Symweb'
condition: eq (variables.ArchiveSymbols, True)
inputs:
SymbolsFeatureName: TestAdapterForGoogleTest
SymbolsProject: VS
SymbolsAgentPath: '$(Build.ArtifactStagingDirectory)\drop'
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: 'Send Telemetry'
condition: eq (variables.ArchiveSymbols, True)
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: Perform Cleanup Tasks
condition: always()