Skip to content

Pipeline Performance Optimization: Make Static Analysis Run Parallelly with Build #5364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
023fec6
separate build per platform
Apr 23, 2025
2baca33
debug
Apr 23, 2025
157a19d
debug
Apr 23, 2025
ffeb5be
separate test per platform
Apr 23, 2025
bce4627
modify nightly and official pipeline
Apr 23, 2025
a96b6bd
specify pool for FilterMatrix job
Apr 24, 2025
0e52f02
specify pool
Apr 24, 2025
bb71b0e
add comments
Apr 25, 2025
10b03e5
rename yml file and pass runStaticAnalysis parameter into WindowsAppS…
Apr 25, 2025
7dc760c
change
MuyuanMS Apr 25, 2025
12c37d2
Merge branch 'user/haonanttt/testStageSeparation' into user/muyuanli/…
MuyuanMS Apr 25, 2025
91d4b00
duplicate stage name fix
MuyuanMS Apr 25, 2025
b8e0e96
update dependency for Build_AnyCPU
Apr 25, 2025
d2eb3d6
resolve conflict
MuyuanMS Apr 25, 2025
b68653e
minor syntax fix
MuyuanMS Apr 25, 2025
780b760
resolve comments on formatting
MuyuanMS Apr 28, 2025
e6c6265
resolve merge conflicts
MuyuanMS May 2, 2025
6fdbe5d
run prefast for all arch
MuyuanMS May 2, 2025
e709270
test run for static analysis for all archs
MuyuanMS May 2, 2025
95a0d97
fix errors testing prefast for all arch
MuyuanMS May 2, 2025
92442c2
separate out PREfast and only runs for x64
MuyuanMS May 7, 2025
6cb036d
clean up unused parameter
MuyuanMS May 7, 2025
1b6a1f2
delete unwanted typo
MuyuanMS May 7, 2025
ce887fb
Merge branch 'main' into user/muyuanli/parallelAnalysis
MuyuanMS May 7, 2025
2a1f1af
rebase to main
MuyuanMS May 7, 2025
a7611e8
debug
Apr 23, 2025
b5eb161
change
MuyuanMS Apr 25, 2025
a63c3eb
rename yml file and pass runStaticAnalysis parameter into WindowsAppS…
Apr 25, 2025
d840e88
resolve comments on formatting
MuyuanMS Apr 28, 2025
b41e43a
run prefast for all arch
MuyuanMS May 2, 2025
00b80f4
test run for static analysis for all archs
MuyuanMS May 2, 2025
1fd2dfe
fix errors testing prefast for all arch
MuyuanMS May 2, 2025
e758afe
separate out PREfast and only runs for x64
MuyuanMS May 7, 2025
b24a7c0
clean up unused parameter
MuyuanMS May 7, 2025
bcb2827
delete unwanted typo
MuyuanMS May 7, 2025
a5b2497
rebase to main
MuyuanMS May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
parameters:
- name: "SignOutput"
type: boolean
default: false
- name: "IsOneBranch"
type: boolean
default: true
- name: runStaticAnalysis
type: boolean
default: true
- name: buildPlatform
type: string
default: x64

stages:
- stage: ${{ format(iif(parameters.runStaticAnalysis, 'Build_{0}_StaticAnalysis', 'Build_{0}'), parameters.buildPlatform) }}
# Skip the build job if we are reusing the output of a previous build.
# useBuildOutputFromBuildId variable is set on the Pipeline at Queue time.
condition:
eq(variables['useBuildOutputFromBuildId'],'')
dependsOn: []
jobs:
- job: BuildFoundation
pool:
${{ if parameters.IsOneBranch }}:
type: windows
${{ if not( parameters.IsOneBranch ) }}:
type: windows
isCustom: true
name: 'ProjectReunionESPool-2022'
timeoutInMinutes: 120
strategy:
maxParallel: 10
matrix:
${{ format('Release_{0}', parameters.buildPlatform) }}:
${{ if ne(parameters.buildPlatform, 'arm64') }}:
buildPlatform: ${{ parameters.buildPlatform }}
buildConfiguration: 'release'
normalizedConfiguration: 'fre'
PGOBuildMode: 'Optimize'
${{ else }}:
buildPlatform: ${{ parameters.buildPlatform }}
buildConfiguration: 'release'
normalizedConfiguration: 'fre'
variables:
- name: ob_outputDirectory
value: '$(REPOROOT)\out'
- name: ob_sdl_codeSignValidation_excludes
value: '-|**\Release\**;-|**\packages\**'
- name: ob_artifactBaseName
value: "FoundationBinaries_$(buildConfiguration)_$(buildPlatform)"
- name: ob_sdl_apiscan_enabled
${{ if parameters.runStaticAnalysis }}:
value: true
${{ else }}:
value: false
- name: ob_sdl_apiscan_softwareFolder
value: '$(build.SourcesDirectory)\APIScanTarget'
- name: ob_sdl_apiscan_symbolsFolder
value: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net'
- template: AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKConfigSourceBranch
- name: localCompilerOverridePackageName
value: $[coalesce(variables.compilerOverridePackageName, variables.global_CompilerOverridePackageName)]
- name: localCompilerOverridePackageVersion
value: $[coalesce(variables.compilerOverridePackageVersion, variables.global_CompilerOverridePackageVersion)]
- name: localCompilerOverrideNupkgVersion
value: $[coalesce(variables.compilerOverrideNupkgVersion, variables.global_CompilerOverrideNupkgVersion)]
steps:
- script: |
echo Build.SourceBranch=$(Build.SourceBranch)
echo Build.Reason=$(Build.Reason)
echo compilerOverridePackageName=$(compilerOverridePackageName)
echo compilerOverridePackageVersion=$(compilerOverridePackageVersion)
echo global_CompilerOverridePackageName=$(global_CompilerOverridePackageName)
echo global_CompilerOverridePackageVersion=$(global_CompilerOverridePackageVersion)
echo localCompilerOverridePackageName=$(localCompilerOverridePackageName)
echo localCompilerOverridePackageVersion=$(localCompilerOverridePackageVersion)
echo localCompilerOverrideNupkgVersion=$(localCompilerOverrideNupkgVersion)
echo System.PullRequest.targetBranchName=$(System.PullRequest.targetBranchName)
echo mySourceBranch=$(mySourceBranch)

- template: WindowsAppSDK-BuildFoundation-Steps.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}

# This is a temporarily workaround to avoid getting non-fatal "folder C:\__t\NativeCompilerPrefast not found"
# errors from the Guardian PREfast task, which shouldn't even be run in the first place, because its pre-
# requisite of isNative=true isn't met currently.
- script: |
md "C:\__t\NativeCompilerPrefast"
displayName: 'Creating C:\__t\NativeCompilerPrefast to prevent errors from Guardian PREfast'

- job: BuildMRT
pool:
# read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
${{ if parameters.IsOneBranch }}:
type: windows
${{ if not( parameters.IsOneBranch ) }}:
type: windows
isCustom: true
name: 'ProjectReunionESPool-2022'
timeoutInMinutes: 120
strategy:
maxParallel: 10
matrix:
${{ format('Release_{0}', parameters.buildPlatform) }}:
${{ if ne(parameters.buildPlatform, 'arm64') }}:
buildPlatform: ${{ parameters.buildPlatform }}
buildConfiguration: 'Release'
normalizedConfiguration: 'fre'
PGOBuildMode: 'Optimize'
${{ else }}:
buildPlatform: ${{ parameters.buildPlatform }}
buildConfiguration: 'Release'
normalizedConfiguration: 'fre'
variables:
- name: ob_outputDirectory
value: '$(REPOROOT)\out'
- name: ob_sdl_codeSignValidation_excludes
value: '-|**\Release\**'
- name: ob_sdl_suppression_suppressionSet
value: default
- name: ob_artifactBaseName
value: "MrtBinaries_$(buildConfiguration)_$(buildPlatform)"
- name: ob_sdl_apiscan_enabled
${{ if parameters.runStaticAnalysis }}:
value: true
${{ else }}:
value: false
- name: ob_sdl_apiscan_softwareFolder
value: '$(build.SourcesDirectory)\APIScanTarget'
- name: ob_sdl_apiscan_symbolsFolder
value: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net'
- template: AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKConfigSourceBranch
- name: localCompilerOverridePackageName
value: $[coalesce(variables.compilerOverridePackageName, variables.global_CompilerOverridePackageName)]
- name: localCompilerOverridePackageVersion
value: $[coalesce(variables.compilerOverridePackageVersion, variables.global_CompilerOverridePackageVersion)]
- name: localCompilerOverrideNupkgVersion
value: $[coalesce(variables.compilerOverrideNupkgVersion, variables.global_CompilerOverrideNupkgVersion)]
steps:
- script: |
echo Build.SourceBranch=$(Build.SourceBranch)
echo Build.Reason=$(Build.Reason)
echo compilerOverridePackageName=$(compilerOverridePackageName)
echo compilerOverridePackageVersion=$(compilerOverridePackageVersion)
echo global_CompilerOverridePackageName=$(global_CompilerOverridePackageName)
echo global_CompilerOverridePackageVersion=$(global_CompilerOverridePackageVersion)
echo localCompilerOverridePackageName=$(localCompilerOverridePackageName)
echo localCompilerOverridePackageVersion=$(localCompilerOverridePackageVersion)
echo localCompilerOverrideNupkgVersion=$(localCompilerOverrideNupkgVersion)
echo System.PullRequest.targetBranchName=$(System.PullRequest.targetBranchName)
echo mySourceBranch=$(mySourceBranch)

- template: WindowsAppSDK-BuildMRT-Steps.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}

# This is a temporarily workaround to avoid getting non-fatal "folder C:\__t\NativeCompilerPrefast not found"
# errors from the Guardian PREfast task, which shouldn't even be run in the first place, because its pre-
# requisite of isNative=true isn't met currently.
- script: |
md "C:\__t\NativeCompilerPrefast"
displayName: 'Creating C:\__t\NativeCompilerPrefast to prevent errors from Guardian PREfast'
173 changes: 20 additions & 153 deletions build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:
default: true

stages:
- stage: Build
- stage: ${{ iif(parameters.runStaticAnalysis, 'Build_AnyCPU_StaticAnalysis', 'Build_AnyCPU') }}
# Skip the build job if we are reusing the output of a previous build.
# useBuildOutputFromBuildId variable is set on the Pipeline at Queue time.
condition:
Expand All @@ -30,82 +30,6 @@ stages:
targetType: filePath
filePath: tools\VerifyCopyrightHeaders.ps1

- job: BuildFoundation
pool:
${{ if parameters.IsOneBranch }}:
type: windows
${{ if not( parameters.IsOneBranch ) }}:
type: windows
isCustom: true
name: 'ProjectReunionESPool-2022'
timeoutInMinutes: 120
strategy:
maxParallel: 10
matrix:
Release_x86:
buildPlatform: 'x86'
buildConfiguration: 'release'
normalizedConfiguration: 'fre'
PGOBuildMode: 'Optimize'
Release_x64:
buildPlatform: 'x64'
buildConfiguration: 'release'
normalizedConfiguration: 'fre'
PGOBuildMode: 'Optimize'
Release_Arm64:
buildPlatform: 'arm64'
buildConfiguration: 'release'
normalizedConfiguration: 'fre'
variables:
- name: ob_outputDirectory
value: '$(REPOROOT)\out'
- name: ob_sdl_codeSignValidation_excludes
value: '-|**\Release\**;-|**\packages\**'
- name: ob_artifactBaseName
value: "FoundationBinaries_$(buildConfiguration)_$(buildPlatform)"
- name: ob_sdl_apiscan_enabled
${{ if parameters.runStaticAnalysis }}:
value: true
${{ else }}:
value: false
- name: ob_sdl_apiscan_softwareFolder
value: '$(build.SourcesDirectory)\APIScanTarget'
- name: ob_sdl_apiscan_symbolsFolder
value: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net'
- template: AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKConfigSourceBranch
- name: localCompilerOverridePackageName
value: $[coalesce(variables.compilerOverridePackageName, variables.global_CompilerOverridePackageName)]
- name: localCompilerOverridePackageVersion
value: $[coalesce(variables.compilerOverridePackageVersion, variables.global_CompilerOverridePackageVersion)]
- name: localCompilerOverrideNupkgVersion
value: $[coalesce(variables.compilerOverrideNupkgVersion, variables.global_CompilerOverrideNupkgVersion)]
steps:
- script: |
echo Build.SourceBranch=$(Build.SourceBranch)
echo Build.Reason=$(Build.Reason)
echo compilerOverridePackageName=$(compilerOverridePackageName)
echo compilerOverridePackageVersion=$(compilerOverridePackageVersion)
echo global_CompilerOverridePackageName=$(global_CompilerOverridePackageName)
echo global_CompilerOverridePackageVersion=$(global_CompilerOverridePackageVersion)
echo localCompilerOverridePackageName=$(localCompilerOverridePackageName)
echo localCompilerOverridePackageVersion=$(localCompilerOverridePackageVersion)
echo localCompilerOverrideNupkgVersion=$(localCompilerOverrideNupkgVersion)
echo System.PullRequest.targetBranchName=$(System.PullRequest.targetBranchName)
echo mySourceBranch=$(mySourceBranch)

- template: WindowsAppSDK-BuildFoundation-Steps.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}

# This is a temporarily workaround to avoid getting non-fatal "folder C:\__t\NativeCompilerPrefast not found"
# errors from the Guardian PREfast task, which shouldn't even be run in the first place, because its pre-
# requisite of isNative=true isn't met currently.
- script: |
md "C:\__t\NativeCompilerPrefast"
displayName: 'Creating C:\__t\NativeCompilerPrefast to prevent errors from Guardian PREfast'

- job: BuildFoundation_release_anycpu
# For now, this job just builds Microsoft.WindowsAppRuntime.Bootstrap.Net.dll in AnyCPU
# Can be expanded to add any other binary as needed
Expand Down Expand Up @@ -140,81 +64,24 @@ stages:
md "C:\__t\NativeCompilerPrefast"
displayName: 'Creating C:\__t\NativeCompilerPrefast to prevent errors from Guardian PREfast'

- job: BuildMRT
pool:
# read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
${{ if parameters.IsOneBranch }}:
type: windows
${{ if not( parameters.IsOneBranch ) }}:
type: windows
isCustom: true
name: 'ProjectReunionESPool-2022'
timeoutInMinutes: 120
strategy:
maxParallel: 10
matrix:
Release_x86:
buildPlatform: 'x86'
buildConfiguration: 'Release'
normalizedConfiguration: 'fre'
PGOBuildMode: 'Optimize'
Release_x64:
buildPlatform: 'x64'
buildConfiguration: 'Release'
normalizedConfiguration: 'fre'
PGOBuildMode: 'Optimize'
Release_Arm64:
buildPlatform: 'arm64'
buildConfiguration: 'Release'
normalizedConfiguration: 'fre'
variables:
- name: ob_outputDirectory
value: '$(REPOROOT)\out'
- name: ob_sdl_codeSignValidation_excludes
value: '-|**\Release\**'
- name: ob_sdl_suppression_suppressionSet
value: default
- name: ob_artifactBaseName
value: "MrtBinaries_$(buildConfiguration)_$(buildPlatform)"
- name: ob_sdl_apiscan_enabled
${{ if parameters.runStaticAnalysis }}:
value: true
${{ else }}:
value: false
- name: ob_sdl_apiscan_softwareFolder
value: '$(build.SourcesDirectory)\APIScanTarget'
- name: ob_sdl_apiscan_symbolsFolder
value: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net'
- template: AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKConfigSourceBranch
- name: localCompilerOverridePackageName
value: $[coalesce(variables.compilerOverridePackageName, variables.global_CompilerOverridePackageName)]
- name: localCompilerOverridePackageVersion
value: $[coalesce(variables.compilerOverridePackageVersion, variables.global_CompilerOverridePackageVersion)]
- name: localCompilerOverrideNupkgVersion
value: $[coalesce(variables.compilerOverrideNupkgVersion, variables.global_CompilerOverrideNupkgVersion)]
steps:
- script: |
echo Build.SourceBranch=$(Build.SourceBranch)
echo Build.Reason=$(Build.Reason)
echo compilerOverridePackageName=$(compilerOverridePackageName)
echo compilerOverridePackageVersion=$(compilerOverridePackageVersion)
echo global_CompilerOverridePackageName=$(global_CompilerOverridePackageName)
echo global_CompilerOverridePackageVersion=$(global_CompilerOverridePackageVersion)
echo localCompilerOverridePackageName=$(localCompilerOverridePackageName)
echo localCompilerOverridePackageVersion=$(localCompilerOverridePackageVersion)
echo localCompilerOverrideNupkgVersion=$(localCompilerOverrideNupkgVersion)
echo System.PullRequest.targetBranchName=$(System.PullRequest.targetBranchName)
echo mySourceBranch=$(mySourceBranch)
# extract BuildFoundation and BuildMRT into WindowsAppSDK-Build-Stage-Per-Platform.yml. Separate the build stage per platform
- template: WindowsAppSDK-Build-Per-Platform-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
BuildPlatform: x86

- template: WindowsAppSDK-BuildMRT-Steps.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
- template: WindowsAppSDK-Build-Per-Platform-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
BuildPlatform: x64

# This is a temporarily workaround to avoid getting non-fatal "folder C:\__t\NativeCompilerPrefast not found"
# errors from the Guardian PREfast task, which shouldn't even be run in the first place, because its pre-
# requisite of isNative=true isn't met currently.
- script: |
md "C:\__t\NativeCompilerPrefast"
displayName: 'Creating C:\__t\NativeCompilerPrefast to prevent errors from Guardian PREfast'
- template: WindowsAppSDK-Build-Per-Platform-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
BuildPlatform: arm64
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ parameters:

stages:
- stage: Pack
dependsOn: Build
dependsOn:
- Build_AnyCPU
- Build_x86
- Build_x64
- Build_arm64
condition:
eq(variables['useBuildOutputFromBuildId'],'')
jobs:
Expand Down Expand Up @@ -202,4 +206,4 @@ stages:
verbosityPush: 'Detailed'
nuGetFeedType: 'internal'
#Note: The project qualifier is always required when using a feed name. Also, do not use organization scoped feeds.
publishVstsFeed: 'ProjectReunion/Project.Reunion.nuget.internal'
publishVstsFeed: 'ProjectReunion/Project.Reunion.nuget.internal'
Loading