Skip to content

Commit 7f036e5

Browse files
committed
Rename test env controlling and project test capabilities variables
1 parent 543e187 commit 7f036e5

File tree

14 files changed

+154
-46
lines changed

14 files changed

+154
-46
lines changed

eng/Testing.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
<Project>
2+
<PropertyGroup>
3+
<IncludeTestUtilities>true</IncludeTestUtilities>
4+
5+
<!-- By default any test can run on all test platforms -->
6+
<RunsOnGithubActionsWindows>true</RunsOnGithubActionsWindows>
7+
<RunsOnGithubActionsLinux>true</RunsOnGithubActionsLinux>
8+
<RunsOnAzdo>true</RunsOnAzdo>
9+
<RunsOnHelixWindows>true</RunsOnHelixWindows>
10+
<RunsOnHelixLinux>true</RunsOnHelixLinux>
11+
</PropertyGroup>
12+
213
<PropertyGroup Condition="'$(UseVSTestRunner)' != 'true'">
314
<_QuarantinedTestRunAdditionalArgs>-trait "quarantined=true"</_QuarantinedTestRunAdditionalArgs>
415
<_NonQuarantinedTestRunAdditionalArgs>-notrait "quarantined=true"</_NonQuarantinedTestRunAdditionalArgs>

eng/Testing.targets

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,91 @@
11
<Project>
22

3+
<!--
4+
Environment variables:
5+
- IsGitHubActionsRunner: indicates whether tests are currently run on GitHub Actions; computed, overridable
6+
- IsAzdoRunner: indicates whether tests are currently run on Azure DevOps; computed, overridable
7+
- IsHelix: indicates whether tests are currently run on Helix; computed, overridable
8+
,
9+
Project capabilities:
10+
- IsTestProject: indicates whether the project is a test project; default is false; computed, overridable
11+
- IncludeTestUtilities: indicates whether the test project must not include the TestUtilities project reference; default is false; overridable
12+
- RunsOnGithubActions: indicates whether tests should run on GitHub Actions (either Windows or Linux); computed
13+
- RunsOnGithubActionsWindows: indicates whether tests should run on Windows in GitHub Actions; default is true; overridable
14+
- RunsOnGithubActionsLinux: indicates whether tests should run on Linux in GitHub Actions; default is true; overridable
15+
- RunsOnAzdo: indicates whether tests should run on Azure DevOps; default is true; overridable
16+
- RunsOnHelix: indicates whether tests should run on Helix (either Windows or Linux); computed
17+
- RunsOnHelixWindows: indicates whether tests should run on Windows in Helix; default is true; overridable
18+
- RunsOnHelixLinux: indicates whether tests should run on Linux in Helix; default is true; overridable
19+
-->
20+
21+
<PropertyGroup>
22+
<!-- See https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables -->
23+
<IsGitHubActionsRunner Condition=" '$(IsGitHubActionsRunner)' == '' and '$(GITHUB_ACTIONS)' == 'true' ">true</IsGitHubActionsRunner>
24+
25+
<!-- See https://learn.microsoft.com/azure/devops/pipelines/build/variables#system-variables -->
26+
<IsAzdoRunner Condition=" '$(IsAzdoRunner)' == '' and '$(SYSTEM_TEAMPROJECT)' != '' ">true</IsAzdoRunner>
27+
28+
<!-- See https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Helix/Sdk/Readme.md#common-helix-client-environment-variables -->
29+
<IsHelix Condition=" '$(IsHelix)' == '' and '$(HELIX_CORRELATION_ID)' != '' ">true</IsHelix>
30+
</PropertyGroup>
31+
32+
<PropertyGroup>
33+
<RunsOnGithubActions>false</RunsOnGithubActions>
34+
<RunsOnGithubActions Condition=" '$(RunsOnGithubActionsWindows)' == 'true' or '$(RunsOnGithubActionsLinux)' == 'true' ">true</RunsOnGithubActions>
35+
36+
<RunsOnHelix>false</RunsOnHelix>
37+
<RunsOnHelix Condition=" '$(RunsOnHelixWindows)' == 'true' or '$(RunsOnHelixLinux)' == 'true' ">true</RunsOnHelix>
38+
39+
<!-- If a test is run on Helix, then we don't run the test on AzDO -->
40+
<RunsOnAzdo Condition=" '$(RunsOnHelix)' == 'true' ">false</RunsOnAzdo>
41+
</PropertyGroup>
42+
43+
<PropertyGroup Condition=" '$(SkipTests)' == '' and '$(IsTestProject)' == 'true' ">
44+
<!-- Skip tests by default unless explicitly set to false -->
45+
<SkipTests>true</SkipTests>
46+
47+
<!-- Only run tests if the build is running on GitHub Actions -->
48+
<SkipTests Condition=" '$(IsGitHubActionsRunner)' == 'true' and '$(RunsOnGithubActions)' == 'true' ">false</SkipTests>
49+
50+
<!-- Only run tests if the build is running on Helix infra -->
51+
<SkipTests Condition=" '$(IsHelix)' == 'true' and '$(RunsOnHelix)' == 'true' ">false</SkipTests>
52+
53+
<!-- Otherwise, run tests on AzDO CI agents -->
54+
<SkipTests Condition=" '$(IsAzdoRunner)' == 'true' and '$(RunsOnAzdo)' == 'true' ">false</SkipTests>
55+
</PropertyGroup>
56+
57+
<ItemGroup Condition=" '$(IsTestProject)' == 'true' and '$(IncludeTestUtilities)' != 'true' ">
58+
<ProjectReference Include="$(RepoRoot)tests\Aspire.TestUtilities\Aspire.TestUtilities.csproj" />
59+
</ItemGroup>
60+
61+
<!--
62+
The following target is used to announce the test capabilities of the project.
63+
-->
64+
<Target Name="_AnnounceProjectTestCapabilities" BeforeTargets="RunTests" Condition="'$(IsTestProject)' == 'true'">
65+
<PropertyGroup>
66+
<_IsGitHubActionsRunner Condition="'$(IsGitHubActionsRunner)' == ''">false</_IsGitHubActionsRunner>
67+
<_IsGitHubActionsRunner Condition="'$(IsGitHubActionsRunner)' != ''">$(IsGitHubActionsRunner)</_IsGitHubActionsRunner>
68+
<_IsAzdoRunner Condition="'$(IsAzdoRunner)' == ''">false</_IsAzdoRunner>
69+
<_IsAzdoRunner Condition="'$(IsAzdoRunner)' != ''">$(IsAzdoRunner)</_IsAzdoRunner>
70+
<_IsHelix Condition="'$(IsHelix)' == ''">false</_IsHelix>
71+
<_IsHelix Condition="'$(IsHelix)' != ''">$(IsHelix)</_IsHelix>
72+
</PropertyGroup>
73+
<ItemGroup>
74+
<_Runner Include=" - GitHub Actions: $(_IsGitHubActionsRunner)" />
75+
<_Runner Include=" - Azure DevOps: $(_IsAzdoRunner)" />
76+
<_Runner Include=" - Helix: $(_IsHelix)" />
77+
<_Capability Include=" - GitHub Actions: $(RunsOnGithubActions) (Windows: $(RunsOnGithubActionsWindows) / Linux: $(RunsOnGithubActionsLinux))" />
78+
<_Capability Include=" - Azure DevOps: $(RunsOnAzdo)" />
79+
<_Capability Include=" - Helix: $(RunsOnHelix) (Windows: $(RunsOnHelixWindows) / Linux: $(RunsOnHelixLinux))" />
80+
</ItemGroup>
81+
82+
<PropertyGroup>
83+
<_NewLine>%0D%0A</_NewLine>
84+
<_RunnerList>@(_Runner, '%0D%0A')</_RunnerList>
85+
<_CapabilityList>@(_Capability, '$(_NewLine)')</_CapabilityList>
86+
</PropertyGroup>
87+
88+
<Message Text="Project: $(MSBuildProjectName)$(_NewLine)Runner Context:$(_NewLine)$(_RunnerList)$(_NewLine)Capabilities:$(_NewLine)$(_CapabilityList)" />
89+
</Target>
90+
391
</Project>

tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>
8-
<RunTestsOnHelix>false</RunTestsOnHelix>
8+
9+
<!-- Do not run tests in Helix at all -->
10+
<RunsOnHelixWindows>false</RunsOnHelixWindows>
11+
<RunsOnHelixLinux>false</RunsOnHelixLinux>
912
</PropertyGroup>
1013

1114
<ItemGroup>

tests/Aspire.Dashboard.Tests/Aspire.Dashboard.Tests.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
<InstallBrowsersForPlaywright Condition="'$(InstallBrowsersForPlaywright)' == '' and '$(ContinuousIntegrationBuild)' == 'true'">true</InstallBrowsersForPlaywright>
1212
<InstallBrowsersForPlaywright Condition="'$(InstallBrowsersForPlaywright)' == '' and '$(OS)' == 'Windows_NT' and '$(ContinuousIntegrationBuild)' != 'true'">true</InstallBrowsersForPlaywright>
1313

14-
<RunTestsOnHelix>false</RunTestsOnHelix>
14+
<!-- Do not run tests in Helix at all -->
15+
<RunsOnHelixWindows>false</RunsOnHelixWindows>
16+
<RunsOnHelixLinux>false</RunsOnHelixLinux>
1517
</PropertyGroup>
1618

1719
<ItemGroup>

tests/Aspire.Elastic.Clients.Elasticsearch.Tests/Aspire.Elastic.Clients.Elasticsearch.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<PropertyGroup>
44
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
55

6-
<!-- Issue: https://github.com/dotnet/aspire/issues/5634 -->
7-
<SkipTests Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</SkipTests>
8-
<RunTestsOnHelix>false</RunTestsOnHelix>
6+
<!-- Do not run tests in Helix at all -->
7+
<RunsOnHelixWindows>false</RunsOnHelixWindows>
8+
<RunsOnHelixLinux>false</RunsOnHelixLinux>
99
</PropertyGroup>
1010

1111
<ItemGroup>

tests/Aspire.EndToEnd.Tests/Aspire.EndToEnd.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
<PropertyGroup>
44
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
5-
<!-- no docker support on helix/windows yet -->
6-
<RunTestsOnHelix Condition="'$(OS)' == 'Windows_NT'">false</RunTestsOnHelix>
7-
<!-- no docker support on GHA/windows yet -->
8-
<RunTestsOnGithubActions Condition="'$(OS)' == 'Windows_NT'">false</RunTestsOnGithubActions>
9-
<SkipTests Condition="'$(OS)' == 'Windows_NT'">true</SkipTests>
5+
<!-- Only run on GHA or Helix Linux; no docker support on Windows yet -->
6+
<RunsOnGithubActionsWindows>false</RunsOnGithubActionsWindows>
7+
<RunsOnHelixWindows>false</RunsOnHelixWindows>
8+
<!-- Don't run tests on AzDO Windows -->
9+
<RunsOnAzdo Condition="'$(OS)' == 'Windows_NT'">false</RunsOnAzdo>
1010

1111
<!-- no docker support on helix/windows yet -->
1212
<TestUsingWorkloads Condition="! ('$(ContinuousIntegrationBuild)' == 'true' and '$(OS)' == 'Windows_NT')">true</TestUsingWorkloads>

tests/Aspire.Hosting.Docker.Tests/Aspire.Hosting.Docker.Tests.csproj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
<PropertyGroup>
44
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
5-
<NoWarn>
6-
$(NoWarn);
7-
ASPIREHOSTINGPYTHON001;
8-
</NoWarn>
9-
<!-- required because DockerComposePublisherTests.PublishAsync_GeneratesValidDockerComposeFile needs
10-
the TestingAppHost1 -->
11-
<RunTestsOnHelix>false</RunTestsOnHelix>
5+
<NoWarn>$(NoWarn);ASPIREHOSTINGPYTHON001;</NoWarn>
6+
7+
<!--
8+
Do not run tests in Helix at all
9+
required because DockerComposePublisherTests.PublishAsync_GeneratesValidDockerComposeFile needs the TestingAppHost1
10+
-->
11+
<RunsOnHelixWindows>false</RunsOnHelixWindows>
12+
<RunsOnHelixLinux>false</RunsOnHelixLinux>
1213
</PropertyGroup>
1314

1415
<ItemGroup>

tests/Aspire.Hosting.Testing.Tests/Aspire.Hosting.Testing.Tests.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>
8-
<IsTestProject>true</IsTestProject>
9-
<RunTestsOnHelix>false</RunTestsOnHelix>
8+
9+
<!-- Do not run tests in Helix at all -->
10+
<RunsOnHelixWindows>false</RunsOnHelixWindows>
11+
<RunsOnHelixLinux>false</RunsOnHelixLinux>
1012
</PropertyGroup>
1113

1214
<ItemGroup>

tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
CS8002: Referenced assembly does not have a strong name. KubernetesClient package is unsigned, we ignore that warning on purpose
77
-->
88
<NoWarn>$(NoWarn);CS8002</NoWarn>
9-
<RunTestsOnHelix>false</RunTestsOnHelix>
9+
10+
<!-- Do not run tests in Helix at all -->
11+
<RunsOnHelixWindows>false</RunsOnHelixWindows>
12+
<RunsOnHelixLinux>false</RunsOnHelixLinux>
1013
</PropertyGroup>
1114

1215
<ItemGroup>

tests/Aspire.Oracle.EntityFrameworkCore.Tests/Aspire.Oracle.EntityFrameworkCore.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>$(AllTargetFrameworks)</TargetFrameworks>
5-
<RunTestsOnHelix>true</RunTestsOnHelix>
65
</PropertyGroup>
76

87
<ItemGroup>

0 commit comments

Comments
 (0)