Skip to content

Only run template tests when templates change #62481

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 5 commits into from
Jun 26, 2025
Merged

Conversation

wtgodbe
Copy link
Member

@wtgodbe wtgodbe commented Jun 26, 2025

Should significantly cut down on the time it takes to run Helix jobs (@BrennanConroy reports almost an hour of time save). Also adds a new job that will only run when the ProjectTemplates folder is touched, which runs just the template tests in Helix.

Note - some template tests run only in the local jobs. Those will still run in all PRs (but those ones are very quick)

@github-actions github-actions bot added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jun 26, 2025
@@ -582,10 +582,10 @@ stages:
/p:VsTestUseMSBuildOutput=false
displayName: Build shared fx
# -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step.
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -all -noBuildRepoTasks -noBuildNative -noBuild -test
Copy link
Member

Choose a reason for hiding this comment

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

🥳

@wtgodbe wtgodbe changed the title Try just running PTemplates in helix Only run template tests when templates change Jun 26, 2025
@wtgodbe wtgodbe marked this pull request as ready for review June 26, 2025 18:56
@wtgodbe wtgodbe requested a review from a team as a code owner June 26, 2025 18:56
@wtgodbe wtgodbe requested a review from BrennanConroy June 26, 2025 18:56
@wtgodbe wtgodbe requested a review from Copilot June 26, 2025 19:00
Copy link
Contributor

@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 adds a targeted Helix job that only runs template tests when files under src/ProjectTemplates change, and updates existing CI pipelines to skip those tests by default.

  • Introduces OnlyTestProjectTemplates MSBuild property and uses it to filter which projects are built/tested.
  • Adds a new Azure pipeline (template-tests-pr.yml) triggered on template folder changes.
  • Updates ci.yml and ci-public.yml to disable template tests by setting RunTemplateTests=false.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
eng/helix/helix.proj Added OnlyTestProjectTemplates condition to include only template test projects.
eng/Build.props Wrapped import of RequiresDelayedBuildProjects.props in the new property condition.
.azure/pipelines/template-tests-pr.yml New pipeline definition to run template tests on PRs touching ProjectTemplates.
.azure/pipelines/ci.yml Updated Helix build invocation to skip template tests by default.
.azure/pipelines/ci-public.yml Updated public CI invocation similarly to skip template tests.
Comments suppressed due to low confidence (4)

.azure/pipelines/ci.yml:637

  • The -nobl flag was removed here, which changes the build invocation from the original. You should include -nobl to preserve the intended behavior.
            - script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -all -noBuildRepoTasks -noBuildNative -noBuild -test

.azure/pipelines/ci-public.yml:585

  • The -nobl flag was removed here as well, unintentionally altering the build behavior. Please restore -nobl to match the original invocation.
        - script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -all -noBuildRepoTasks -noBuildNative -noBuild -test

.azure/pipelines/ci.yml:639

  • You’re setting RunTemplateTests=false but the code uses OnlyTestProjectTemplates to gate template test execution. Rename or duplicate this property so the MSBuild condition works correctly.
                      /p:CrossgenOutput=false /p:RunTemplateTests=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)

.azure/pipelines/ci-public.yml:588

  • This also uses RunTemplateTests, which doesn’t match the OnlyTestProjectTemplates property in your MSBuild scripts. Use the same property name to ensure the skip logic actually takes effect.
                  /p:VsTestUseMSBuildOutput=false /p:RunTemplateTests=false

@wtgodbe
Copy link
Member Author

wtgodbe commented Jun 26, 2025

Helix took 1h 9m here, down from an average of about 2h

@wtgodbe wtgodbe merged commit ecc77cb into main Jun 26, 2025
27 checks passed
@wtgodbe wtgodbe deleted the wtgodbe/HelixSeperateJob branch June 26, 2025 20:19
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview7 milestone Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants