Skip to content

Commit ecc77cb

Browse files
authored
Only run template tests when templates change (#62481)
* Try just running PTemplates in helix * Update helix.proj * Update Build.props * Add new job * Update .azure/pipelines/template-tests-pr.yml
1 parent 062e663 commit ecc77cb

File tree

5 files changed

+56
-5
lines changed

5 files changed

+56
-5
lines changed

.azure/pipelines/ci-public.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,10 @@ stages:
582582
/p:VsTestUseMSBuildOutput=false
583583
displayName: Build shared fx
584584
# -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step.
585-
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test
585+
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -all -noBuildRepoTasks -noBuildNative -noBuild -test
586586
-projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:IsHelixJob=true
587587
/p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)
588-
/p:VsTestUseMSBuildOutput=false
588+
/p:VsTestUseMSBuildOutput=false /p:RunTemplateTests=false
589589
displayName: Run build.cmd helix target
590590
env:
591591
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues

.azure/pipelines/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,9 @@ extends:
634634
MSBUILDUSESERVER: "1"
635635
displayName: Build shared fx
636636
# -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step.
637-
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test
637+
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -all -noBuildRepoTasks -noBuildNative -noBuild -test
638638
-projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:IsHelixJob=true
639-
/p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)
639+
/p:CrossgenOutput=false /p:RunTemplateTests=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)
640640
displayName: Run build.cmd helix target
641641
env:
642642
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Configure which branches trigger builds
2+
# We want to run template tests on release/8.0 and later as well as on certain PRs
3+
trigger:
4+
batch: true
5+
branches:
6+
include:
7+
- main
8+
- release/*
9+
10+
# Run PR validation on branches that include Helix tests
11+
pr:
12+
autoCancel: true
13+
branches:
14+
include:
15+
- main
16+
- release/*
17+
paths:
18+
include:
19+
- src/ProjectTemplates/**/*
20+
21+
variables:
22+
- name: _UseHelixOpenQueues
23+
value: ${{ ne(variables['System.TeamProject'], 'internal') }}
24+
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
25+
- group: DotNet-HelixApi-Access
26+
- template: /eng/common/templates/variables/pool-providers.yml
27+
28+
jobs:
29+
- template: jobs/default-build.yml
30+
parameters:
31+
jobName: Helix_templates_x64
32+
jobDisplayName: 'Tests: Helix template tests x64'
33+
agentOs: Windows
34+
timeoutInMinutes: 180
35+
steps:
36+
# Build the shared framework
37+
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -nobl -all -pack -arch x64
38+
/p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)
39+
/p:VsTestUseMSBuildOutput=false
40+
displayName: Build shared fx
41+
# -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step.
42+
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -all -noBuildRepoTasks -noBuildNative -noBuild -test
43+
-projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:IsHelixJob=true
44+
/p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)
45+
/p:VsTestUseMSBuildOutput=false /p:OnlyTestProjectTemplates=true
46+
displayName: Run build.cmd helix target
47+
artifacts:
48+
- name: Helix_logs
49+
path: artifacts/log/
50+
publishOnError: true

eng/Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
the format is correct) and undo any temporary changes. When complete, only BuildAfterTargetingPack.csproj and
1010
other @(RequiresDelayedBuild) projects should mention projects listed in RequiresDelayedBuildProjects.props.
1111
-->
12-
<Import Project="RequiresDelayedBuildProjects.props" />
12+
<Import Project="RequiresDelayedBuildProjects.props" Condition="'$(OnlyTestProjectTemplates)' != 'true'" />
1313

1414
<!-- These projects are always excluded, even when -projects is specified on command line. -->
1515
<ItemGroup>

eng/helix/helix.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
This must be reset in order for Build.props to evaluate a list of projects to be tested on Helix.
77
-->
88
<ProjectToBuild Condition="'$(ProjectToBuild)' == '$(MSBuildProjectFullPath)'"/>
9+
<ProjectToBuild Condition="'$(OnlyTestProjectTemplates)' == 'true'">$(RepoRoot)src\ProjectTemplates\test\**\*.csproj</ProjectToBuild>
910

1011
<!--
1112
Do not load NuGet.targets since this project doesn't reference anything from NuGet. Reduces `msbuild`

0 commit comments

Comments
 (0)