feat: Add .NET Standard 2.0 target
This commit is contained in:
+25
-23
@@ -26,39 +26,41 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3.1.0
|
||||
- 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
|
||||
|
||||
- name: Build
|
||||
run: >
|
||||
dotnet build
|
||||
--configuration Release
|
||||
--no-restore
|
||||
/warnAsError
|
||||
/nologo
|
||||
/clp:NoSummary
|
||||
- run: dotnet build --configuration Release --no-restore /warnAsError /nologo /clp:NoSummary
|
||||
|
||||
- name: Run Tests
|
||||
run: >
|
||||
dotnet test
|
||||
-p:CollectCoverage=true
|
||||
-p:CoverletOutput=TestResults/
|
||||
-p:CoverletOutputFormat=opencover
|
||||
--configuration Release
|
||||
--no-build
|
||||
run: dotnet test -p:CollectCoverage=true --configuration Release --no-build
|
||||
env:
|
||||
Nordigen__SecretId: ${{ secrets.NORDIGEN_SECRET_ID }}
|
||||
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
|
||||
if: github.event.schedule == null
|
||||
uses: codecov/codecov-action@v3.1.1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
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>
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<DebugType>portable</DebugType>
|
||||
@@ -31,6 +33,17 @@
|
||||
</PackageReference>
|
||||
</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>
|
||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
|
||||
<Link>stylecop.json</Link>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "6.0.400",
|
||||
"version": "7.0.100",
|
||||
"rollForward": "latestFeature",
|
||||
"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="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>
|
||||
#if NET6_0_OR_GREATER
|
||||
[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(
|
||||
this IServiceCollection serviceCollection,
|
||||
IConfiguration configuration)
|
||||
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
||||
<Product>VMelnalksnis.NordigenDotNet.DependencyInjection</Product>
|
||||
<ProductId>VMelnalksnis.NordigenDotNet.DependencyInjection</ProductId>
|
||||
<Description>Dependency injection configuration for VMelnalksnis.NordigenDotNet</Description>
|
||||
|
||||
@@ -17,6 +17,10 @@ internal static class HttpResponseMessageExtensions
|
||||
}
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
#if NET6_0_OR_GREATER
|
||||
throw new HttpRequestException(content, null, response.StatusCode);
|
||||
#else
|
||||
throw new HttpRequestException(content);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
||||
<Product>VMelnalksnis.NordigenDotNet</Product>
|
||||
<ProductId>VMelnalksnis.NordigenDotNet</ProductId>
|
||||
<Description>.NET API client for Nordigen</Description>
|
||||
@@ -20,6 +18,12 @@
|
||||
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.0.0"/>
|
||||
</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>
|
||||
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))"/>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTrimmable>false</IsTrimmable>
|
||||
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
|
||||
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||
<NoWarn>NETSDK1138</NoWarn>
|
||||
|
||||
<CoverletOutputFormat>opencover</CoverletOutputFormat>
|
||||
<CoverletOutput>$(MSBuildThisFileDirectory)TestResults/$(AssemblyName)/$(TargetFramework)/</CoverletOutput>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
-4
@@ -1,9 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\source\VMelnalksnis.NordigenDotNet\VMelnalksnis.NordigenDotNet.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.
|
||||
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -13,6 +12,10 @@ using VMelnalksnis.NordigenDotNet.Agreements;
|
||||
|
||||
using Xunit.Abstractions;
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
using System.Net;
|
||||
#endif
|
||||
|
||||
using static VMelnalksnis.NordigenDotNet.Tests.Integration.ServiceProviderFixture;
|
||||
|
||||
namespace VMelnalksnis.NordigenDotNet.Tests.Integration.Agreements;
|
||||
@@ -57,8 +60,12 @@ public sealed class AgreementClientTests : IClassFixture<ServiceProviderFixture>
|
||||
.Awaiting(() => _nordigenClient.Agreements.Put(createdAgreement.Id, acceptance))
|
||||
.Should()
|
||||
.ThrowExactlyAsync<HttpRequestException>())
|
||||
#if NET6_0_OR_GREATER
|
||||
.Which.StatusCode.Should()
|
||||
.Be(HttpStatusCode.Forbidden, "test company cannot create agreements");
|
||||
#else
|
||||
.Which.Should().NotBeNull("test company cannot create agreements");
|
||||
#endif
|
||||
|
||||
await _nordigenClient.Agreements.Delete(createdAgreement.Id);
|
||||
|
||||
@@ -66,7 +73,11 @@ public sealed class AgreementClientTests : IClassFixture<ServiceProviderFixture>
|
||||
.Awaiting(() => _nordigenClient.Agreements.Get(createdAgreement.Id))
|
||||
.Should()
|
||||
.ThrowExactlyAsync<HttpRequestException>())
|
||||
#if NET6_0_OR_GREATER
|
||||
.Which.StatusCode.Should()
|
||||
.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))
|
||||
.Should()
|
||||
.ThrowExactlyAsync<HttpRequestException>())
|
||||
.Which.StatusCode
|
||||
.Should()
|
||||
#if NET6_0_OR_GREATER
|
||||
.Which.StatusCode.Should()
|
||||
.Be(HttpStatusCode.NotFound);
|
||||
#else
|
||||
.Which.Should().NotBeNull("test company cannot create agreements");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<UserSecretsId>471f5b3c-5334-4315-8d06-7bcfb17af644</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user