Skip to content

Commit

Permalink
Run tests and examples against .NET 9 RC2
Browse files Browse the repository at this point in the history
  • Loading branch information
bkoelman committed Oct 16, 2024
1 parent eb2ef95 commit 2aea6a3
Show file tree
Hide file tree
Showing 24 changed files with 100 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2024.2.6",
"version": "2024.3.0-eap04",
"commands": [
"jb"
],
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
- name: Setup .NET 9 (unstable)
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
dotnet-quality: 'preview'
- name: Show installed versions
shell: pwsh
run: |
Expand Down Expand Up @@ -166,6 +172,12 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
- name: Setup .NET 9 (unstable)
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
- name: Restore tools
Expand Down Expand Up @@ -221,6 +233,12 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
- name: Setup .NET 9 (unstable)
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
dotnet-version: |
6.0.x
8.0.x
- name: Setup .NET 9 (unstable)
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v4
- name: Initialize CodeQL
Expand Down
8 changes: 8 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
<NoWarn>$(NoWarn);$(UseCollectionExpressionRules)</NoWarn>
</PropertyGroup>

<!-- Specific to .NET 9 RC -->
<PropertyGroup>
<LangVersion>preview</LangVersion>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<NuGetAuditMode>direct</NuGetAuditMode>
<NoWarn>$(NoWarn);NU1608;NETSDK1215</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<NoWarn>$(NoWarn);AV2210</NoWarn>
</PropertyGroup>
Expand Down
9 changes: 9 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="pomelo-nightly"
value="https://pkgs.dev.azure.com/pomelo-efcore/Pomelo.EntityFrameworkCore.MySql/_packaging/pomelo-efcore-public/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
16 changes: 16 additions & 0 deletions package-versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@
<XunitVisualStudioVersion>2.8.*</XunitVisualStudioVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!-- Published dependencies (only update on major version change) -->
<EntityFrameworkCoreFrozenVersion>N/A</EntityFrameworkCoreFrozenVersion>

<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
<AspNetCoreVersion>9.0.*-*</AspNetCoreVersion>
<EntityFrameworkCoreVersion>9.0.0-rtm.24508.5</EntityFrameworkCoreVersion>
<EntityFrameworkCorePostgreSQLVersion>9.0.0-rc.2</EntityFrameworkCorePostgreSQLVersion>
<EntityFrameworkCorePomeloVersion>9.0.0-*</EntityFrameworkCorePomeloVersion>
<SystemTextJsonVersion>$(AspNetCoreVersion)</SystemTextJsonVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<!-- Published dependencies (only update on major version change) -->
<EntityFrameworkCoreFrozenVersion>8.0.0</EntityFrameworkCoreFrozenVersion>

<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
<AspNetCoreVersion>8.0.*</AspNetCoreVersion>
<EntityFrameworkCoreVersion>8.0.*</EntityFrameworkCoreVersion>
<EntityFrameworkCorePostgreSQLVersion>$(EntityFrameworkCoreVersion)</EntityFrameworkCorePostgreSQLVersion>
<EntityFrameworkCorePomeloVersion>$(EntityFrameworkCoreVersion)</EntityFrameworkCorePomeloVersion>
<SystemTextJsonVersion>$(AspNetCoreVersion)</SystemTextJsonVersion>
</PropertyGroup>

Expand All @@ -38,6 +52,8 @@
<AspNetCoreVersion>6.0.*</AspNetCoreVersion>
<DateOnlyTimeOnlyVersion>2.1.*</DateOnlyTimeOnlyVersion>
<EntityFrameworkCoreVersion>7.0.*</EntityFrameworkCoreVersion>
<EntityFrameworkCorePostgreSQLVersion>$(EntityFrameworkCoreVersion)</EntityFrameworkCorePostgreSQLVersion>
<EntityFrameworkCorePomeloVersion>$(EntityFrameworkCoreVersion)</EntityFrameworkCorePomeloVersion>
<SystemTextJsonVersion>8.0.*</SystemTextJsonVersion>
</PropertyGroup>
</Project>
11 changes: 8 additions & 3 deletions src/Examples/DapperExample/DapperExample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand All @@ -15,7 +15,12 @@
<PackageReference Include="Dapper" Version="$(DapperVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCorePostgreSQLVersion)" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="$(EntityFrameworkCorePomeloVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!-- Temporary workaround for version range constraint on Pomelo.EntityFrameworkCore.MySql pre-release package -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreVersion)" />
</ItemGroup>
</Project>
9 changes: 7 additions & 2 deletions src/Examples/DapperExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@
}
case DatabaseProvider.MySql:
{
builder.Services.AddMySql<AppDbContext>(connectionString, ServerVersion.AutoDetect(connectionString),
optionsAction: options => SetDbContextDebugOptions(options));
#if NET9_0_OR_GREATER
ServerVersion serverVersion = await ServerVersion.AutoDetectAsync(connectionString);
#else
ServerVersion serverVersion = ServerVersion.AutoDetect(connectionString);
#endif

builder.Services.AddMySql<AppDbContext>(connectionString, serverVersion, optionsAction: options => SetDbContextDebugOptions(options));

break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand All @@ -13,6 +13,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCorePostgreSQLVersion)" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Examples/GettingStarted/GettingStarted.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand All @@ -13,6 +13,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCorePostgreSQLVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/ReportsExample/ReportsExample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion test/AnnotationTests/AnnotationTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion test/DapperTests/DapperTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion test/DiscoveryTests/DiscoveryTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion test/MultiDbContextTests/MultiDbContextTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand Down
7 changes: 6 additions & 1 deletion test/SourceGeneratorTests/SourceGeneratorTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand All @@ -17,4 +17,9 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(CodeAnalysisVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0' Or '$(BuildingInsideVisualStudio)' == 'true'">
<!-- Temporary workaround for version range constraint on Npgsql.EntityFrameworkCore.PostgreSQL pre-release package -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreVersion)" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions test/TestBuildingBlocks/CapturingLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ public sealed class CapturingLoggerProvider : ILoggerProvider
private static readonly Func<string, LogLevel, bool> DefaultFilter = (_, _) => true;
private readonly Func<string, LogLevel, bool> _filter;

#if NET9_0_OR_GREATER
private readonly Lock _lockObject = new();
#else
private readonly object _lockObject = new();
#endif
private readonly List<LogMessage> _messages = [];

public CapturingLoggerProvider()
Expand Down
4 changes: 2 additions & 2 deletions test/TestBuildingBlocks/TestBuildingBlocks.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand All @@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCorePostgreSQLVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVisualStudioVersion)" PrivateAssets="All" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\package-versions.props" />
Expand Down

0 comments on commit 2aea6a3

Please sign in to comment.