diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e948ba3..58adae7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,6 +45,10 @@ jobs: 7.0.x 6.0.x 3.1.x + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + dotnet-quality: 'preview' - name: dotnet info run: dotnet --info diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 5a5cafa..7e82124 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -18,6 +18,10 @@ jobs: 7.0.x 6.0.x 3.1.x + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + dotnet-quality: 'preview' - name: dotnet info run: dotnet --info diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 39a2707..0bedda9 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -34,6 +34,10 @@ jobs: 7.0.x 6.0.x 3.1.x + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + dotnet-quality: 'preview' - uses: actions/setup-node@v3 with: diff --git a/Directory.Build.props b/Directory.Build.props index c162063..e8053ec 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,9 +12,10 @@ - 7.0.0 + 8.0.0-rc.2.23479.6 + 7.0.0 6.0.0 - 3.1.26 + 3.1.26 diff --git a/appveyor.yml b/appveyor.yml index 77b803d..21eb51c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,13 @@ install: - gitversion /l console /output buildserver - choco install opencover.portable -y - choco install codecov -y + # Install 8.0 preview + - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk" + - ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null + - ps: Invoke-WebRequest 'https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1' -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" + - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Channel 8.0.1xx -Quality preview -InstallDir $env:DOTNET_INSTALL_DIR' + - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path" + - dotnet --list-sdks cache: - C:\ProgramData\chocolatey\bin -> appveyor.yml, codecov.yml - C:\ProgramData\chocolatey\lib -> appveyor.yml, codecov.yml diff --git a/src/Correlate.Abstractions/Correlate.Abstractions.csproj b/src/Correlate.Abstractions/Correlate.Abstractions.csproj index d655a8d..a2373cd 100644 --- a/src/Correlate.Abstractions/Correlate.Abstractions.csproj +++ b/src/Correlate.Abstractions/Correlate.Abstractions.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;netstandard2.0 + net8.0;net7.0;net6.0;netstandard2.0 Correlate diff --git a/src/Correlate.AspNetCore/Correlate.AspNetCore.csproj b/src/Correlate.AspNetCore/Correlate.AspNetCore.csproj index 2db5675..78c4ff4 100644 --- a/src/Correlate.AspNetCore/Correlate.AspNetCore.csproj +++ b/src/Correlate.AspNetCore/Correlate.AspNetCore.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;netcoreapp3.1 + net8.0;net7.0;net6.0;netcoreapp3.1 Correlate diff --git a/src/Correlate.Core/Correlate.Core.csproj b/src/Correlate.Core/Correlate.Core.csproj index 24d5444..5f59399 100644 --- a/src/Correlate.Core/Correlate.Core.csproj +++ b/src/Correlate.Core/Correlate.Core.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;netstandard2.0 + net8.0;net7.0;net6.0;netstandard2.0 Correlate diff --git a/src/Correlate.DependencyInjection/Correlate.DependencyInjection.csproj b/src/Correlate.DependencyInjection/Correlate.DependencyInjection.csproj index 3fa2c96..79f8877 100644 --- a/src/Correlate.DependencyInjection/Correlate.DependencyInjection.csproj +++ b/src/Correlate.DependencyInjection/Correlate.DependencyInjection.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;netstandard2.0 + net8.0;net7.0;net6.0;netstandard2.0 diff --git a/test/Correlate.AspNetCore.Tests/AspNetCore/CorrelateFeatureTests.cs b/test/Correlate.AspNetCore.Tests/AspNetCore/CorrelateFeatureTests.cs index 7b72de7..7ebbd2a 100644 --- a/test/Correlate.AspNetCore.Tests/AspNetCore/CorrelateFeatureTests.cs +++ b/test/Correlate.AspNetCore.Tests/AspNetCore/CorrelateFeatureTests.cs @@ -194,7 +194,7 @@ public async Task Given_that_response_already_contains_correlation_header_when_f _options.RequestHeaders.Should().NotBeNullOrEmpty(); const string existingCorrelationId = "existing-id"; - _responseFeature.Headers.Add(_options.RequestHeaders[0], existingCorrelationId); + _responseFeature.Headers.Append(_options.RequestHeaders[0], existingCorrelationId); var expectedHeader = new KeyValuePair( _options.RequestHeaders[0], diff --git a/test/Correlate.AspNetCore.Tests/Correlate.AspNetCore.Tests.csproj b/test/Correlate.AspNetCore.Tests/Correlate.AspNetCore.Tests.csproj index ebdbcd4..79819d6 100644 --- a/test/Correlate.AspNetCore.Tests/Correlate.AspNetCore.Tests.csproj +++ b/test/Correlate.AspNetCore.Tests/Correlate.AspNetCore.Tests.csproj @@ -1,12 +1,13 @@  - net7.0;net6.0;netcoreapp3.1 + net8.0;net7.0;net6.0;netcoreapp3.1 true Correlate + diff --git a/test/Correlate.Benchmarks/Correlate.Benchmarks.csproj b/test/Correlate.Benchmarks/Correlate.Benchmarks.csproj index 4815204..19e6a2b 100644 --- a/test/Correlate.Benchmarks/Correlate.Benchmarks.csproj +++ b/test/Correlate.Benchmarks/Correlate.Benchmarks.csproj @@ -1,12 +1,12 @@ - + Exe - net7.0;net6.0 + net8.0;net7.0;net6.0 enable enable false - true + true @@ -14,8 +14,8 @@ - - + + diff --git a/test/Correlate.Benchmarks/Program.cs b/test/Correlate.Benchmarks/Program.cs index 952cf2f..b3981b6 100644 --- a/test/Correlate.Benchmarks/Program.cs +++ b/test/Correlate.Benchmarks/Program.cs @@ -5,18 +5,22 @@ using BenchmarkDotNet.Toolchains.CsProj; using Correlate.Benchmarks; -IToolchain[] toolchains = { CsProjCoreToolchain.NetCoreApp70, CsProjCoreToolchain.NetCoreApp60 }; - -IConfig cfg = DefaultConfig.Instance - .ForAllToolchains(toolchains, Job.Default.WithId("Current"), toolchain => toolchain.Equals(CsProjCoreToolchain.NetCoreApp70)) - .ForAllToolchains(toolchains, - Job.Default - .WithId("4.0.0") - .WithToolchain(CsProjCoreToolchain.NetCoreApp70) - .WithNuGet("Correlate.AspNetCore", "4.0.0") - .WithNuGet("Correlate.DependencyInjection", "4.0.0") - .WithArguments(new[] { new MsBuildArgument("/p:Baseline=false") }) - ); +// To change to .NET 8 once RTM. +IToolchain mostCurrentToolChain = CsProjCoreToolchain.NetCoreApp70; + +Version[] versions = { + new("0.0.0"), // Current + new("4.0.0"), + new("5.1.0") +}; +IToolchain[] toolchains = { CsProjCoreToolchain.NetCoreApp80, CsProjCoreToolchain.NetCoreApp70, CsProjCoreToolchain.NetCoreApp60 }; +IEnumerable<(Version version, IToolchain toolchain)> runs = + from version in versions + from toolchain in toolchains + select (version, toolchain); + +IConfig cfg = runs + .Aggregate(DefaultConfig.Instance, (current, run) => current.ForAllToolchains(run.version, run.toolchain, toolchain => toolchain.Equals(mostCurrentToolChain))); #if RELEASE BenchmarkRunner.Run(cfg); @@ -26,14 +30,32 @@ internal static class ConfigExtensions { - public static IConfig ForAllToolchains(this IConfig config, IEnumerable toolchains, Job job, Func? isBaseline = null) + public static IConfig ForAllToolchains(this IConfig config, Version version, IToolchain toolchain, Func isBaselineToolchain) { - foreach (IToolchain toolchain in toolchains) + bool isCurrentVersion = version.Major == 0; + string label = isCurrentVersion + ? "vNext" + : $"v{version.ToString(3)}"; + + Job job = Job.Default + .WithToolchain(toolchain) + .WithId(label); + + if (!isCurrentVersion) + { + job = job + .WithNuGet("Correlate.AspNetCore", version.ToString(3)) + .WithNuGet("Correlate.DependencyInjection", version.ToString(3)) + .WithArguments(new[] { new MsBuildArgument("/p:CurrentVersion=false") }); + } + else { - Job j = job.WithToolchain(toolchain); - config = config.AddJob(isBaseline?.Invoke(toolchain) ?? false ? j.AsBaseline() : j); + if (isBaselineToolchain(toolchain)) + { + job = job.AsBaseline(); + } } - return config; + return config.AddJob(job); } } diff --git a/test/Correlate.Benchmarks/README.md b/test/Correlate.Benchmarks/README.md index 5198d84..9c7dd7b 100644 --- a/test/Correlate.Benchmarks/README.md +++ b/test/Correlate.Benchmarks/README.md @@ -1,25 +1,31 @@ # Benchmark results ``` -BenchmarkDotNet v0.13.7, Windows 10 (10.0.19045.3324/22H2/2022Update) +BenchmarkDotNet v0.13.9+228a464e8be6c580ad9408e98f18813f6407fb5a, Windows 10 (10.0.19045.3570/22H2/2022Update) Intel Core i7-8700K CPU 3.70GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores -.NET SDK 7.0.400 - [Host] : .NET 7.0.10 (7.0.1023.36312), X64 RyuJIT AVX2 - 4.0.0 : .NET 6.0.21 (6.0.2123.36311), X64 RyuJIT AVX2 - Current : .NET 6.0.21 (6.0.2123.36311), X64 RyuJIT AVX2 +.NET SDK 8.0.100-rc.2.23502.2 + [Host] : .NET 8.0.0 (8.0.23.47906), X64 RyuJIT AVX2 + v4.0.0 : .NET 6.0.23 (6.0.2323.48002), X64 RyuJIT AVX2 + v5.1.0 : .NET 6.0.23 (6.0.2323.48002), X64 RyuJIT AVX2 + vNext : .NET 6.0.23 (6.0.2323.48002), X64 RyuJIT AVX2 ``` -| Method | Job | Arguments | NuGetReferences | Toolchain | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | -|-------- |-------- |------------------ |--------------------------------------------------------------- |---------- |---------:|--------:|--------:|------:|--------:|-------:|----------:|------------:| -| ApiCall | 4.0.0 | /p:Baseline=false | Correlate.AspNetCore 4.0.0,Correlate.DependencyInjection 4.0.0 | .NET 6.0 | 148.2 us | 1.95 us | 1.73 us | 1.02 | 0.02 | 0.4883 | 4.33 KB | 1.11 | -| ApiCall | 4.0.0 | /p:Baseline=false | Correlate.AspNetCore 4.0.0,Correlate.DependencyInjection 4.0.0 | .NET 7.0 | 148.1 us | 0.93 us | 0.87 us | 1.02 | 0.01 | 0.4883 | 4.06 KB | 1.04 | -| ApiCall | Current | Default | Default | .NET 6.0 | 140.2 us | 1.12 us | 1.05 us | 0.96 | 0.01 | 0.4883 | 4.16 KB | 1.07 | -| ApiCall | Current | Default | Default | .NET 7.0 | 145.8 us | 1.07 us | 1.00 us | 1.00 | 0.00 | 0.4883 | 3.91 KB | 1.00 | +| Method | Job | Arguments | NuGetReferences | Toolchain | Mean | Error | StdDev | Median | Ratio | RatioSD | Gen0 | Allocated | Alloc Ratio | +|-------- |------- |------------------------ |--------------------------------------------------------------- |---------- |----------:|---------:|---------:|----------:|------:|--------:|-------:|----------:|------------:| +| ApiCall | v4.0.0 | /p:CurrentVersion=false | Correlate.AspNetCore 4.0.0,Correlate.DependencyInjection 4.0.0 | .NET 6.0 | 100.84 us | 2.002 us | 3.997 us | 99.29 us | 1.07 | 0.04 | 0.4883 | 4.33 KB | 1.11 | +| ApiCall | v4.0.0 | /p:CurrentVersion=false | Correlate.AspNetCore 4.0.0,Correlate.DependencyInjection 4.0.0 | .NET 7.0 | 100.84 us | 0.668 us | 0.625 us | 100.74 us | 1.02 | 0.01 | 0.4883 | 4.06 KB | 1.04 | +| ApiCall | v4.0.0 | /p:CurrentVersion=false | Correlate.AspNetCore 4.0.0,Correlate.DependencyInjection 4.0.0 | .NET 8.0 | 88.61 us | 0.517 us | 0.483 us | 88.82 us | 0.90 | 0.01 | 0.4883 | 3.87 KB | 0.99 | +| ApiCall | v5.1.0 | /p:CurrentVersion=false | Correlate.AspNetCore 5.1.0,Correlate.DependencyInjection 5.1.0 | .NET 6.0 | 94.88 us | 0.793 us | 0.742 us | 94.91 us | 0.96 | 0.01 | 0.4883 | 4.17 KB | 1.07 | +| ApiCall | v5.1.0 | /p:CurrentVersion=false | Correlate.AspNetCore 5.1.0,Correlate.DependencyInjection 5.1.0 | .NET 7.0 | 98.08 us | 0.588 us | 0.550 us | 98.15 us | 1.00 | 0.01 | 0.4883 | 3.91 KB | 1.00 | +| ApiCall | v5.1.0 | /p:CurrentVersion=false | Correlate.AspNetCore 5.1.0,Correlate.DependencyInjection 5.1.0 | .NET 8.0 | 84.91 us | 0.578 us | 0.540 us | 84.89 us | 0.86 | 0.01 | 0.4883 | 3.75 KB | 0.96 | +| ApiCall | vNext | Default | Default | .NET 6.0 | 94.09 us | 0.306 us | 0.286 us | 94.09 us | 0.96 | 0.01 | 0.4883 | 4.17 KB | 1.07 | +| ApiCall | vNext | Default | Default | .NET 7.0 | 98.39 us | 0.532 us | 0.498 us | 98.29 us | 1.00 | 0.00 | 0.4883 | 3.91 KB | 1.00 | +| ApiCall | vNext | Default | Default | .NET 8.0 | 85.84 us | 0.854 us | 0.799 us | 85.88 us | 0.87 | 0.01 | 0.4883 | 3.75 KB | 0.96 | ### CLI To run the benchmark: ``` cd ./test/Correlate.Benchmarks -dotnet run -c Release -f net7.0 net6.0 +dotnet run -c Release -f net8.0 net7.0 net6.0 ``` diff --git a/test/Correlate.Core.Tests/Correlate.Core.Tests.csproj b/test/Correlate.Core.Tests/Correlate.Core.Tests.csproj index ed61729..10f4107 100644 --- a/test/Correlate.Core.Tests/Correlate.Core.Tests.csproj +++ b/test/Correlate.Core.Tests/Correlate.Core.Tests.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;netcoreapp3.1 + net8.0;net7.0;net6.0;netcoreapp3.1 true Correlate diff --git a/test/Correlate.DependencyInjection.Tests/Correlate.DependencyInjection.Tests.csproj b/test/Correlate.DependencyInjection.Tests/Correlate.DependencyInjection.Tests.csproj index f3d84cd..e8e1eea 100644 --- a/test/Correlate.DependencyInjection.Tests/Correlate.DependencyInjection.Tests.csproj +++ b/test/Correlate.DependencyInjection.Tests/Correlate.DependencyInjection.Tests.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;netcoreapp3.1 + net8.0;net7.0;net6.0;netcoreapp3.1 true Correlate.DependencyInjection diff --git a/test/Correlate.Testing/Correlate.Testing.csproj b/test/Correlate.Testing/Correlate.Testing.csproj index d264c77..06e458c 100644 --- a/test/Correlate.Testing/Correlate.Testing.csproj +++ b/test/Correlate.Testing/Correlate.Testing.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;netstandard2.1 + net8.0;net7.0;net6.0;netstandard2.1 false