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

Upgrade tooling for 9.0x #5483

Merged
merged 23 commits into from
Sep 11, 2024
Merged

Upgrade tooling for 9.0x #5483

merged 23 commits into from
Sep 11, 2024

Conversation

radical
Copy link
Member

@radical radical commented Aug 29, 2024

  • Update dependencies from .NET 9 Eng channel
  • Update nuget.config to use dotnet9 nuget feed instead of nuget8
  • Update tests to run with 8.0 runtime
  • Resolve new xunit analyzer warnings

All the projects still target net8.0.

Future TODO:

  • add 9.0 templates, and tests

Fixes #5446 .

TODO before merge:

  • check that code coverage report is unaffected
  • Number of tests is the same as a main run
  • Diff package build output to ensure contents of packages are unaffected (added by @joperezr)
  • Validate with an internal build
Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 29, 2024
@radical radical added area-engineering-systems and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Aug 29, 2024
@@ -103,7 +103,7 @@ static async Task<List<string[]>> GetAndValidateCellTexts(ILocator tableLoc)
r => Assert.True(DateTime.TryParse(r, out _)),
r => Assert.True(int.TryParse(r, out var actualTempC) && actualTempC >= -20 && actualTempC <= 55),
r => Assert.True(int.TryParse(r, out var actualTempF) && actualTempF >= -5 && actualTempF <= 133),
r => Assert.Contains(r, ["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"]));
r => Assert.Contains(r, new HashSet<string>(){"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"}));
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, I would have expected this to work with the new collection literals.

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC it was not being able to resolve the overload between HashSet<> and SortedSet<>.

@@ -9,7 +9,7 @@
<add key="built-local" value="%BUILT_NUGETS_PATH%" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
Copy link
Member

Choose a reason for hiding this comment

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

So we don't need dotnet8 feed anymore? I think we still push our packages there so we have to update our default channels in darc.

Copy link
Member Author

Choose a reason for hiding this comment

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

But we shouldn't be fetching any of our packages from these feeds (except BUILT_NUGETS_PATH) for tests. Or am I missing something?

@@ -19,6 +19,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Runtime.WorkloadTesting.Internal" />

<AdditionalSharedFrameworkToInstallArguments Include="-Runtime dotnet -Version 8.0.8 -Channel 8.0" />
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to reuse the dotnet installed by the original build.cmd/sh call so we don't have to add this? I want to avoid needing to update a number in several places (runtime framework in this case 8.0.8) as those change each month.

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 is specifically for workload testing. It will be much cleaner to use the existing support for this. But we could try to use the restored .dotnet also, but also need to account for .dotnet not being installed when the system dotnet is sufficient.

@@ -8,13 +8,15 @@

<IncludeDotNetCli>true</IncludeDotNetCli>
<DotNetCliPackageType>sdk</DotNetCliPackageType>
<DotNetCliVersion>8.0.401</DotNetCliVersion>
Copy link
Member

Choose a reason for hiding this comment

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

How will this work for template tests for 9.0 templates? won't they require a 9.0 SDK?

Copy link
Member Author

Choose a reason for hiding this comment

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

Still going through a first pass to get tests passing :D

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 will require us to bundle the sdk ourselves, because arcade doesn't seem to support additional runtimes.
To confirm that this works I think this PR should include a couple of tests where the test project targets net9.0 (best in workload tests).

@@ -3,6 +3,7 @@
<Import Project="$(RepositoryEngineeringDir)/apicompat/PublicApiAnalyzer.props" />

<PropertyGroup>
<NetCurrent>net8.0</NetCurrent>
Copy link
Member

Choose a reason for hiding this comment

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

Is this property used anywhere else in arcade or is it solely used by consuming repos? my concern is that changing this in order to avoid having to modify individual projects might unintentionally affect how the infrastructure work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I can drop this in the cleanup.

Copy link
Member

Choose a reason for hiding this comment

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

global.json Outdated Show resolved Hide resolved
@radical
Copy link
Member Author

radical commented Sep 4, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Updating 'Microsoft.SourceBuild.Intermediate.source-build-reference-packages': '8.0.0-alpha.1.23516.4' => '9.0.0-alpha.1.24453.2' (from build '20240903.2' of 'https://github.com/dotnet/source-build-reference-packages')
Updating 'Microsoft.SourceBuild.Intermediate.arcade': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
Updating 'Microsoft.DotNet.Arcade.Sdk': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
Updating 'Microsoft.DotNet.Build.Tasks.Installers': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
Updating 'Microsoft.DotNet.Build.Tasks.Workloads': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
Updating 'Microsoft.DotNet.Helix.Sdk': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
Updating 'Microsoft.DotNet.RemoteExecutor': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
Updating 'Microsoft.DotNet.SharedFramework.Sdk': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
Updating 'Microsoft.DotNet.XUnitExtensions': '8.0.0-beta.24426.2' => '9.0.0-beta.24453.1' (from build '20240903.1' of 'https://github.com/dotnet/arcade')
`Do not use Assert.Equal() to check for collection size. Use
Assert.Single instead.xUnit2013`
`Do not use Assert.Empty() to check if a value does not exist in a
collection. Use Assert.DoesNotContain() instead.xUnit2029`
`error xUnit1030: Test methods should not call ConfigureAwait(false), as
it may bypass parallelization limits. Omit ConfigureAwait, or use
ConfigureAwait(true) to avoid CA2007.
(https://xunit.net/xunit.analyzers/rules/xUnit1030)`
Warning of the form:
`error xUnit1012: Null should not be used for type parameter
'secondaryApiKey' of type 'string'. Use a non-null value, or convert the
parameter to a nullable type.
(https://xunit.net/xunit.analyzers/rules/xUnit1012)`
`error CS0121: The call is ambiguous between the following methods or
properties: 'Assert.Contains<T>(T, HashSet<T>)' and
'Assert.Contains<T>(T, SortedSet<T>)'`
@radical
Copy link
Member Author

radical commented Sep 5, 2024

TODO before merge:

  • check that code coverage report is unaffected
  • Number of tests is the same as a main run
  • Diff package build output to ensure contents of packages are unaffected (added by @joperezr)

Comment on lines -162 to -167
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.xliff-tasks" Version="1.0.0-beta.23475.1" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
<Uri>https://github.com/dotnet/xliff-tasks</Uri>
<Sha>73f0850939d96131c28cf6ea6ee5aacb4da0083a</Sha>
<SourceBuild RepoName="xliff-tasks" ManagedOnly="true" />
</Dependency>
Copy link
Member Author

Choose a reason for hiding this comment

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

From the first commit - does dropping this seem correct? The assembly has moved to dotnet/arcade.

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 that is fine, and I think you can also drop the dependency over from lines 152-155 above for that matter (not sure why we had both), but shouldn't we have now a new dependency coming from arcade for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll need to add a dependency like dotnet/runtime has:

    <Dependency Name="Microsoft.DotNet.XliffTasks" Version="9.0.0-beta.24423.2">
      <Uri>https://github.com/dotnet/arcade</Uri>
      <Sha>91599268652b51969b8d8088d4f2f2ba7b3ebb19</Sha>
    </Dependency>

Copy link
Member Author

Choose a reason for hiding this comment

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

added that here.

@radical
Copy link
Member Author

radical commented Sep 5, 2024

Read commit by commit to review this. The first commit is the biggest and is the update of the dependencies, mostly from arcade.

@radical
Copy link
Member Author

radical commented Sep 9, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

# Conflicts:
#	tests/Aspire.Elastic.Clients.Elasticsearch.Tests/Aspire.Elastic.Clients.Elasticsearch.Tests.csproj
…(38,45): error CA2007: Consider calling ConfigureAwait on the awaited task
@@ -12,6 +12,12 @@
This should get updated each time packages are shipped.
-->
<BaselineVersionForPackageValidation>8.0.1</BaselineVersionForPackageValidation>
<DefaultTargetFramework>net8.0</DefaultTargetFramework>
<!-- dotnet 8.0 versions for running tests -->
<DotNetRuntimeVersionForTesting>8.0.8</DotNetRuntimeVersionForTesting>
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering how we can keep this one up-to-date. One option would be if we use the Microsoft.NetCore.App.Ref package and dependency flow for the version as we know that one will push the update to us. Anyway, no need to fix it now but we should consider how to update this (and the sdk below)

Copy link
Member Author

Choose a reason for hiding this comment

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

dotnet/runtime is using Microsoft.DotNet.ApiCompat.Task for that. Either should work well.

@@ -103,7 +103,7 @@ static async Task<List<string[]>> GetAndValidateCellTexts(ILocator tableLoc)
r => Assert.True(DateTime.TryParse(r, out _)),
r => Assert.True(int.TryParse(r, out var actualTempC) && actualTempC >= -20 && actualTempC <= 55),
r => Assert.True(int.TryParse(r, out var actualTempF) && actualTempF >= -5 && actualTempF <= 133),
r => Assert.Contains(r, ["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"]));
r => Assert.Contains(r, new HashSet<string>{"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"}));
Copy link
Member

Choose a reason for hiding this comment

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

Still curious why this didn't work with the collection initializer, but oh well, no need to change it.

Copy link
Member Author

Choose a reason for hiding this comment

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

error CS0121: The call is ambiguous between the following methods or properties: 'Assert.Contains<T>(T, HashSet<T>)' and 'Assert.Contains<T>(T, SortedSet<T>)'

@@ -13,8 +13,7 @@
<!-- Disable playwright tests on helix/linux. Issue: https://github.com/dotnet/aspire/issues/4623 -->
<DisablePlaywrightTests Condition="'$(OS)' != 'Windows_NT'">true</DisablePlaywrightTests>

<GlobalJsonContent>$([System.IO.File]::ReadAllText('$(RepoRoot)global.json'))</GlobalJsonContent>
<DotNetCliVersion>$([System.Text.RegularExpressions.Regex]::Match($(GlobalJsonContent), '(%3F&lt;="dotnet": ").*(%3F=")'))</DotNetCliVersion>
<DotNetCliVersion>$(DotNetSdkVersionForTesting)</DotNetCliVersion>
Copy link
Member

Choose a reason for hiding this comment

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

We'll want to make sure now that we update that property so that it at least equals the one in global.json. I wonder if we can add a target somewhere in our build that detects if we've fallen behind and if so to fail the build...

No need to add that in this change though, don't block this PR for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Once we get the version from a dotnet/sdk dependency, it should always(?) be newer than global.json.

@@ -1,16 +1,30 @@
{
"sdk": {
"version": "8.0.303",
"version": "9.0.100-preview.7.24407.12",
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now. We'll want to bump to rc1 that got shipped today soon.

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

Changes look great @radical thanks for working on this! Let's prioritize getting this merged given the breath as otherwise it is likely to get conflicts with other PRs.

@radical
Copy link
Member Author

radical commented Sep 10, 2024

Issue to track follow up work - #5676

@radical
Copy link
Member Author

radical commented Sep 10, 2024

Internal build for validation - https://dev.azure.com/dnceng/internal/_build/results?buildId=2535499

.. in workload testing as it is required for the internal build.

`Aspire.Hosting.Sdk.Msi.arm64.9.0.0-preview.4.24460.2.nupkg, Aspire.Hosting.Sdk.Msi.x64.9.0.0-preview.4.24460.2.nupkg, Aspire.Hosting.Sdk.Msi.x86.9.0.0-preview.4.24460.2.nupkg, Aspire.ProjectTemplates.Msi.arm64.9.0.0-preview.4.24460.2.nupkg, Aspire.ProjectTemplates.Msi.x64.9.0.0-preview.4.24460.2.nupkg, Aspire.ProjectTemplates.Msi.x86.9.0.0-preview.4.24460.2.nupkg`
…ests

.. like the various hosting integration tests. The run time can vary
especially if docker needs to fetch an image.
@radical radical merged commit b4fc095 into dotnet:main Sep 11, 2024
11 checks passed
@radical radical deleted the switch-9.0 branch September 11, 2024 18:10
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Arcade and Tooling on the repo to use 9.0
3 participants