Skip to content

Conversation

RussKie
Copy link
Contributor

@RussKie RussKie commented Apr 10, 2025

Working in GHA for the past few weeks, I completely missed that running tests locally became impossible without passing an infra flag.
With this change it will now be possible to run tests again with just:

.\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.

Before

PS D:\Development\dotnet-aspire> .\build.cmd -test -projects .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj -c Release /bl
& "D:\Development\dotnet-aspire\eng/common/build.ps1"  /p:test=True -configuration Release -projects .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj /bl

Build succeeded in 0.4s
PS D:\Development\dotnet-aspire> .\build.cmd -test -projects .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj -c Release /bl /p:GITHUB_ACTIONS=true                            
& "D:\Development\dotnet-aspire\eng/common/build.ps1"  /p:test=True -configuration Release -projects .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj /bl /p:GITHUB_ACTIONS=true

Build succeeded in 5.4s

After

PS D:\Development\dotnet-aspire> .\build.cmd -test -projects .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj -c Release /bl      
& "D:\Development\dotnet-aspire\eng/common/build.ps1"  /p:test=True -configuration Release -projects .\tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj /bl

Build succeeded in 2.0s

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.
@Copilot Copilot AI review requested due to automatic review settings April 10, 2025 03:18
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.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (1)
  • eng/Testing.targets: Language not supported

@github-actions github-actions bot added the area-engineering-systems infrastructure helix infra engineering repo stuff label Apr 10, 2025
@@ -57,6 +65,9 @@

<!-- Otherwise, run tests on AzDO CI agents -->
<SkipTests Condition=" '$(IsAzdoCIRunner)' == 'true' and '$(RunOnAzdoCI)' == 'true' ">false</SkipTests>

<!-- If we're running locally, we don't skip tests -->
<SkipTests Condition=" '$(IsLocalDevLoop)' == 'true' ">false</SkipTests>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Locally we don't skip any tests (unless those were explicitly skipped).
For example, there are some tests which are declared as incompatible with Windows because there's no Docker on Windows build agents. Docker can be installed locally, meaning that such test can be run locally as well.

@RussKie RussKie requested a review from radical April 10, 2025 03:27
@RussKie RussKie merged commit 5f9a547 into main Apr 14, 2025
179 of 181 checks passed
@RussKie RussKie deleted the igveliko/fix_local_tests branch April 14, 2025 09:42
@github-actions github-actions bot locked and limited conversation to collaborators May 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-engineering-systems infrastructure helix infra engineering repo stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants