Skip to content
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

Merged
merged 21 commits into from
Mar 6, 2025
Merged

Conversation

radical
Copy link
Member

@radical radical commented Mar 5, 2025

  • 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

radical added 2 commits March 5, 2025 17:30
- Adjust the github workflow to handle building, and running on linux,
  and windows
@radical radical force-pushed the tests-pr-windows branch from 72551ee to ab2768b Compare March 5, 2025 22:31
@radical radical marked this pull request as ready for review March 5, 2025 22:40
@Copilot Copilot bot review requested due to automatic review settings March 5, 2025 22:40

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')
@radical radical marked this pull request as draft March 5, 2025 23:06
@radical radical marked this pull request as ready for review March 6, 2025 00:00
@radical radical requested a review from mitchdenny as a code owner March 6, 2025 14:18
@radical radical requested a review from ReubenBond as a code owner March 6, 2025 15:20
@@ -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))]
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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?

Copy link
Member Author

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))]
Copy link
Member

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))]
Copy link
Member

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.

Copy link
Member Author

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: >
Copy link
Member

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 >?

Copy link
Member Author

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.

https://yaml-multiline.info

- name: Generate tests matrix
id: generate_test_matrix
shell: pwsh
Copy link
Member

Choose a reason for hiding this comment

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

powershell on linux... nice!

Comment on lines +45 to +46
if: matrix.os == 'ubuntu-latest'
run: ${{ matrix.dotnet_script }} dev-certs https --trust
Copy link
Member

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?

Copy link
Member Author

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.

Comment on lines +67 to +70
$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) {
Copy link
Member

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)

Copy link
Member Author

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.

@radical radical mentioned this pull request Mar 6, 2025
5 tasks

- name: Verify Docker is running
# nested docker containers not supported on windows
Copy link
Member

Choose a reason for hiding this comment

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

Really?

Copy link
Member

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?

Copy link
Member Author

@radical radical Mar 6, 2025

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.

@radical
Copy link
Member Author

radical commented Mar 6, 2025

@eerhardt I'm merging this. If you have any more feedback, then I can address those in a follow up.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM

@radical radical merged commit 0ae0f0b into dotnet:main Mar 6, 2025
137 checks passed
@radical radical deleted the tests-pr-windows branch March 6, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants