Skip to content

Commit

Permalink
Update to .NET 9 GA. Update some test dependencies. (#2990)
Browse files Browse the repository at this point in the history
* Update to .NET 9 GA. Update some test dependencies.

* Remove installing extra SDKs in YAML.

* Add TargetNetNext flag.

* Update template-Build-run-tests-sign.yml

* Nit.

* Update aot-check.yml

* Update yaml.

* Fix AOT test.

* Add strong name bypass
  • Loading branch information
pmaytak authored Nov 14, 2024
1 parent 658e4e5 commit f604488
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 63 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/aot-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ on:
jobs:
analyze:
runs-on: windows-latest
name: Wilson GitHub AOT check
name: "AOT check"

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup .NET 9.0.x
uses: actions/[email protected]
with:
dotnet-version: 9.0.x

- name: Runs powershell script
id: aot-powershell
run: build\test-aot.ps1 'net8.0'
Expand Down
37 changes: 16 additions & 21 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET Core
name: "Run unit tests"

permissions:
contents: read
Expand All @@ -18,48 +18,43 @@ on:
- dev

env:
TargetNet9: True
TargetNet8: True
TargetNetNext: True

jobs:
build:
runs-on: windows-latest
continue-on-error: true
name: Wilson GitHub Action Test
continue-on-error: false
name: "Build and run unit tests"
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Setup .NET 6.0.x
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Setup .NET 8.0.x
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
- name: Setup .NET 9.0.x
uses: actions/[email protected]

- name: Setup .NET 9.x
uses: actions/[email protected]
with:
dotnet-version: 9.0.100-rc.2.24474.11
dotnet-version: 9.x

- name: Strong name bypass
run: |
regedit /s .\build\strongNameBypass.reg
- name: Run the tests
run: dotnet test Wilson.sln --collect:"XPlat Code Coverage" --settings:./build/CodeCoverage.runsettings

- name: Create code coverage report
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool
dotnet tool install -g dotnet-reportgenerator-globaltool --version 5.4.1
reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:CodeCoverage -reporttypes:'MarkdownSummaryGithub;Cobertura'
- name: Write Coverage to Job Summary
- name: Write coverage to job summary
shell: bash
run: |
cat CodeCoverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
echo "COMMENT_CONTENT_ENV_VAR<<EOF" >> $GITHUB_ENV
echo $(cat CodeCoverage/SummaryGithub.md) >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Comment Coverage in PR
- name: Comment coverage in PR
uses: actions/github-script@v7
id: comment
with:
Expand All @@ -73,4 +68,4 @@ jobs:
# Run baseline package validation
- name: Pack
run: dotnet pack Product.proj --no-restore --no-build
run: dotnet pack Product.proj --no-restore --no-build
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<AssemblyName>Microsoft.IdentityModel.Benchmarks</AssemblyName>
<PackageId>Microsoft.IdentityModel.Benchmarks</PackageId>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetNet9)'== 'True'">$(TargetFrameworks); net9.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetNetNext)'== 'True'">$(TargetFrameworks); </TargetFrameworks>
<SignAssembly>True</SignAssembly>
<DelaySign>True</DelaySign>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\..\build\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
Expand Down
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

<ItemGroup>
<!-- Protects against sync-over-async: https://github.com/microsoft/vs-threading/blob/main/doc/analyzers/index.md. -->
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" PrivateAssets="All"/>
</ItemGroup>

Expand Down
8 changes: 4 additions & 4 deletions build/dependenciesTest.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<BannedApiAnalyzersVersion>3.3.4</BannedApiAnalyzersVersion>
<DotNetCoreAppRuntimeVersion>2.1.30</DotNetCoreAppRuntimeVersion>
<MicrosoftAzureKeyVaultCryptographyVersion>3.0.5</MicrosoftAzureKeyVaultCryptographyVersion>
<MicrosoftNETTestSdkVersion>17.11.0</MicrosoftNETTestSdkVersion>
<MicrosoftNETTestSdkVersion>17.11.1</MicrosoftNETTestSdkVersion>
<NetStandardVersion>2.0.3</NetStandardVersion>
<NewtonsoftVersion>13.0.3</NewtonsoftVersion>
<SystemNetHttp>4.3.4</SystemNetHttp>
<SystemSecurityClaimsVersion>4.3.0</SystemSecurityClaimsVersion>
<SystemTextJson>8.0.5</SystemTextJson>
<SystemTextRegularExpressions>4.3.1</SystemTextRegularExpressions>
<XunitRunnerConsoleVersion>2.9.0</XunitRunnerConsoleVersion>
<XunitRunnerConsoleVersion>2.9.2</XunitRunnerConsoleVersion>
<XunitRunnerVisualStudioVersion>2.8.2</XunitRunnerVisualStudioVersion>
<XunitVersion>2.9.0</XunitVersion>
<XunitVersion>2.9.2</XunitVersion>
<MicrosoftRestClientRuntimeVersion>2.3.24</MicrosoftRestClientRuntimeVersion>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">
<XunitRunnerVisualStudioVersion>3.0.0-pre.35</XunitRunnerVisualStudioVersion>
<XunitRunnerVisualStudioVersion>3.0.0-pre.49</XunitRunnerVisualStudioVersion>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions build/targets.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<SrcTargets Condition="'$(LocalBuild)' != 'True'">net462;net472;netstandard2.0;net6.0;net8.0</SrcTargets>
<SrcTargets Condition="'$(LocalBuild)' == 'True'">netstandard2.0;net8.0</SrcTargets>
<SrcTargets Condition="'$(TargetNet9)' == 'True'">$(SrcTargets);net9.0</SrcTargets>
<SrcTargets Condition="'$(LocalBuild)' != 'True'">net462;net472;netstandard2.0;net6.0;net8.0;net9.0</SrcTargets>
<SrcTargets Condition="'$(LocalBuild)' == 'True'">netstandard2.0;net8.0;net9.0</SrcTargets>
<SrcTargets Condition="'$(TargetNetNext)'== 'True'">$(SrcTargets);</SrcTargets>
</PropertyGroup>
</Project>
8 changes: 4 additions & 4 deletions build/targetsTest.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TestTargets Condition="'$(LocalBuild)' != 'True'">net462;net472;net6.0;net8.0</TestTargets>
<TestTargets Condition="'$(LocalBuild)' == 'True'">net8.0</TestTargets>
<TestTargets Condition="'$(TargetNet9)' == 'True'">$(TestTargets);net9.0</TestTargets>
</PropertyGroup>
<TestTargets Condition="'$(LocalBuild)' != 'True'">net462;net472;net6.0;net8.0;net9.0</TestTargets>
<TestTargets Condition="'$(LocalBuild)' == 'True'">net8.0;net9.0</TestTargets>
<TestTargets Condition="'$(TargetNetNext)'== 'True'">$(TestTargets);</TestTargets>
</PropertyGroup>
</Project>
23 changes: 2 additions & 21 deletions build/template-Build-run-tests-sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,11 @@ steps:
- script: echo $(MicrosoftIdentityModelVersion)
displayName: 'display MicrosoftIdentityModelVersion'

- task: UseDotNet@2
displayName: 'Use .NET Core sdk 2.x'
inputs:
version: 2.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: 6.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: UseDotNet@2
displayName: 'Use .NET Core sdk 8.x'
inputs:
version: 8.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: UseDotNet@2
displayName: 'Use .Net Core SDK 9.x'
inputs:
version: 9.0.100-rc.2.24474.11
includePreviewVersions: true
condition: eq(variables['TargetNet9'], 'True')
version: 9.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: DotNetCoreCLI@2
displayName: 'dotnet --list-sdks'
Expand Down
2 changes: 1 addition & 1 deletion build/test-aot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ param([string]$targetNetFramework)

$projectName='Microsoft.IdentityModel.AotCompatibility.TestApp'
$rootDirectory = Split-Path $PSScriptRoot -Parent
$publishOutput = dotnet publish $rootDirectory/test/$projectName/$projectName.csproj --self-contained -nodeReuse:false /p:UseSharedCompilation=false
$publishOutput = dotnet publish $rootDirectory/test/$projectName/$projectName.csproj --self-contained --framework $targetNetFramework -nodeReuse:false /p:UseSharedCompilation=false

$actualWarningCount = 0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks Condition="'$(TargetNet9)' == 'True'">$(TargetFramework); net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetNetNext)'== 'True'">$(TargetFrameworks);</TargetFrameworks>
<OutputType>Exe</OutputType>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public void EnsureAotCompatibility()
string testAppPath = Path.Combine("..", "..", "..", "..", "Microsoft.IdentityModel.AotCompatibility.TestApp");
string testAppProject = "Microsoft.IdentityModel.AotCompatibility.TestApp.csproj";

#if NET9_0_OR_GREATER
string framework = "net9.0";
#else
string framework = "net8.0";
#endif

// ensure we run a clean publish every time
DirectoryInfo testObjDir = new DirectoryInfo(Path.Combine(testAppPath, "obj"));
if (testObjDir.Exists)
Expand All @@ -47,7 +53,7 @@ public void EnsureAotCompatibility()

var process = new Process();
// set '-nodereuse:false /p:UseSharedCompilation=false' so the MSBuild and Roslyn server processes don't hang around, which may hang the test in CI
process.StartInfo = new ProcessStartInfo("dotnet", $"publish {testAppProject} --self-contained -nodereuse:false /p:UseSharedCompilation=false")
process.StartInfo = new ProcessStartInfo("dotnet", $"publish {testAppProject} --self-contained --framework {framework} -nodereuse:false /p:UseSharedCompilation=false")
{
RedirectStandardOutput = true,
UseShellExecute = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<PropertyGroup>
<!-- This test only needs to run on .NET -->
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetNet9)'== 'True'">$(TargetFrameworks);net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetNetNext)'== 'True'">$(TargetFrameworks);</TargetFrameworks>
<langversion>12</langversion>
<Version>1.0.0-preview</Version>
</PropertyGroup>
Expand Down

0 comments on commit f604488

Please sign in to comment.