-
Notifications
You must be signed in to change notification settings - Fork 557
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
Run PR validation tests on windows #7909
Conversation
radical
commented
Mar 5, 2025
•
edited
Loading
edited
- Tests for PR validation are run for Windows, and Linux now.
- Docker dependent tests are disabled on windows here too, same as for helix
- Sort the list of tests
- Adjust the github workflow to handle building, and running on linux, and windows
…e nested containers are not supported
72551ee
to
ab2768b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR updates the GitHub Actions workflow to run PR validation tests on both Windows and Linux and disables Docker-dependent tests on Windows.
- Adds a matrix strategy to run tests on Ubuntu and Windows with OS-specific scripts.
- Adjusts the test, build, and environment setup steps for Windows compatibility.
Reviewed Changes
File | Description |
---|---|
.github/workflows/run-tests.yml | Updated job configuration to run tests on both Ubuntu and Windows; added matrix strategy for OS-specific scripts and modified steps accordingly. |
tests/Aspire.Components.Common.Tests/PlatformDetection.cs | Added support for detecting GitHub Actions environment by introducing a new property and updating the CI detection. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
.github/workflows/run-tests.yml:52
- Consider using 'matrix.os' instead of 'runner.os' for consistency with other steps in the workflow. This will ensure that the condition correctly reflects the operating system as defined in the job matrix.
if: runner.os == 'Linux' && (inputs.testShortName == 'Playground' || inputs.testShortName == 'Azure')
@@ -18,6 +19,7 @@ public SlimTestProgramTests(SlimTestProgramFixture slimTestProgramFixture) | |||
} | |||
|
|||
[Fact] | |||
[ActiveIssue("https://github.com/dotnet/aspire/issues/7923", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnGithubActions), nameof(PlatformDetection.IsWindows))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned it in #7923, but maybe these should just have [RequiresDocker]
attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these not failing on the rolling builds then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question. Are they running there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -211,6 +211,7 @@ public async Task GetHttpClientBeforeStart(bool genericEntryPoint) | |||
[InlineData(false, true)] | |||
[InlineData(true, false)] | |||
[InlineData(true, true)] | |||
[ActiveIssue("https://github.com/dotnet/aspire/issues/7930", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnGithubActions), nameof(PlatformDetection.IsWindows))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - This test requires docker from what I can see.
@@ -93,6 +94,7 @@ public async Task CliOrphanDetectorAfterTheProcessWasRunningForAWhileThenStops() | |||
} | |||
|
|||
[Fact] | |||
[ActiveIssue("https://github.com/dotnet/aspire/issues/7920", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnGithubActions), nameof(PlatformDetection.IsWindows))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test requires docker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed directly. All these tests are running fine on windows on main
without docker.
- name: Get list of tests | ||
env: | ||
CI: false | ||
run: > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for my learning, why do we sometimes use |
and sometimes use >
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using |
earlier as just continuing what was being used. |
means that it keeps the newlines, so:
- run: |
foo
bar
.. would be foo
, and bar
as separate commands on the shell. And for unix we were using \
at the end of the lines to concatenate them. But that doesn't work on windows, so I started using >
- which by default converts the newlines to spaces, so the lines join to become one.
- name: Generate tests matrix | ||
id: generate_test_matrix | ||
shell: pwsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
powershell on linux... nice!
if: matrix.os == 'ubuntu-latest' | ||
run: ${{ matrix.dotnet_script }} dev-certs https --trust |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't the dev-certs need to be trusted on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to get that running without prompt popping up. I seem to recall that you can pass echo yes
or something to it, but couldn't get something working. And .. the tests seem to be passing anyway? So, I have this disabled right now.
$projectPath1 = "${{ github.workspace }}/tests/$testShortName.Tests/$testShortName.Tests.csproj" | ||
$projectPath2 = "${{ github.workspace }}/tests/Aspire.$testShortName.Tests/Aspire.$testShortName.Tests.csproj" | ||
|
||
if (Test-Path -Path $projectPath1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be a bad idea to have both "display name" and "file name" properties on the test inputs? That way we wouldn't need to do this guessing at the file path. (not necessary here - can be a follow up)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it that way earlier, but any matrix inputs get serialized to the display line in PR checks. Integration / test / (Hosting, tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj)
, which made it less readable. So, I went with this.
|
||
- name: Verify Docker is running | ||
# nested docker containers not supported on windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh just a GHA thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GHA, and our pipelines too - on Windows. This file is gha only though.
Co-authored-by: Dan Moseley <[email protected]>
@eerhardt I'm merging this. If you have any more feedback, then I can address those in a follow up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM