WindowsAppSDK/build/ProjectReunion-CI.yml

234 строки
6.8 KiB
YAML

# see https://docs.microsoft.com/azure/devops/pipelines/process/phases for info on yaml ADO jobs
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
variables:
- template: WindowsAppSDK-Versions.yml
- template: WindowsAppSDK-CommonVariables.yml
- name: buildOutputDir
value: $(Build.SourcesDirectory)\BuildOutput
jobs:
- job: PreChecks
pool:
vmImage: 'windows-2022'
steps:
- task: PowerShell@2
displayName: 'Smoke test props and targets in \build\NuSpecs'
inputs:
targetType: 'inline'
script: |
$targetPaths = "$(Build.SourcesDirectory)\build\NuSpecs\*.targets"
$propPaths = "$(Build.SourcesDirectory)\build\NuSpecs\*.props"
Get-ChildItem $targetPaths | ForEach-Object { $_.Name; [xml](Get-Content $_) | Out-Null }
Get-ChildItem $propPaths | ForEach-Object { $_.Name; [xml](Get-Content $_) | Out-Null }
failOnStderr: true
# Scans the root source folder for security vulnerability
- task: CredScan@2
inputs:
toolMajorVersion: 'V2'
# This PostAnalysis will fail the pipeline if CredScan identifies an issue
- task: PostAnalysis@1
inputs:
AllTools: false
APIScan: false
BinSkim: false
CodesignValidation: false
CredScan: true
FortifySCA: false
FxCop: false
ModernCop: false
PoliCheck: false
RoslynAnalyzers: false
SDLNativeRules: false
Semmle: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
- job: VerifyCopyrightHeaders
pool:
vmImage: 'windows-2022'
steps:
- task: powershell@2
displayName: 'Verify copyright headers'
inputs:
targetType: filePath
filePath: tools\VerifyCopyrightHeaders.ps1
- job: Build
pool:
vmImage: 'windows-2022'
timeoutInMinutes: 120
strategy:
maxParallel: 10
matrix:
Debug_x86:
buildPlatform: 'x86'
buildConfiguration: 'Debug'
Release_x86:
buildPlatform: 'x86'
buildConfiguration: 'Release'
PGOBuildMode: 'Optimize'
Release_x64:
buildPlatform: 'x64'
buildConfiguration: 'Release'
PGOBuildMode: 'Optimize'
Release_Arm64:
buildPlatform: 'arm64'
buildConfiguration: 'Release'
steps:
# Required by the Packaged ES SDL Templates.
- checkout: self
persistCredentials: true
- task: NuGetToolInstaller@1
- template: AzurePipelinesTemplates\WindowsAppSDK-SetupBuildEnvironment-Steps.yml
- task: PowerShell@2
name: BuildBinaries
inputs:
filePath: 'BuildTransportPackage.ps1'
arguments: -Platform "$(buildPlatform)" -Configuration "$(buildConfiguration)" -AzureBuildStep "BuildBinaries"
- task: PublishBuildArtifacts@1
displayName: 'Publish artifact: Full Nuget'
inputs:
PathtoPublish: '$(build.SourcesDirectory)\BuildOutput'
artifactName: 'BuildOutput'
- job: BuildAnyCPU
pool:
vmImage: 'windows-2022'
steps:
- task: NuGetToolInstaller@1
- template: AzurePipelinesTemplates\WindowsAppSDK-SetupBuildEnvironment-Steps.yml
- task: PowerShell@2
name: BuildBinaries
inputs:
filePath: 'BuildTransportPackage.ps1'
arguments: -AzureBuildStep "BuildAnyCPU"
- task: PublishBuildArtifacts@1
displayName: 'Publish artifact: Full Nuget'
inputs:
PathtoPublish: '$(build.SourcesDirectory)\BuildOutput'
artifactName: 'BuildOutput'
- job: BuildMRT
pool:
vmImage: 'windows-2022'
strategy:
maxParallel: 10
matrix:
Release_x86:
buildPlatform: 'x86'
buildConfiguration: 'Release'
Release_x64:
buildPlatform: 'x64'
buildConfiguration: 'Release'
Release_Arm64:
buildPlatform: 'ARM64'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- template: AzurePipelinesTemplates\WindowsAppSDK-BuildAndTestMRT-Steps.yml
- task: PublishBuildArtifacts@1
displayName: 'Publish BuildOutput'
inputs:
artifactName: BuildOutput
PathtoPublish: '$(buildOutputDir)'
- template: AzurePipelinesTemplates\WindowsAppSDK-RunHelixTests-Job.yml
parameters:
name: 'RunTestsInHelix'
dependsOn:
- Build
- BuildMRT
condition: in(dependencies.Build.result, 'Succeeded', 'SucceededWithIssues')
- job: StageAndPack
pool:
vmImage: 'windows-2022'
timeoutInMinutes: 120
dependsOn:
- Build
- BuildMRT
steps:
- task: DownloadBuildArtifacts@0
inputs:
artifactName: BuildOutput
downloadPath: '$(Build.SourcesDirectory)'
- task: PowerShell@2
name: StageFiles
inputs:
filePath: 'BuildTransportPackage.ps1'
arguments: -Platform "x86,x64,arm64" -Configuration "release" -AzureBuildStep "StageFiles"
- task: PowerShell@2
name: SetVersion
displayName: Update metapackage version
inputs:
targetType: 'inline'
script: |
$packageVersion = '$(version)'
$pipelineType = '$(PipelineType)'
$sourceBranchName = '$(Build.SourceBranchName)'
if ($sourceBranchName -eq 'main' -or $sourceBranchName -eq 'develop')
{
$packageVersion = $packageVersion + '.' + $sourceBranchName + '.' + $pipelineType
}
Write-Host "##vso[task.setvariable variable=packageVersion;]$packageVersion"
Write-Host $packageVersion
[xml]$publicNuspec = Get-Content -Path $(Build.SourcesDirectory)\build\NuSpecs\Microsoft.WindowsAppSDK.Foundation.nuspec
$publicNuspec.package.metadata.version = $packageVersion
Set-Content -Value $publicNuspec.OuterXml $(Build.SourcesDirectory)\build\NuSpecs\Microsoft.WindowsAppSDK.Foundation.nuspec
- task: PowerShell@2
name: PackNuget
inputs:
filePath: 'BuildTransportPackage.ps1'
arguments: -Platform "x64" -Configuration "release" -AzureBuildStep "PackNuget" -OutputDirectory "$(build.artifactStagingDirectory)\FullNuget" -PackageVersion "$(packageVersion)"
- task: BinSkim@3
inputs:
InputType: 'Basic'
Function: 'analyze'
AnalyzeTarget: '$(build.SourcesDirectory)\BuildOutput\FullNuget\*.dll;$(build.SourcesDirectory)\BuildOutput\FullNuget\*.exe'
AnalyzeVerbose: true
- task: PostAnalysis@1
inputs:
AllTools: false
APIScan: false
BinSkim: true
BinSkimBreakOn: 'Error'
CodesignValidation: false
CredScan: false
FortifySCA: false
FxCop: false
ModernCop: false
PoliCheck: false
RoslynAnalyzers: false
SDLNativeRules: false
Semmle: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifact: NugetContent'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\BuildOutput\FullNuget'
artifactName: 'NugetContent'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifact: TransportPackage'
inputs:
PathtoPublish: '$(build.artifactStagingDirectory)\FullNuget'
artifactName: 'TransportPackage'