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 all 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
Expand Up @@ -5,15 +5,18 @@ parameters:
- name: "IsOneBranch"
type: boolean
default: true
- name: runStaticAnalysis
- name: runApiScan
type: boolean
default: true
- name: runPREfast
type: boolean
default: false
- name: buildPlatform
type: string
default: x64

stages:
- stage: ${{ format('Build_{0}', parameters.buildPlatform) }}
- stage: ${{ format(iif(parameters.runPREfast, 'PREfast_{0}', '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:
Expand Down Expand Up @@ -50,7 +53,7 @@ stages:
- name: ob_artifactBaseName
value: "FoundationBinaries_$(buildConfiguration)_$(buildPlatform)"
- name: ob_sdl_apiscan_enabled
${{ if parameters.runStaticAnalysis }}:
${{ if parameters.runApiScan }}:
value: true
${{ else }}:
value: false
Expand Down Expand Up @@ -83,7 +86,8 @@ stages:
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
runApiScan: ${{ parameters.runApiScan }}
runPREfast: ${{ parameters.runPREfast }}

# 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-
Expand Down Expand Up @@ -125,7 +129,7 @@ stages:
- name: ob_artifactBaseName
value: "MrtBinaries_$(buildConfiguration)_$(buildPlatform)"
- name: ob_sdl_apiscan_enabled
${{ if parameters.runStaticAnalysis }}:
${{ if parameters.runApiScan }}:
value: true
${{ else }}:
value: false
Expand Down Expand Up @@ -158,7 +162,8 @@ stages:
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
runPREfast : ${{ parameters.runPREfast }}
runApiScan : ${{ parameters.runApiScan }}

# 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-
Expand Down
44 changes: 26 additions & 18 deletions build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ parameters:
- name: "IsOneBranch"
type: boolean
default: true
- name: runStaticAnalysis
- name: runApiScan
type: boolean
default: true
- name: runPREfast
type: boolean
default: false

stages:
- stage: Build_AnyCPU
- stage: ${{ iif(parameters.runPREfast, 'PREfast_AnyCPU', '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 Down Expand Up @@ -44,9 +47,9 @@ stages:
ob_outputDirectory: '$(REPOROOT)\out'
ob_sdl_codeSignValidation_excludes: '-|**\Release\**'
ob_artifactBaseName: "FoundationBinaries_release_anycpu"
${{ if parameters.runStaticAnalysis }}:
${{ if parameters.runApiScan }}:
ob_sdl_apiscan_enabled: true
${{ if not( parameters.runStaticAnalysis ) }}:
${{ if not( parameters.runApiScan ) }}:
ob_sdl_apiscan_enabled: false
ob_sdl_apiscan_softwareFolder: '$(build.SourcesDirectory)\BuildOutput\Release\AnyCPU'
ob_sdl_apiscan_symbolsFolder: '$(build.SourcesDirectory)\BuildOutput\Release\AnyCPU;SRV*https://symweb.azurefd.net'
Expand All @@ -55,7 +58,7 @@ stages:
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
runPREfast : ${{ parameters.runPREfast }}

# 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-
Expand All @@ -65,23 +68,28 @@ stages:
displayName: 'Creating C:\__t\NativeCompilerPrefast to prevent errors from Guardian PREfast'

# 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-Build-Per-Platform-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
runPREfast : ${{ parameters.runPREfast }}
runApiScan : ${{ parameters.runApiScan }}
BuildPlatform: x64

- template: WindowsAppSDK-Build-Per-Platform-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
BuildPlatform: arm64
- ${{ if not(parameters.runPREfast) }}:
- template: WindowsAppSDK-Build-Per-Platform-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runPREfast : ${{ parameters.runPREfast }}
runApiScan : ${{ parameters.runApiScan }}
BuildPlatform: x86

- template: WindowsAppSDK-Build-Per-Platform-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
IsOneBranch: ${{ parameters.IsOneBranch }}
runPREfast : ${{ parameters.runPREfast }}
runApiScan : ${{ parameters.runApiScan }}
BuildPlatform: arm64
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ parameters:
- name: "IsOneBranch"
type: boolean
default: true
- name: runStaticAnalysis
- name: runPREfast
type: boolean
default: true
default: false

steps:
- task: NuGetAuthenticate@1
Expand All @@ -30,7 +30,7 @@ steps:
filePath: 'BuildAll.ps1'
arguments: -AzureBuildStep "BuildAnyCPU"

- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
- ${{ if eq(parameters.runPREfast, 'true') }}:
- task: SDLNativeRules@3
displayName: Run PREfast SDL Native Rules
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ parameters:
- name: "IsOneBranch"
type: boolean
default: true
- name: runStaticAnalysis
- name: runApiScan
type: boolean
default: true
- name: runPREfast
type: boolean
default: false

steps:
- task: NuGetAuthenticate@1
Expand Down Expand Up @@ -71,7 +74,7 @@ steps:
filePath: 'BuildAll.ps1'
arguments: -Platform "$(buildPlatform)" -Configuration "$(buildConfiguration)" -AzureBuildStep "BuildFoundation"

- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
- ${{ if eq(parameters.runPREfast, 'true') }}:
- task: SDLNativeRules@3
displayName: Run PREfast SDL Native Rules
condition: and(succeeded(), eq(variables['buildConfiguration'], 'Release'), eq(variables['buildPlatform'], 'x64'))
Expand All @@ -86,6 +89,7 @@ steps:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
continueOnError: true

- ${{ if eq(parameters.runApiScan, 'true') }}:
# Copy build output to folder APIScanTarget for APIScan to scan later, in the mean time, exclude some folders/files.
- task: CopyFiles@2
displayName: Populate APIScanTarget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ parameters:
- name: "IsOneBranch"
type: boolean
default: true
- name: runStaticAnalysis
- name: runApiScan
type: boolean
default: true
- name: runPREfast
type: boolean
default: false

steps:
- template: WindowsAppSDK-SetupBuildEnvironment-Steps.yml
Expand All @@ -32,7 +35,7 @@ steps:
filePath: 'BuildAll.ps1'
arguments: -Platform "$(buildPlatform)" -Configuration "$(buildConfiguration)" -AzureBuildStep "BuildMRT"

- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
- ${{ if eq(parameters.runPREfast, 'true') }}:
- task: SDLNativeRules@3
displayName: Run PREfast SDL Native Rules
condition: and(succeeded(), eq(variables['buildPlatform'], 'x64'), eq(variables['buildConfiguration'], 'Release'))
Expand All @@ -47,6 +50,7 @@ steps:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
continueOnError: true

- ${{ if eq(parameters.runApiScan, 'true') }}:
# Copy build output to folder APIScanTarget for APIScan to scan, in the mean time, exclude some folders/files.
- task: CopyFiles@2
displayName: Populate APIScanTarget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,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'
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ stages:
- template: AzurePipelinesTemplates/WindowsAppSDK-PublishToMaestro-Steps.yml@WindowsAppSDKConfig
parameters:
NuGetArtifactNames:
- 'TransportPackage'
- 'TransportPackage'
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:
buildPlatform: $(buildPlatform)
buildConfiguration: $(buildConfiguration)
testLocale: $(testLocale)
ImageName: $(imageName)
ImageName: $(imageName)
2 changes: 1 addition & 1 deletion build/AzurePipelinesTemplates/WindowsAppSDK-Test-Stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ stages:
parameters:
jobName: PipelineTests
testMatrix: ${{ parameters.testMatrix }} # testMatrix is supplied by WindowsAppSDKConfig/WindowsAppSDK-Foundation-TestConfig.yml
buildPlatform: arm64
buildPlatform: arm64
9 changes: 9 additions & 0 deletions build/ProjectReunion-BuildFoundation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ stages:
parameters:
SignOutput: false
IsOneBranch: false
runApiScan: true
runPREFast: false

- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
parameters:
SignOutput: false
IsOneBranch: false
runApiScan: false
runPREFast: true

- template: AzurePipelinesTemplates\WindowsAppSDK-Test-Stage.yml@self
parameters:
Expand Down
10 changes: 9 additions & 1 deletion build/WindowsAppSDK-Foundation-Nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ extends:
- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
runApiScan: ${{ parameters.runStaticAnalysis }}
runPREFast: false

- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
Copy link
Preview

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing the runStaticAnalysis parameter to the string 'true' may cause type inconsistencies. It's advisable to use a boolean comparison (e.g., eq(parameters.runStaticAnalysis, true)) or a direct check to ensure the condition works as intended.

Suggested change
- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
- ${{ if eq(parameters.runStaticAnalysis, true) }}:

Copilot uses AI. Check for mistakes.

- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
runApiScan: false
runPREFast: true

- template: AzurePipelinesTemplates\WindowsAppSDK-PackTransportPackage-Stage.yml@self
parameters:
Expand Down
11 changes: 10 additions & 1 deletion build/WindowsAppSDK-Foundation-Official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,19 @@ extends:
break: false

stages:

- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
runApiScan: ${{ parameters.runStaticAnalysis }}
runPREFast: false

- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
Copy link
Preview

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition in this file compares a boolean parameter to the string 'true'. For consistency and to avoid potential type issues, please convert the comparison to eq(parameters.runStaticAnalysis, true) or use a direct boolean check.

Suggested change
- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
- ${{ if eq(parameters.runStaticAnalysis, true) }}:

Copilot uses AI. Check for mistakes.

- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
parameters:
SignOutput: ${{ parameters.SignOutput }}
runApiScan: false
runPREFast: true

- template: AzurePipelinesTemplates\WindowsAppSDK-PackTransportPackage-Stage.yml@self
parameters:
Expand Down
10 changes: 9 additions & 1 deletion build/WindowsAppSDK-Foundation-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ extends:
- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
parameters:
SignOutput: false
runStaticAnalysis : ${{ parameters.runStaticAnalysis }}
runApiScan: ${{ parameters.runStaticAnalysis }}
runPREFast: false

- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
Copy link
Preview

Copilot AI Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition compares the boolean parameter runStaticAnalysis to the string 'true', which may lead to type mismatch. Consider using a boolean comparison like eq(parameters.runStaticAnalysis, true) or simply 'if parameters.runStaticAnalysis:' to ensure consistent behavior.

Suggested change
- ${{ if eq(parameters.runStaticAnalysis, 'true') }}:
- ${{ if parameters.runStaticAnalysis }}:

Copilot uses AI. Check for mistakes.

- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
parameters:
SignOutput: false
runApiScan: false
runPREFast: true

- template: AzurePipelinesTemplates\WindowsAppSDK-PackTransportPackage-Stage.yml@self
parameters:
Expand Down
Loading