feat: Add .NET Standard 2.0 target
This commit is contained in:
+25
-23
@@ -26,39 +26,41 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v3.1.0
|
||||||
- uses: actions/setup-dotnet@v3.0.3
|
- uses: actions/setup-dotnet@v3.0.3
|
||||||
|
with:
|
||||||
|
dotnet-version: |
|
||||||
|
3.1.x
|
||||||
|
5.0.x
|
||||||
|
6.0.x
|
||||||
|
7.0.x
|
||||||
- run: dotnet restore
|
- run: dotnet restore
|
||||||
|
- run: dotnet build --configuration Release --no-restore /warnAsError /nologo /clp:NoSummary
|
||||||
- name: Build
|
|
||||||
run: >
|
|
||||||
dotnet build
|
|
||||||
--configuration Release
|
|
||||||
--no-restore
|
|
||||||
/warnAsError
|
|
||||||
/nologo
|
|
||||||
/clp:NoSummary
|
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: >
|
run: dotnet test -p:CollectCoverage=true --configuration Release --no-build
|
||||||
dotnet test
|
|
||||||
-p:CollectCoverage=true
|
|
||||||
-p:CoverletOutput=TestResults/
|
|
||||||
-p:CoverletOutputFormat=opencover
|
|
||||||
--configuration Release
|
|
||||||
--no-build
|
|
||||||
env:
|
env:
|
||||||
Nordigen__SecretId: ${{ secrets.NORDIGEN_SECRET_ID }}
|
Nordigen__SecretId: ${{ secrets.NORDIGEN_SECRET_ID }}
|
||||||
Nordigen__SecretKey: ${{ secrets.NORDIGEN_SECRET_KEY }}
|
Nordigen__SecretKey: ${{ secrets.NORDIGEN_SECRET_KEY }}
|
||||||
|
|
||||||
- name: ReSharper annotations
|
|
||||||
uses: VMelnalksnis/resharper-inspect-action@v0.2.5
|
|
||||||
with:
|
|
||||||
solution: NordigenDotNet.sln
|
|
||||||
resharper-version: 2022.1.2
|
|
||||||
treat-warnings-as-errors: true
|
|
||||||
|
|
||||||
- name: Gather Code Coverage
|
- name: Gather Code Coverage
|
||||||
if: github.event.schedule == null
|
if: github.event.schedule == null
|
||||||
uses: codecov/codecov-action@v3.1.1
|
uses: codecov/codecov-action@v3.1.1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
|
||||||
|
resharper:
|
||||||
|
name: Resharper
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: false #ReSharper currently does not support .NET 7
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3.1.0
|
||||||
|
- uses: actions/setup-dotnet@v3.0.3
|
||||||
|
- run: dotnet restore
|
||||||
|
- run: dotnet build --configuration Release --no-restore /warnAsError /nologo /clp:NoSummary
|
||||||
|
|
||||||
|
- name: ReSharper annotations
|
||||||
|
uses: VMelnalksnis/resharper-inspect-action@v0.2.5
|
||||||
|
with:
|
||||||
|
solution: NordigenDotNet.sln
|
||||||
|
resharper-version: 2022.1.2
|
||||||
|
treat-warnings-as-errors: true
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<DebugType>portable</DebugType>
|
<DebugType>portable</DebugType>
|
||||||
@@ -31,6 +33,17 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||||
|
<PackageReference Include="IsExternalInit" Version="1.0.3">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Nullable" Version="1.3.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
|
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
|
||||||
<Link>stylecop.json</Link>
|
<Link>stylecop.json</Link>
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "6.0.400",
|
"version": "7.0.100",
|
||||||
"rollForward": "latestFeature",
|
"rollForward": "latestFeature",
|
||||||
"allowPrerelease": false
|
"allowPrerelease": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,11 @@ public static class ServiceCollectionExtensions
|
|||||||
/// <param name="serviceCollection">The service collection in which to register the services.</param>
|
/// <param name="serviceCollection">The service collection in which to register the services.</param>
|
||||||
/// <param name="configuration">The configuration to which to bind options models.</param>
|
/// <param name="configuration">The configuration to which to bind options models.</param>
|
||||||
/// <returns>The <see cref="IHttpClientBuilder"/> for the <see cref="HttpClient"/> used by <see cref="INordigenClient"/>.</returns>
|
/// <returns>The <see cref="IHttpClientBuilder"/> for the <see cref="HttpClient"/> used by <see cref="INordigenClient"/>.</returns>
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = $"{nameof(NordigenOptions)} contains only system types.")]
|
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = $"{nameof(NordigenOptions)} contains only system types.")]
|
||||||
|
#else
|
||||||
|
[SuppressMessage("Trimming", "IL2026", Justification = $"{nameof(NordigenOptions)} contains only system types.")]
|
||||||
|
#endif
|
||||||
public static IHttpClientBuilder AddNordigenDotNet(
|
public static IHttpClientBuilder AddNordigenDotNet(
|
||||||
this IServiceCollection serviceCollection,
|
this IServiceCollection serviceCollection,
|
||||||
IConfiguration configuration)
|
IConfiguration configuration)
|
||||||
|
|||||||
-2
@@ -1,8 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
|
|
||||||
<Product>VMelnalksnis.NordigenDotNet.DependencyInjection</Product>
|
<Product>VMelnalksnis.NordigenDotNet.DependencyInjection</Product>
|
||||||
<ProductId>VMelnalksnis.NordigenDotNet.DependencyInjection</ProductId>
|
<ProductId>VMelnalksnis.NordigenDotNet.DependencyInjection</ProductId>
|
||||||
<Description>Dependency injection configuration for VMelnalksnis.NordigenDotNet</Description>
|
<Description>Dependency injection configuration for VMelnalksnis.NordigenDotNet</Description>
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ internal static class HttpResponseMessageExtensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
throw new HttpRequestException(content, null, response.StatusCode);
|
throw new HttpRequestException(content, null, response.StatusCode);
|
||||||
|
#else
|
||||||
|
throw new HttpRequestException(content);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
|
|
||||||
<Product>VMelnalksnis.NordigenDotNet</Product>
|
<Product>VMelnalksnis.NordigenDotNet</Product>
|
||||||
<ProductId>VMelnalksnis.NordigenDotNet</ProductId>
|
<ProductId>VMelnalksnis.NordigenDotNet</ProductId>
|
||||||
<Description>.NET API client for Nordigen</Description>
|
<Description>.NET API client for Nordigen</Description>
|
||||||
@@ -20,6 +18,12 @@
|
|||||||
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.0.0"/>
|
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.0.0"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||||
|
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
|
||||||
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0"/>
|
||||||
|
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
|
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -2,9 +2,15 @@
|
|||||||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))"/>
|
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))"/>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<IsTrimmable>false</IsTrimmable>
|
<IsTrimmable>false</IsTrimmable>
|
||||||
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
|
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
|
||||||
|
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||||
|
<NoWarn>NETSDK1138</NoWarn>
|
||||||
|
|
||||||
|
<CoverletOutputFormat>opencover</CoverletOutputFormat>
|
||||||
|
<CoverletOutput>$(MSBuildThisFileDirectory)TestResults/$(AssemblyName)/$(TargetFramework)/</CoverletOutput>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
-4
@@ -1,9 +1,5 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\source\VMelnalksnis.NordigenDotNet\VMelnalksnis.NordigenDotNet.csproj"/>
|
<ProjectReference Include="..\..\source\VMelnalksnis.NordigenDotNet\VMelnalksnis.NordigenDotNet.csproj"/>
|
||||||
<ProjectReference Include="..\..\source\VMelnalksnis.NordigenDotNet.DependencyInjection\VMelnalksnis.NordigenDotNet.DependencyInjection.csproj"/>
|
<ProjectReference Include="..\..\source\VMelnalksnis.NordigenDotNet.DependencyInjection\VMelnalksnis.NordigenDotNet.DependencyInjection.csproj"/>
|
||||||
|
|||||||
+12
-1
@@ -3,7 +3,6 @@
|
|||||||
// See LICENSE file in the project root for full license information.
|
// See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -13,6 +12,10 @@ using VMelnalksnis.NordigenDotNet.Agreements;
|
|||||||
|
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
using System.Net;
|
||||||
|
#endif
|
||||||
|
|
||||||
using static VMelnalksnis.NordigenDotNet.Tests.Integration.ServiceProviderFixture;
|
using static VMelnalksnis.NordigenDotNet.Tests.Integration.ServiceProviderFixture;
|
||||||
|
|
||||||
namespace VMelnalksnis.NordigenDotNet.Tests.Integration.Agreements;
|
namespace VMelnalksnis.NordigenDotNet.Tests.Integration.Agreements;
|
||||||
@@ -57,8 +60,12 @@ public sealed class AgreementClientTests : IClassFixture<ServiceProviderFixture>
|
|||||||
.Awaiting(() => _nordigenClient.Agreements.Put(createdAgreement.Id, acceptance))
|
.Awaiting(() => _nordigenClient.Agreements.Put(createdAgreement.Id, acceptance))
|
||||||
.Should()
|
.Should()
|
||||||
.ThrowExactlyAsync<HttpRequestException>())
|
.ThrowExactlyAsync<HttpRequestException>())
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
.Which.StatusCode.Should()
|
.Which.StatusCode.Should()
|
||||||
.Be(HttpStatusCode.Forbidden, "test company cannot create agreements");
|
.Be(HttpStatusCode.Forbidden, "test company cannot create agreements");
|
||||||
|
#else
|
||||||
|
.Which.Should().NotBeNull("test company cannot create agreements");
|
||||||
|
#endif
|
||||||
|
|
||||||
await _nordigenClient.Agreements.Delete(createdAgreement.Id);
|
await _nordigenClient.Agreements.Delete(createdAgreement.Id);
|
||||||
|
|
||||||
@@ -66,7 +73,11 @@ public sealed class AgreementClientTests : IClassFixture<ServiceProviderFixture>
|
|||||||
.Awaiting(() => _nordigenClient.Agreements.Get(createdAgreement.Id))
|
.Awaiting(() => _nordigenClient.Agreements.Get(createdAgreement.Id))
|
||||||
.Should()
|
.Should()
|
||||||
.ThrowExactlyAsync<HttpRequestException>())
|
.ThrowExactlyAsync<HttpRequestException>())
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
.Which.StatusCode.Should()
|
.Which.StatusCode.Should()
|
||||||
.Be(HttpStatusCode.NotFound);
|
.Be(HttpStatusCode.NotFound);
|
||||||
|
#else
|
||||||
|
.Which.Should().NotBeNull("test company cannot create agreements");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -87,8 +87,11 @@ public sealed class RequisitionsClientTests : IClassFixture<ServiceProviderFixtu
|
|||||||
.Awaiting(() => _nordigenClient.Requisitions.Get(requisition.Id))
|
.Awaiting(() => _nordigenClient.Requisitions.Get(requisition.Id))
|
||||||
.Should()
|
.Should()
|
||||||
.ThrowExactlyAsync<HttpRequestException>())
|
.ThrowExactlyAsync<HttpRequestException>())
|
||||||
.Which.StatusCode
|
#if NET6_0_OR_GREATER
|
||||||
.Should()
|
.Which.StatusCode.Should()
|
||||||
.Be(HttpStatusCode.NotFound);
|
.Be(HttpStatusCode.NotFound);
|
||||||
|
#else
|
||||||
|
.Which.Should().NotBeNull("test company cannot create agreements");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,7 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<UserSecretsId>471f5b3c-5334-4315-8d06-7bcfb17af644</UserSecretsId>
|
<UserSecretsId>471f5b3c-5334-4315-8d06-7bcfb17af644</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user