Skip to content

Commit 5f9a547

Browse files
authored
(Re)enable running tests from cli without specifying build infra (#8688)
That is, allow running the following .\build.cmd -test -projects .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj ...instead of requiring /p:GITHUB_ACTIONS=true or /p:SYSTEM_TEAMPROJECT=foo to indicate the test is run in GHA or AzDO.
1 parent 978cce6 commit 5f9a547

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

eng/Testing.targets

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@
2929
<!-- See https://learn.microsoft.com/azure/devops/pipelines/build/variables#system-variables -->
3030
<IsAzdoCIRunner Condition=" '$(SYSTEM_TEAMPROJECT)' != '' ">true</IsAzdoCIRunner>
3131

32+
<!-- See https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Helix/Sdk/Readme.md#common-helix-client-environment-variables -->
33+
<IsHelix Condition=" '$(HELIX_CORRELATION_ID)' != '' ">true</IsHelix>
34+
3235
<IsAzdoHelixRunner Condition=" '$(PrepareForHelix)' == 'true' ">true</IsAzdoHelixRunner>
36+
37+
<!--
38+
If we haven't detected the tests are run on build agents, then we presume we're running tests locally.
39+
-->
40+
<IsLocalDevLoop Condition=" '$(IsGitHubActionsRunner)' != 'true' and '$(IsAzdoCIRunner)' != 'true' and '$(IsHelix)' != 'true' and '$(IsAzdoHelixRunner)' != 'true' ">true</IsLocalDevLoop>
3341
</PropertyGroup>
3442

3543
<PropertyGroup>
@@ -58,6 +66,9 @@
5866

5967
<!-- Otherwise, run tests on AzDO CI agents -->
6068
<SkipTests Condition=" '$(IsAzdoCIRunner)' == 'true' and '$(RunOnAzdoCI)' == 'true' ">false</SkipTests>
69+
70+
<!-- If we're running locally, we don't skip tests -->
71+
<SkipTests Condition=" '$(IsLocalDevLoop)' == 'true' ">false</SkipTests>
6172
</PropertyGroup>
6273

6374
<ItemGroup Condition=" '$(IsTestProject)' == 'true' and '$(IncludeTestUtilities)' == 'true' ">

0 commit comments

Comments
 (0)