Add .Net 7 (#853)

* Add .NET 7

* UseDotNet

* 7

* Ubuntu 6

* 'Use .NET 7'

* 67

* .

* use 7

* use 7

* test = 7

* coverage.7.0.opencover.xml
This commit is contained in:
Stef Heyenrath
2022-12-03 11:03:57 +01:00
committed by GitHub
parent be1cbc5a12
commit 795dcf42e2
14 changed files with 59 additions and 31 deletions

View File

@@ -5,8 +5,16 @@ variables:
buildConfiguration: 'Release' buildConfiguration: 'Release'
steps: steps:
- task: UseDotNet@2
displayName: 'Use .NET 7'
inputs:
packageType: sdk
version: 7.0.x
- script: | - script: |
dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --configuration $(buildConfiguration) --framework net6.0 --logger trx dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --configuration $(buildConfiguration) --framework net7.0 --logger trx
displayName: 'Test'
- task: PublishTestResults@2 - task: PublishTestResults@2
inputs: inputs:
testRunner: VSTest testRunner: VSTest

View File

@@ -14,6 +14,12 @@ jobs:
echo "BuildId = $(buildId)" echo "BuildId = $(buildId)"
displayName: 'Print buildId' displayName: 'Print buildId'
- task: UseDotNet@2
displayName: Use .NET 7.0
inputs:
packageType: 'sdk'
version: '7.0.x'
- task: PowerShell@2 - task: PowerShell@2
displayName: "Use JDK11 by default" displayName: "Use JDK11 by default"
inputs: inputs:
@@ -35,18 +41,18 @@ jobs:
projectKey: 'WireMock-Net_WireMock.Net' projectKey: 'WireMock-Net_WireMock.Net'
projectName: 'WireMock.Net' projectName: 'WireMock.Net'
extraProperties: | extraProperties: |
sonar.cs.opencover.reportsPaths=**/coverage.net6.0.opencover.xml sonar.cs.opencover.reportsPaths=**/coverage.net7.0.opencover.xml
- task: DotNetCoreCLI@2 - task: DotNetCoreCLI@2
displayName: 'Build Unit tests' displayName: 'Build Unit tests'
inputs: inputs:
command: 'build' command: 'build'
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
arguments: '--configuration Debug --framework net6.0' arguments: '--configuration Debug --framework net7.0'
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: 'dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net6.0' script: 'dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net7.0'
displayName: 'Execute Unit Tests with Coverage' displayName: 'Execute Unit Tests with Coverage'
- task: SonarCloudAnalyze@1 - task: SonarCloudAnalyze@1
@@ -62,7 +68,7 @@ jobs:
condition: and(succeeded(), eq(variables['RUN_WHITESOURCE'], 'yes')) condition: and(succeeded(), eq(variables['RUN_WHITESOURCE'], 'yes'))
- script: | - script: |
bash <(curl https://codecov.io/bash) -t $(CODECOV_TOKEN) -f ./test/WireMock.Net.Tests/coverage.net6.0.opencover.xml bash <(curl https://codecov.io/bash) -t $(CODECOV_TOKEN) -f ./test/WireMock.Net.Tests/coverage.7.0.opencover.xml
displayName: 'codecov' displayName: 'codecov'
- task: PublishTestResults@2 - task: PublishTestResults@2
@@ -74,7 +80,7 @@ jobs:
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
displayName: Publish coverage file displayName: Publish coverage file
inputs: inputs:
PathtoPublish: './test/WireMock.Net.Tests/coverage.net6.0.opencover.xml' PathtoPublish: './test/WireMock.Net.Tests/coverage.net7.0.opencover.xml'
- job: Windows_Build_Test - job: Windows_Build_Test
@@ -83,24 +89,24 @@ jobs:
steps: steps:
- task: UseDotNet@2 - task: UseDotNet@2
displayName: Use .NET 6.0 displayName: Use .NET 7.0
inputs: inputs:
packageType: 'sdk' packageType: 'sdk'
version: '6.0.x' version: '7.0.x'
- task: DotNetCoreCLI@2 - task: DotNetCoreCLI@2
displayName: 'Build Unit tests' displayName: 'Build Unit tests'
inputs: inputs:
command: 'build' command: 'build'
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
arguments: '--configuration Debug --framework net6.0' arguments: '--configuration Debug --framework net7.0'
- task: DotNetCoreCLI@2 - task: DotNetCoreCLI@2
displayName: 'Execute Unit tests' displayName: 'Execute Unit Tests with Coverage'
inputs: inputs:
command: 'test' command: 'test'
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
arguments: '--no-build --configuration Debug --framework net6.0 --collect:"XPlat Code Coverage" --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover' arguments: '--no-build --configuration Debug --framework net7.0 --collect:"XPlat Code Coverage" --logger trx'
- job: Windows_Release_to_MyGet - job: Windows_Release_to_MyGet
dependsOn: Windows_Build_Test dependsOn: Windows_Build_Test
@@ -110,10 +116,10 @@ jobs:
steps: steps:
- task: UseDotNet@2 - task: UseDotNet@2
displayName: Use .NET 6.0 displayName: Use .NET 7.0
inputs: inputs:
packageType: 'sdk' packageType: 'sdk'
version: '6.0.x' version: '7.0.x'
- task: DotNetCoreCLI@2 - task: DotNetCoreCLI@2
displayName: Build Release displayName: Build Release

View File

@@ -9,6 +9,12 @@ variables:
buildConfiguration: 'Release' buildConfiguration: 'Release'
steps: steps:
- task: UseDotNet@2
displayName: 'Use .NET 7'
inputs:
packageType: sdk
version: 7.0.x
- task: DotNetCoreCLI@2 - task: DotNetCoreCLI@2
displayName: Build Release displayName: Build Release
inputs: inputs:

View File

@@ -12,6 +12,12 @@ steps:
echo "BuildId = $(buildId)" echo "BuildId = $(buildId)"
displayName: 'Print buildId' displayName: 'Print buildId'
- task: UseDotNet@2
displayName: 'Use .NET 7'
inputs:
packageType: sdk
version: 7.0.x
# Based on https://whereslou.com/2018/09/versioning-and-publishing-nuget-packages-automatically-using-azure-devops-pipelines/ # Based on https://whereslou.com/2018/09/versioning-and-publishing-nuget-packages-automatically-using-azure-devops-pipelines/
- task: DotNetCoreCLI@2 - task: DotNetCoreCLI@2
displayName: Build Release displayName: Build Release

View File

@@ -154,8 +154,8 @@ internal class CSharpCodeMatcher : ICSharpCodeMatcher
throw new WireMockException("CSharpCodeMatcher: Problem calling method 'IsMatch' in WireMock.CodeHelper", ex); throw new WireMockException("CSharpCodeMatcher: Problem calling method 'IsMatch' in WireMock.CodeHelper", ex);
} }
#elif (NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0 || NET6_0) #elif (NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0)
Assembly assembly; Assembly assembly;
try try
{ {
assembly = CSScriptLib.CSScript.Evaluator.CompileCode(source); assembly = CSScriptLib.CSScript.Evaluator.CompileCode(source);

View File

@@ -4,7 +4,7 @@
<Description>A CSharpCodeMatcher which can be used to match WireMock.Net Requests using C# code.</Description> <Description>A CSharpCodeMatcher which can be used to match WireMock.Net Requests using C# code.</Description>
<AssemblyTitle>WireMock.Net.Matchers.CSharpCode</AssemblyTitle> <AssemblyTitle>WireMock.Net.Matchers.CSharpCode</AssemblyTitle>
<Authors>Stef Heyenrath</Authors> <Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks> <TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>wiremock;matchers;matcher;csharp;csharpcode</PackageTags> <PackageTags>wiremock;matchers;matcher;csharp;csharpcode</PackageTags>
<RootNamespace>WireMock</RootNamespace> <RootNamespace>WireMock</RootNamespace>
@@ -45,7 +45,7 @@
<PackageReference Include="CS-Script" Version="3.30.3" /> <PackageReference Include="CS-Script" Version="3.30.3" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0'"> <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'">
<PackageReference Include="CS-Script" Version="4.4.2" /> <PackageReference Include="CS-Script" Version="4.4.2" />
</ItemGroup> </ItemGroup>

View File

@@ -3,7 +3,7 @@
<Description>Lightweight StandAlone Http Mocking Server for .Net.</Description> <Description>Lightweight StandAlone Http Mocking Server for .Net.</Description>
<AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle> <AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle>
<Authors>Stef Heyenrath</Authors> <Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks> <TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>WireMock.Net.StandAlone</AssemblyName> <AssemblyName>WireMock.Net.StandAlone</AssemblyName>
<PackageId>WireMock.Net.StandAlone</PackageId> <PackageId>WireMock.Net.StandAlone</PackageId>

View File

@@ -9,7 +9,7 @@ internal static class HttpClientBuilder
{ {
public static HttpClient Build(HttpClientSettings settings) public static HttpClient Build(HttpClientSettings settings)
{ {
#if NETSTANDARD || NETCOREAPP3_1 || NET5_0 || NET6_0 #if NETSTANDARD || NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
var handler = new HttpClientHandler var handler = new HttpClientHandler
{ {
CheckCertificateRevocationList = false, CheckCertificateRevocationList = false,

View File

@@ -1,4 +1,4 @@
#if NETCOREAPP3_1 || NET5_0 || NET6_0 #if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using WireMock.Types; using WireMock.Types;

View File

@@ -69,7 +69,7 @@ namespace WireMock.Owin
services.AddSingleton<IOwinRequestMapper, OwinRequestMapper>(); services.AddSingleton<IOwinRequestMapper, OwinRequestMapper>();
services.AddSingleton<IOwinResponseMapper, OwinResponseMapper>(); services.AddSingleton<IOwinResponseMapper, OwinResponseMapper>();
#if NETCOREAPP3_1 || NET5_0 || NET6_0 #if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
AddCors(services); AddCors(services);
#endif #endif
_wireMockMiddlewareOptions.AdditionalServiceRegistration?.Invoke(services); _wireMockMiddlewareOptions.AdditionalServiceRegistration?.Invoke(services);
@@ -78,7 +78,7 @@ namespace WireMock.Owin
{ {
appBuilder.UseMiddleware<GlobalExceptionMiddleware>(); appBuilder.UseMiddleware<GlobalExceptionMiddleware>();
#if NETCOREAPP3_1 || NET5_0 || NET6_0 #if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
UseCors(appBuilder); UseCors(appBuilder);
#endif #endif
_wireMockMiddlewareOptions.PreWireMockMiddlewareInit?.Invoke(appBuilder); _wireMockMiddlewareOptions.PreWireMockMiddlewareInit?.Invoke(appBuilder);
@@ -137,6 +137,8 @@ namespace WireMock.Owin
_logger.Info("Server using .NET 5.0"); _logger.Info("Server using .NET 5.0");
#elif NET6_0 #elif NET6_0
_logger.Info("Server using .NET 6.0"); _logger.Info("Server using .NET 6.0");
#elif NET7_0
_logger.Info("Server using .NET 7.0");
#elif NET46 #elif NET46
_logger.Info("Server using .NET Framework 4.6.1 or higher"); _logger.Info("Server using .NET Framework 4.6.1 or higher");
#endif #endif

View File

@@ -3,7 +3,7 @@
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description> <Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
<AssemblyTitle>WireMock.Net</AssemblyTitle> <AssemblyTitle>WireMock.Net</AssemblyTitle>
<Authors>Stef Heyenrath</Authors> <Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks> <TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>WireMock.Net</AssemblyName> <AssemblyName>WireMock.Net</AssemblyName>
<PackageId>WireMock.Net</PackageId> <PackageId>WireMock.Net</PackageId>
@@ -38,7 +38,7 @@
<DefineConstants>NETSTANDARD;USE_ASPNETCORE</DefineConstants> <DefineConstants>NETSTANDARD;USE_ASPNETCORE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp2.2' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0'or '$(TargetFramework)' == 'net6.0' "> <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp2.2' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0'or '$(TargetFramework)' == 'net7.0' ">
<DefineConstants>USE_ASPNETCORE</DefineConstants> <DefineConstants>USE_ASPNETCORE</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -135,7 +135,7 @@
<PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.6" /> <PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.6" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' "> <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" /> <FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Scriban.Signed" Version="5.5.0" /> <PackageReference Include="Scriban.Signed" Version="5.5.0" />
</ItemGroup> </ItemGroup>

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<PackAsTool>true</PackAsTool> <PackAsTool>true</PackAsTool>
<ToolCommandName>dotnet-wiremock</ToolCommandName> <ToolCommandName>dotnet-wiremock</ToolCommandName>
<Description>A dotnet commandline tool for WireMock.Net (A Lightweight Http Mocking Server for .NET)</Description> <Description>A dotnet commandline tool for WireMock.Net (A Lightweight Http Mocking Server for .NET)</Description>
@@ -16,8 +16,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.0" /> <PackageReference Include="System.Text.Json" Version="7.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Authors>Stef Heyenrath</Authors> <Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net452;net461;netcoreapp3.1;net5.0;net6.0</TargetFrameworks> <TargetFrameworks>net452;net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<AssemblyName>WireMock.Net.Tests</AssemblyName> <AssemblyName>WireMock.Net.Tests</AssemblyName>

View File

@@ -110,8 +110,8 @@ public partial class WireMockServerTests
server.Stop(); server.Stop();
} }
#if NETCOREAPP3_1 || NET5_0 || NET6_0 #if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
[Fact] [Fact]
public async Task WireMockServer_WithCorsPolicyOptions_Should_Work_Correct() public async Task WireMockServer_WithCorsPolicyOptions_Should_Work_Correct()
{ {
// Arrange // Arrange