|
| 1 | +parameters: |
| 2 | +- name: IsProd |
| 3 | + type: boolean |
| 4 | + default: false |
| 5 | +jobs: |
| 6 | +- job: Phase_1 |
| 7 | + displayName: Phase 1 |
| 8 | + timeoutInMinutes: 0 |
| 9 | + cancelTimeoutInMinutes: 1 |
| 10 | + variables: |
| 11 | + - name: ArchiveSymbols |
| 12 | + value: "$(TAfGTArchiveSymbols)" |
| 13 | + - name: BuildConfiguration |
| 14 | + value: "$(TAfGTBuildConfiguration)" |
| 15 | + - name: BuildPlatform |
| 16 | + value: Any CPU |
| 17 | + - name: CodeQL.Enabled |
| 18 | + value: true |
| 19 | + - name: Codeql.Language |
| 20 | + value: csharp,cpp,python,java |
| 21 | + - name: CodeQL.TSAEnabled |
| 22 | + value: true |
| 23 | + - name: Codeql.TSAOptionsPath |
| 24 | + value: $(Build.SourcesDirectory)\TestAdapterForGoogleTest\TSAOptions.json |
| 25 | + - name: DiaNugetVersion |
| 26 | + value: "$(TAfGTDiaNugetVersion)" |
| 27 | + - name: DropRoot |
| 28 | + value: '\\cpvsbuild\drops' |
| 29 | + - name: NUGET_RESTORE_MSBUILD_ARGS |
| 30 | + value: /p:Configuration="$(BuildConfiguration)" |
| 31 | + - name: Packaging.EnableSBOMSigning |
| 32 | + value: "$(TAfGTEnableSBOMSigning)" |
| 33 | + - name: ProductComponent |
| 34 | + value: "$(TAfGTProductComponent)" |
| 35 | + - name: Publish |
| 36 | + value: "$(TAfGTPublish)" |
| 37 | + # Quick build is used to skip some compliance tasks to quickly generate a .vsix for testing. |
| 38 | + - name: RunAdditionalComplianceChecks |
| 39 | + value: "$(TAfGTRunAdditionalComplianceChecks)" |
| 40 | + - name: TAfGTRealSign |
| 41 | + value: "$(RealSign)" |
| 42 | + - name: RetainBuild |
| 43 | + value: "$(TAfGTRetainBuild)" |
| 44 | + - name: TeamName |
| 45 | + value: VCLS |
| 46 | + - name: VersionNumber |
| 47 | + value: "$(TAfGTVersionNumber)" |
| 48 | + templateContext: |
| 49 | + outputs: |
| 50 | + - output: pipelineArtifact |
| 51 | + condition: eq('${{ parameters.IsProd }}', true) |
| 52 | + displayName: 'Publish Artifact: drop' |
| 53 | + targetPath: $(Build.ArtifactStagingDirectory)\drop |
| 54 | + artifactName: drop |
| 55 | + mb: |
| 56 | + signing: |
| 57 | + enabled: true |
| 58 | + ${{ if eq(parameters.IsProd, true) }}: |
| 59 | + signType: 'real' |
| 60 | + signWithProd: true |
| 61 | + ${{ else }}: |
| 62 | + signType: 'test' |
| 63 | + zipSources: false |
| 64 | + localization: |
| 65 | + enabled: true |
| 66 | + steps: |
| 67 | + - checkout: self |
| 68 | + displayName: 'Checkout TestAdapterForGoogleTest Git Repo' |
| 69 | + clean: true |
| 70 | + fetchDepth: 1 |
| 71 | + persistCredentials: true |
| 72 | + - checkout: googletest |
| 73 | + displayName: 'Checkout googletest ADO Repo' |
| 74 | + clean: true |
| 75 | + fetchDepth: 1 |
| 76 | + persistCredentials: true |
| 77 | + - checkout: VCLS-Extensions |
| 78 | + displayName: 'Checkout VCLS-Extensions ADO Repo to copy public key' |
| 79 | + clean: true |
| 80 | + fetchDepth: 1 |
| 81 | + persistCredentials: true |
| 82 | + # After checking out the TestAdapterForGoogleTest repo copy all files up one directory to avoid having to change all paths in scripts. |
| 83 | + - task: CopyFiles@2 |
| 84 | + displayName: 'Copy TestAdapterForGoogleTest Files to: $(Build.SourcesDirectory)' |
| 85 | + inputs: |
| 86 | + SourceFolder: '$(Build.SourcesDirectory)\TestAdapterForGoogleTest' |
| 87 | + TargetFolder: '$(Build.SourcesDirectory)' |
| 88 | + - task: ms-vseng.MicroBuildTasks.32f78468-e895-4f47-962c-58a699361df8.MicroBuildSwixPlugin@4 |
| 89 | + displayName: Install Swix Plugin |
| 90 | + - task: NuGetToolInstaller@1 |
| 91 | + displayName: Install NuGet |
| 92 | + inputs: |
| 93 | + versionSpec: 5.9.1 |
| 94 | + # Have to use manual CodeQL Init task for now because the 1ES template auto injected CodeQL contains bug that hangs during pipeline builds. |
| 95 | + - task: MS-CST-E.codeql-3000-release.init-task.CodeQL3000Init@0 |
| 96 | + displayName: CodeQL 3000 Init |
| 97 | + - task: VSBuild@1 |
| 98 | + displayName: Build ResolveTTs.proj |
| 99 | + inputs: |
| 100 | + solution: 'ResolveTTs.proj' |
| 101 | + vsVersion: 'latest' |
| 102 | + msbuildArgs: '-v:diag' |
| 103 | + platform: '$(BuildPlatform)' |
| 104 | + configuration: '$(BuildConfiguration)' |
| 105 | + - task: PowerShell@2 |
| 106 | + displayName: Generate TAfGT specific sln |
| 107 | + inputs: |
| 108 | + targetType: filePath |
| 109 | + filePath: Tools\RemoveGtaProjects.ps1 |
| 110 | + - task: NuGetCommand@2 |
| 111 | + displayName: NuGet restore to sign packages |
| 112 | + inputs: |
| 113 | + solution: GoogleTestNuget/packages.config |
| 114 | + selectOrConfig: config |
| 115 | + nugetConfigPath: NuGet.config |
| 116 | + packagesDirectory: packages |
| 117 | + - task: NuGetCommand@2 |
| 118 | + displayName: NuGet restore for GoogleTestAdapter.sln |
| 119 | + inputs: |
| 120 | + solution: GoogleTestAdapter/GoogleTestAdapter.sln |
| 121 | + selectOrConfig: config |
| 122 | + nugetConfigPath: NuGet.config |
| 123 | + - task: PowerShell@2 |
| 124 | + displayName: Set Version |
| 125 | + inputs: |
| 126 | + targetType: filePath |
| 127 | + filePath: './GoogleTestAdapter/SetVersion.ps1' |
| 128 | + arguments: '-version $(VersionNumber)' |
| 129 | + - task: PowerShell@2 |
| 130 | + displayName: Add Keys for RealSign to TAfGT |
| 131 | + condition: eq('${{ parameters.IsProd }}', true) |
| 132 | + inputs: |
| 133 | + targetType: inline |
| 134 | + script: |- |
| 135 | + $projects_to_sign = @( |
| 136 | + "GoogleTestAdapter\Common\Common.csproj", |
| 137 | + "GoogleTestAdapter\Common.Dynamic.TAfGT\Common.Dynamic.TAfGT.csproj", |
| 138 | + "GoogleTestAdapter\Core\Core.csproj", |
| 139 | + "GoogleTestAdapter\DiaResolver\DiaResolver.csproj", |
| 140 | + "GoogleTestAdapter\NewProjectWizard\NewProjectWizard.csproj", |
| 141 | + "GoogleTestAdapter\TestAdapter\TestAdapter.csproj", |
| 142 | + "GoogleTestAdapter\VsPackage.TAfGT\VsPackage.TAfGT.csproj", |
| 143 | + "GoogleTestAdapter\Packaging.TAfGT\Packaging.TAfGT.csproj" |
| 144 | + ) |
| 145 | + $projects_to_sign | ForEach-Object { |
| 146 | + $xml = [xml](Get-Content $_) |
| 147 | + $KeyFile = $xml.CreateElement("AssemblyOriginatorKeyFile", "http://schemas.microsoft.com/developer/msbuild/2003") |
| 148 | + $KeyFile.set_InnerXML("`$(EnlistmentRoot)FinalPublicKey.snk") |
| 149 | + $xml | ForEach-Object { $_.Project.PropertyGroup | ForEach-Object { if ($_.Condition -like '*(RealSign)'' == ''True''') { $_.AppendChild($KeyFile) } } } |
| 150 | + $xml.Save("$pwd\$_") |
| 151 | + } |
| 152 | + - task: PowerShell@2 |
| 153 | + displayName: Add Keys for RealSign to googletest |
| 154 | + condition: eq('${{ parameters.IsProd }}', true) |
| 155 | + inputs: |
| 156 | + targetType: inline |
| 157 | + script: |- |
| 158 | + $build_script = 'GoogleTestNuGet\Build.ps1' |
| 159 | + $match_string = '*$DelaySign.set_InnerXML("true")*' |
| 160 | + (Get-Content $build_script) | ForEach-Object { |
| 161 | + if ($_ -like $match_string) { |
| 162 | + $_ + ' |
| 163 | + $KeyFile = $xml.CreateElement("AssemblyOriginatorKeyFile", "http://schemas.microsoft.com/developer/msbuild/2003") |
| 164 | + $KeyFile.set_InnerXML("`$(EnlistmentRoot)FinalPublicKey.snk") |
| 165 | + $RealSignGroup.AppendChild($KeyFile) | Out-Null' |
| 166 | + } else { |
| 167 | + $_ |
| 168 | + } |
| 169 | + } | Set-Content $build_script |
| 170 | + - task: PowerShell@2 |
| 171 | + displayName: Update token for template |
| 172 | + inputs: |
| 173 | + targetType: inline |
| 174 | + script: |- |
| 175 | + $project_template = 'GoogleTestAdapter\GoogleTestProjectTemplate\GoogleTest.vstemplate' |
| 176 | + (Get-Content $project_template) | ForEach-Object { |
| 177 | + $_ -Replace "1924acebdd4c8a75", "b03f5f7f11d50a3a" |
| 178 | + } | Set-Content $project_template |
| 179 | + - task: CopyFiles@2 |
| 180 | + displayName: 'Copy FinalPublicKey.snk to TestAdapterForGoogleTest' |
| 181 | + inputs: |
| 182 | + SourceFolder: '$(Build.SourcesDirectory)/VCLS-Extensions/InternalAPIs/DevDiv' |
| 183 | + Contents: 'FinalPublicKey.snk' |
| 184 | + TargetFolder: '$(Build.SourcesDirectory)' |
| 185 | + - task: PowerShell@2 |
| 186 | + displayName: Build GoogleTest NuGet packages |
| 187 | + inputs: |
| 188 | + targetType: filePath |
| 189 | + filePath: GoogleTestNuGet\Build.ps1 |
| 190 | + arguments: -Verbose -VSPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\" |
| 191 | + failOnStandardError: false |
| 192 | + - task: MSBuild@1 |
| 193 | + displayName: Sign NuGet packages |
| 194 | + inputs: |
| 195 | + solution: GoogleTestNuGet\googletest.SignNuGet.proj |
| 196 | + - task: BatchScript@1 |
| 197 | + displayName: Set up developer command prompt environment |
| 198 | + inputs: |
| 199 | + filename: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat |
| 200 | + modifyEnvironment: true |
| 201 | + - task: NuGetCommand@2 |
| 202 | + displayName: NuGet install dia amd64 |
| 203 | + inputs: |
| 204 | + command: custom |
| 205 | + 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 |
| 206 | + - task: NuGetCommand@2 |
| 207 | + displayName: NuGet install dia arm64 |
| 208 | + inputs: |
| 209 | + command: custom |
| 210 | + 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 |
| 211 | + - task: NuGetCommand@2 |
| 212 | + displayName: NuGet install dia x86 |
| 213 | + inputs: |
| 214 | + command: custom |
| 215 | + 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 |
| 216 | + - task: PowerShell@2 |
| 217 | + displayName: Build and copy dia binaries |
| 218 | + inputs: |
| 219 | + targetType: inline |
| 220 | + script: |- |
| 221 | + .\compile_typelib.ps1 |
| 222 | + Copy-Item -path '$(Build.Repository.LocalPath)\vctools\VS.Redist.Vctools.Amd64\msdia140.dll' -Destination '..\x64\msdia140.dll' -verbose |
| 223 | + Copy-Item -path '$(Build.Repository.LocalPath)\vctools\VS.Redist.Vctools.Arm64\msdia140.dll' -Destination '..\arm64\msdia140.dll' -verbose |
| 224 | + Copy-Item -path '$(Build.Repository.LocalPath)\vctools\VS.Redist.Vctools.X86Files\msdia140.dll' -Destination '..\x86\msdia140.dll' -verbose |
| 225 | + workingDirectory: GoogleTestAdapter/DiaResolver/dia2 |
| 226 | + - task: VSBuild@1 |
| 227 | + displayName: Build GoogleTestAdapter.sln |
| 228 | + inputs: |
| 229 | + solution: GoogleTestAdapter/GoogleTestAdapter.sln |
| 230 | + platform: $(BuildPlatform) |
| 231 | + configuration: $(BuildConfiguration) |
| 232 | + clean: true |
| 233 | + maximumCpuCount: true |
| 234 | + createLogFile: true |
| 235 | + - task: CopyFiles@2 |
| 236 | + displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)\drop' |
| 237 | + inputs: |
| 238 | + Contents: '**\out\binaries\**' |
| 239 | + TargetFolder: $(Build.ArtifactStagingDirectory)\drop |
| 240 | + - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 |
| 241 | + displayName: 'Manifest Generator ' |
| 242 | + inputs: |
| 243 | + BuildDropPath: '$(Build.ArtifactStagingDirectory)\drop' |
| 244 | + - task: NuGetCommand@2 |
| 245 | + displayName: NuGet restore vsmanproj |
| 246 | + inputs: |
| 247 | + solution: swix/packages.config |
| 248 | + selectOrConfig: config |
| 249 | + nugetConfigPath: NuGet.config |
| 250 | + packagesDirectory: ..\NugetPackages |
| 251 | + - task: VSBuild@1 |
| 252 | + displayName: 'Build core vsmanproj' |
| 253 | + continueOnError: true |
| 254 | + inputs: |
| 255 | + solution: swix/core/Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest.vsmanproj |
| 256 | + msbuildArgs: /p:ArtifactsDir=$(Build.ArtifactStagingDirectory) |
| 257 | + platform: '$(BuildPlatform)' |
| 258 | + configuration: '$(BuildConfiguration)' |
| 259 | + maximumCpuCount: true |
| 260 | + - task: PublishSymbols@2 |
| 261 | + condition: eq('${{ parameters.IsProd }}', true) |
| 262 | + displayName: 'Enable Source Server' |
| 263 | + inputs: |
| 264 | + SearchPattern: 'out\binaries\**\*.pdb' |
| 265 | + # We use the MicroBuild Archive Symbols task so we need to publish the symbols here. |
| 266 | + # See the following for more info: https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/34299/Handling-Symbols |
| 267 | + PublishSymbols: false |
| 268 | + continueOnError: true |
| 269 | + - task: CopyFiles@2 |
| 270 | + displayName: Copy setup files to drop root |
| 271 | + inputs: |
| 272 | + SourceFolder: out\binaries\GoogleTestAdapter\$(BuildConfiguration)\Microsoft.VisualStudio.VC.Ide.TestAdapterForGoogleTest |
| 273 | + Contents: '*' |
| 274 | + TargetFolder: $(Build.ArtifactStagingDirectory)\drop |
| 275 | + continueOnError: true |
| 276 | + - task: CopyFiles@2 |
| 277 | + displayName: Copy vsix to root |
| 278 | + inputs: |
| 279 | + SourceFolder: out\binaries\GoogleTestAdapter\$(BuildConfiguration)\Packaging.TAfGT |
| 280 | + Contents: Packaging.TAfGT.vsix |
| 281 | + TargetFolder: $(Build.ArtifactStagingDirectory)\drop |
| 282 | + continueOnError: true |
| 283 | + # Pull a list only of files we build and ship to be scanned in FilesToScanDrop. |
| 284 | + - task: PowerShell@2 |
| 285 | + displayName: 'Copy Scannable Files to: $(Build.ArtifactStagingDirectory)\drop\FilesToScanDrop' |
| 286 | + inputs: |
| 287 | + filePath: './FilesToScan.ps1' |
| 288 | + arguments: '-buildArtifactStagingDirectory $(Build.ArtifactStagingDirectory)\drop -directoryToSearch $(Build.ArtifactStagingDirectory)\drop' |
| 289 | + # This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task. |
| 290 | + - task: SDLNativeRules@3 |
| 291 | + displayName: 'Run the PREfast SDL Native Rules for MSBuild' |
| 292 | + condition: eq (variables.RunAdditionalComplianceChecks, True) |
| 293 | + env: |
| 294 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 295 | + inputs: |
| 296 | + publishXML: true |
| 297 | + userProvideBuildInfo: auto |
| 298 | + rulesetName: Recommended |
| 299 | + setupCommandlinePicker: 'vs2022' |
| 300 | + # This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task. |
| 301 | + - task: PoliCheck@2 |
| 302 | + displayName: 'PoliCheck on TestAdapterForGoogleTest repo' |
| 303 | + condition: eq (variables.RunAdditionalComplianceChecks, True) |
| 304 | + inputs: |
| 305 | + targetType: 'F' |
| 306 | + targetArgument: '$(Build.SourcesDirectory)/TestAdapterForGoogleTest' |
| 307 | + # This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task. |
| 308 | + - task: securedevelopmentteam.vss-secure-development-tools.build-task-apiscan.APIScan@2 |
| 309 | + displayName: 'Run APIScan' |
| 310 | + condition: eq (variables.RunAdditionalComplianceChecks, True) |
| 311 | + inputs: |
| 312 | + azureSubscription: 'VSEng-APIScanSC' |
| 313 | + softwareFolder: '$(Build.ArtifactStagingDirectory)\drop\FilesToScanDrop' |
| 314 | + softwareName: GoogleTest |
| 315 | + softwareVersionNum: 1.0 |
| 316 | + isLargeApp: false |
| 317 | + toolVersion: 'Latest' |
| 318 | + verbosityLevel: silent |
| 319 | + continueOnError: true |
| 320 | + env: |
| 321 | + AzureServicesAuthConnectionString: RunAs=App;AppId=d318cba7-db4d-4fb3-99e1-01879cb74e91;TenantId=72f988bf-86f1-41af-91ab-2d7cd011db47;ServiceConnectionId=93e24264-c5e6-4681-8175-ec8a41668480; |
| 322 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 323 | + # Have to use manual CodeQL Init task for now because the 1ES template auto injected CodeQL contains bug that hangs during pipeline builds. |
| 324 | + - task: MS-CST-E.codeql-3000-release.finalize-task.CodeQL3000Finalize@0 |
| 325 | + displayName: CodeQL 3000 Finalize |
| 326 | + # This is a time-consuming compliance task, so if we want to run a quick build (off by default), then we skip this task. |
| 327 | + - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@3 |
| 328 | + displayName: 'Publish Guardian Artifacts' |
| 329 | + condition: eq (variables.RunAdditionalComplianceChecks, True) |
| 330 | + inputs: |
| 331 | + PublishProcessedResults: true |
| 332 | + continueOnError: true |
| 333 | + - task: VSTest@2 |
| 334 | + displayName: Run Tests |
| 335 | + inputs: |
| 336 | + testAssemblyVer2: |- |
| 337 | + out\binaries\GoogleTestAdapter\Release\**\*.Tests.*dll |
| 338 | + **\*.Tests.Common.*dll |
| 339 | + vsTestVersion: 15.0 |
| 340 | + runInParallel: false |
| 341 | + diagnosticsEnabled: True |
| 342 | + continueOnError: true |
| 343 | + - task: 1ES.MicroBuildVstsDrop@1 |
| 344 | + condition: eq('${{ parameters.IsProd }}', true) |
| 345 | + displayName: Upload VSTS Drop |
| 346 | + inputs: |
| 347 | + dropFolder: $(Build.ArtifactStagingDirectory)\drop |
| 348 | + dropName: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber) |
| 349 | + accessToken: $(System.AccessToken) |
| 350 | + dropServiceUri: https://devdiv.artifacts.visualstudio.com/DefaultCollection |
| 351 | + vsDropServiceUri: "https://vsdrop.corp.microsoft.com/file/v1" |
| 352 | + - task: ms-vseng.MicroBuildShipTasks.4a4e1dc3-01d0-484f-94ac-f918aaf7d509.MicroBuildRetainVstsDrops@1 |
| 353 | + displayName: Retain VSTS Drops |
| 354 | + condition: and(succeeded(), eq(variables['RetainBuild'], true)) |
| 355 | + inputs: |
| 356 | + DropNames: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber) |
| 357 | + AccessToken: $(System.AccessToken) |
| 358 | + DropServiceUri: https://devdiv.artifacts.visualstudio.com/DefaultCollection |
| 359 | + - task: ms-vseng.MicroBuildShipTasks.0ffdda1d-8c7b-40da-b8b1-061660eaeea3.MicroBuildArchiveSymbols@5 |
| 360 | + displayName: 'Archive TestAdapterForGoogleTest on Symweb' |
| 361 | + condition: eq (variables.ArchiveSymbols, True) |
| 362 | + inputs: |
| 363 | + SymbolsFeatureName: TestAdapterForGoogleTest |
| 364 | + SymbolsProject: VS |
| 365 | + SymbolsAgentPath: '$(Build.ArtifactStagingDirectory)\drop' |
| 366 | + - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 |
| 367 | + displayName: 'Send Telemetry' |
| 368 | + condition: eq (variables.ArchiveSymbols, True) |
| 369 | + - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 |
| 370 | + displayName: Perform Cleanup Tasks |
| 371 | + condition: always() |
0 commit comments