Skip to content

Performance Optimization for Foundation Build Pipeline: Break down build and test stage per platform #5363

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

haonanttt
Copy link
Contributor

@haonanttt haonanttt commented Apr 25, 2025

Original "Build" stage run x86, x64 and arm64 together. "Test" stage will start when all build finished.

This PR break down the "Build" stage and "Test" stage into platform specific stages. For each platform, test will only depend on specific platform's build - Test_x86 will only depend on Build_x86, etc.

//////////////
A microsoft employee must use /azp run to validate using the pipelines below.

WARNING:
Comments made by azure-pipelines bot maybe inaccurate.
Please see pipeline link to verify that the build is being ran.

For status checks on the main branch, please use TransportPackage-Foundation-PR
(https://microsoft.visualstudio.com/ProjectReunion/_build?definitionId=81063&_a=summary)
and run the build against your PR branch with the default parameters.

@haonanttt haonanttt changed the base branch from user/hnmy/pipelineModify to main April 25, 2025 02:59
@haonanttt haonanttt changed the title User/haonanttt/test stage separation Performance Optimization for Foundation Build Pipeline: Break down build and test stage per platform Apr 25, 2025
@haonanttt
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@haonanttt haonanttt requested a review from Hong-Xiang April 25, 2025 06:32
@haonanttt
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@haonanttt
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Haonan Tang (from Dev Box) added 2 commits April 27, 2025 14:47
@haonanttt
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yeelam-gordon yeelam-gordon requested a review from Copilot April 29, 2025 08:24
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the build pipeline by breaking down the build and test stages into platform‐specific jobs, ensuring test jobs only run after their corresponding build stage has succeeded. Key changes include:

  • Injecting a test matrix parameter into multiple YAML definitions.
  • Splitting the unified test stage into Test_x86, Test_x64, and Test_arm64 stages.
  • Introducing a new build-per-platform template that replaces portions of the existing build stage.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
build/WindowsAppSDK-Foundation-PR.yml Injects testMatrix parameter for test stage configuration.
build/WindowsAppSDK-Foundation-Official.yml Passes testMatrix parameter to the test stage.
build/WindowsAppSDK-Foundation-Nightly.yml Passes testMatrix parameter to the test stage.
build/ProjectReunion-BuildFoundation.yml Adds testMatrix parameter for platform-specific testing.
build/AzurePipelinesTemplates/WindowsAppSDK-Test-Stage.yml Splits the Test stage into three platform-specific stages using the new parameter.
build/AzurePipelinesTemplates/WindowsAppSDK-RunTestsInPipeline-Job.yml Updates the test job to use a filtered testMatrix keyed by platform.
build/AzurePipelinesTemplates/WindowsAppSDK-Publish-Stage.yml Adjusts dependencies to account for the new test stage splits.
build/AzurePipelinesTemplates/WindowsAppSDK-PackTransportPackage-Stage.yml Updates build dependencies to include new build stage names.
build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml Transitions build jobs to use the new per-platform build template.
build/AzurePipelinesTemplates/WindowsAppSDK-Build-Per-Platform-Stage.yml New template that defines build stages per platform with associated parameters.
Comments suppressed due to low confidence (2)

build/AzurePipelinesTemplates/WindowsAppSDK-Build-Per-Platform-Stage.yml:16

  • [nitpick] Ensure that the generated stage name using 'Build_{buildPlatform}' is consistent with all other pipeline references and related documentation for clarity.
stage: ${{ format('Build_{0}', parameters.buildPlatform) }}

build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml:67

  • Verify whether legacy job definitions (e.g. BuildFoundation_release_anycpu) are still required after transitioning to the new per-platform build template. Removing redundant jobs can help avoid duplicate builds.
# extract BuildFoundation and BuildMRT into WindowsAppSDK-Build-Stage-Per-Platform.yml.

strategy:
matrix: ${{ parameters.testMatrix }}
matrix: $[ dependencies.FilterMatrix.outputs['setFilteredMatrixStep.filteredMatrixJson'] ]
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.

Ensure that the JSON output from the FilterMatrix step is correctly parsed as an object for the matrix. If the value is a JSON string, consider converting it to the proper object type so that the downstream job receives the expected structure.

Suggested change
matrix: $[ dependencies.FilterMatrix.outputs['setFilteredMatrixStep.filteredMatrixJson'] ]
matrix: $[ fromJson(dependencies.FilterMatrix.outputs['setFilteredMatrixStep.filteredMatrixJson']) ]

Copilot uses AI. Check for mistakes.

@haonanttt
Copy link
Contributor Author

haonanttt commented Apr 29, 2025

Copy link

@yeelam-gordon yeelam-gordon left a comment

Choose a reason for hiding this comment

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

Looks good overall.
This one will make the pipeline more resumable.
And with Muyuan's #5364, the performance is better.

- script: |
md "C:\__t\NativeCompilerPrefast"
displayName: 'Creating C:\__t\NativeCompilerPrefast to prevent errors from Guardian PREfast'

- job: BuildFoundation_release_anycpu

Choose a reason for hiding this comment

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

Do you know what is this for int the past? Looks like no consumer for this result afterwards?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the reason is that we wanted to build Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj in AnyCPU.

It does seem like we have a consumer here

    Copy-Item -path "BuildOutput\$configurationForMrtAndAnyCPU\anycpu\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.dll"  -destination "$BasePath\lib\net6.0-windows10.0.17763.0"

in line 326 of
WindowsAppSDK\WindowsAppSDK\BuildAll.ps1

strategy:
matrix: ${{ parameters.testMatrix }}
matrix: $[ dependencies.FilterMatrix.outputs['setFilteredMatrixStep.filteredMatrixJson'] ]

Choose a reason for hiding this comment

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

I just feel this name has too many related "verb" for "Filter"? (like filter many times)

Can we just talk what we just did here?
I think this step is "Extract matrix as json value filtering by build platform"?

Can it be like "dependecies.ExtracMatrix.outputs['filteredByBuildPlatform.valueAsJson']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants