Skip to content

[CI] Add PR validation on macOS#9175

Merged
radical merged 16 commits intodotnet:mainfrom
radical:macos-ci
May 9, 2025
Merged

[CI] Add PR validation on macOS#9175
radical merged 16 commits intodotnet:mainfrom
radical:macos-ci

Conversation

@radical
Copy link
Member

@radical radical commented May 8, 2025

This adds PR validation for macOS with github actions. This is at par with Windows tests, with Docker based tests, and tests requiring trusted ssl certificate being disabled.

  • [tests] Run tests workflow on macos
  • Adjust RequiresDocker and RequiresSSLCertificate to skip macos
  • Disable tests failing on macos
    • FormatDateTime_WithMilliseconds_NewZealandCulture
    • AppBar_Change_Theme_ReloadPage
    • ProjectWithNoHTTPSRequiresExplicitOverrideWithEnvironmentVariable
  • Don't override DOTNET_ROOT when getting list of tests
  • Skip playground tests on windows and macos

@radical radical requested review from RussKie, danmoseley and joperezr May 8, 2025 19:01
@radical radical requested a review from eerhardt as a code owner May 8, 2025 19:01
@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label May 8, 2025
@radical radical added the area-engineering-systems infrastructure helix infra engineering repo stuff label May 8, 2025
Copy link
Member

@danmoseley danmoseley left a comment

Choose a reason for hiding this comment

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

LGTM feel free to merge

@RussKie
Copy link
Contributor

RussKie commented May 8, 2025

We need to update runsheet runners:

I think this where the change will go:

<_TestRunsheetFileNameWindows>$(ArtifactsTmpDir)\$(_TestRunsheet).win.runsheet.json</_TestRunsheetFileNameWindows>
<_TestRunsheetFileNameLinux>$(ArtifactsTmpDir)\$(_TestRunsheet).linux.runsheet.json</_TestRunsheetFileNameLinux>

<_TestRunsheetWindows>{ "project": "$(_TestRunsheet)", "os": "windows-latest", "command": "./eng/build.ps1 $(_TestCommand)" }</_TestRunsheetWindows>
<_TestRunsheetLinux>{ "project": "$(_TestRunsheet)", "os": "ubuntu-latest", "command": "$(_PreCommand)./eng/build.sh $(_TestCommand)" }</_TestRunsheetLinux>

<WriteLinesToFile
Condition=" '$(RunOnGithubActionsWindows)' == 'true' and '$(_CreateRunsheet)' == 'true' "
File="$(_TestRunsheetFileNameWindows)"
Lines="$(_TestRunsheetWindows)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
<WriteLinesToFile
Condition=" '$(RunOnGithubActionsLinux)' == 'true' and '$(_CreateRunsheet)' == 'true' "
File="$(_TestRunsheetFileNameLinux)"
Lines="$(_TestRunsheetLinux)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />
<!--
On Linux there's a bug in MSBuild, which "normalises" all slashes (see https://github.com/dotnet/msbuild/issues/3468).
This is a workaround to replace `/"` with the required `\"`.
-->
<Exec Command="pwsh -Command &quot;(Get-Content -Path '$(_TestRunsheetFileNameWindows)') -replace '/\&quot;', '\\\&quot;' | Set-Content -Path '$(_TestRunsheetFileNameWindows)'&quot; "
Condition=" Exists('$(_TestRunsheetFileNameWindows)') and '$(BuildOs)' != 'windows' " />
<Exec Command="pwsh -Command &quot;(Get-Content -Path '$(_TestRunsheetFileNameLinux)') -replace '/\&quot;', '\\\&quot;' | Set-Content -Path '$(_TestRunsheetFileNameLinux)'&quot; "
Condition=" Exists('$(_TestRunsheetFileNameLinux)') and '$(BuildOs)' != 'windows' " />

@RussKie RussKie removed the area-integrations Issues pertaining to Aspire Integrations packages label May 8, 2025
@RussKie
Copy link
Contributor

RussKie commented May 9, 2025

@RussKie
Copy link
Contributor

RussKie commented May 9, 2025

Outerloop is unhappy, looking
Outerloop fixed https://github.com/dotnet/aspire/actions/runs/14918714434

@RussKie
Copy link
Contributor

RussKie commented May 9, 2025

Do we need to run E2E on a mac? Those seem to time-out...

Text="%24(ExtractTestClassNamesPrefix) should be set, for example - Aspire.Templates.Tests" />

<Exec Command="&quot;$(RunCommand)&quot; --filter-not-trait category=failing --list-tests" ConsoleToMSBuild="true" EnvironmentVariables="DOTNET_ROOT=$(DotNetRoot);DOTNET_ROOT_X86=$(DotNetRoot)x86">
<Exec Command="&quot;$(RunCommand)&quot; --filter-not-trait category=failing --list-tests" ConsoleToMSBuild="true">
Copy link
Contributor

Choose a reason for hiding this comment

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

May you please provide the reason behind this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

This always overrides DOTNET_ROOT using $(DotnetRoot) which overrides the setting in the environment. So, if you have DOTNET_ROOT set then the parent dotnet process will run with that, but the dotnet .. list-tests will run with this overridden setting.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you don't agree with this btw, then we can discuss and fix in 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.

Fails on azdo with:

You must install or update .NET to run this application.
  
  App: /mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire.Templates.Tests
  Architecture: x64
  Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64)
  .NET location: /usr/lib/dotnet
  
  The following frameworks were found:
    6.0.36 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
  
  Learn about framework resolution:
  https://aka.ms/dotnet/app-launch-failed
  
  To install missing framework, download:
  https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=ubuntu.22.04-x64
/mnt/vss/_work/1/s/tests/Directory.Build.targets(39,5): error MSB3073: The command ""/mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire.Templates.Tests" --filter-not-trait category=failing --list-tests" exited with code 150. [/mnt/vss/_work/1/s/tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj]
##[error]tests/Directory.Build.targets(39,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command ""/mnt/vss/_work/1/s/artifacts/bin/Aspire.Templates.Tests/Release/net8.0/Aspire.Templates.Tests" --filter-not-trait category=failing --list-tests" exited with code 150.

We can override DotnetRoot specifically then to have this scenario work too. Though where is this property set?

Copy link
Contributor

Choose a reason for hiding this comment

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

radical added 7 commits May 9, 2025 10:09
Fixes
```
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Microsoft.Extensions.ServiceDiscovery.Abstractions/Microsoft.Extensions.ServiceDiscovery.Abstractions.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Microsoft.Extensions.ServiceDiscovery.Abstractions/Microsoft.Extensions.ServiceDiscovery.Abstractions.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Tools/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Microsoft.Extensions.ServiceDiscovery.Abstractions/Microsoft.Extensions.ServiceDiscovery.Abstractions.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Tools/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj]
```
@radical radical merged commit 23742a9 into dotnet:main May 9, 2025
245 checks passed
radical added a commit to radical/aspire that referenced this pull request May 9, 2025
This reverts commit 23742a9.

Reverting this temporarily till 9.3 branches to avoid blocking the merge
due to new flaky macos test failures.
danmoseley pushed a commit that referenced this pull request May 9, 2025
This reverts commit 23742a9.

Reverting this temporarily till 9.3 branches to avoid blocking the merge
due to new flaky macos test failures.
radical added a commit to radical/aspire that referenced this pull request May 13, 2025
This is reverting "Revert "[CI] Add PR validation on macOS (dotnet#9175)" (dotnet#9208)" commit e5b2802.

This is from the original commit message:

* [tests] Run tests workflow on macos

* Adjust RequiresDocker and RequiresSSLCertificate to skip macos

* Disable tests failing on macos

* Don't override DOTNET_ROOT when getting list of tests

* Skip playground tests on windows and macos

.. and add RunOnGithubActionsMacOS

* Update runsheet runners

* fixup! Update runsheet runners

* fixup! Update runsheet runners

* Address review feedback from @ russkie

* Address review feedback from @ russkie - skip E2E tests on macos as they

.. are timing out.

Issue: dotnet#9198

* Add missing CI: false for outerloop test runs

Fixes
```
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Microsoft.Extensions.ServiceDiscovery.Abstractions/Microsoft.Extensions.ServiceDiscovery.Abstractions.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Microsoft.Extensions.ServiceDiscovery.Abstractions/Microsoft.Extensions.ServiceDiscovery.Abstractions.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Tools/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Microsoft.Extensions.ServiceDiscovery.Abstractions/Microsoft.Extensions.ServiceDiscovery.Abstractions.csproj]
/home/runner/work/aspire/aspire/eng/Versions.targets(49,67): error MSB4057: The target "GitInfo" does not exist in the project. [/home/runner/work/aspire/aspire/src/Tools/ConfigurationSchemaGenerator/ConfigurationSchemaGenerator.csproj]
```

* Add macos to the quarantined tests report generator

---------

Co-authored-by: Igor Velikorossov <igor.velikorossov@microsoft.com>
Co-authored-by: Igor Velikorossov <RussKie@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 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.

3 participants