diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09b3ce7..c7122b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,16 +24,14 @@ 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: > @@ -47,16 +45,27 @@ jobs: Paperless__BaseAddress: 'https://localhost:5002/' Paperless__Token: 'token' - - name: ReSharper annotations - uses: VMelnalksnis/resharper-inspect-action@v0.2.5 - with: - solution: PaperlessDotNet.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: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + + resharper: + name: Resharper + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.1.0 + - uses: actions/setup-dotnet@v3.0.3 + with: + dotnet-version: 6.0.x + - 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: PaperlessDotNet.sln + resharper-version: 2022.1.2 + treat-warnings-as-errors: true diff --git a/Directory.Build.props b/Directory.Build.props index aa6be06..1d33b07 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,7 @@ - net6.0 + netstandard2.0;net6.0 + latest enable true portable diff --git a/Directory.Packages.props b/Directory.Packages.props index 0764ac7..e1c4459 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,9 @@ + + @@ -16,11 +18,13 @@ + + diff --git a/global.json b/global.json index 1703d4a..b9d66c8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.400", + "version": "7.0.100", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/ServiceCollectionExtensions.cs b/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/ServiceCollectionExtensions.cs index 6d28916..7b7458d 100644 --- a/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/ServiceCollectionExtensions.cs +++ b/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/ServiceCollectionExtensions.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Net.Http; using System.Net.Http.Headers; -using System.Net.Mime; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -16,6 +15,10 @@ using VMelnalksnis.PaperlessDotNet.Documents; using VMelnalksnis.PaperlessDotNet.Serialization; +#if NET6_0_OR_GREATER +using System.Net.Mime; +#endif + namespace VMelnalksnis.PaperlessDotNet.DependencyInjection; /// Methods for configuring within . @@ -34,7 +37,11 @@ static ServiceCollectionExtensions() /// The service collection in which to register the services. /// The configuration to which to bind options models. /// The for the used by . +#if NET6_0_OR_GREATER [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = $"{nameof(PaperlessOptions)} contains only system types.")] +#else + [SuppressMessage("Trimming", "IL2026", Justification = $"{nameof(PaperlessOptions)} contains only system types.")] +#endif public static IHttpClientBuilder AddPaperlessDotNet( this IServiceCollection serviceCollection, IConfiguration configuration) @@ -65,7 +72,11 @@ public static IHttpClientBuilder AddPaperlessDotNet( client.BaseAddress = options.BaseAddress; client.DefaultRequestHeaders.UserAgent.Add(_userAgent); +#if NET6_0_OR_GREATER client.DefaultRequestHeaders.Add("Accept", $"{MediaTypeNames.Application.Json}; version=2"); +#else + client.DefaultRequestHeaders.Add("Accept", "application/json; version=2"); +#endif client.DefaultRequestHeaders.Authorization = new("Token", options.Token); }); } diff --git a/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/VMelnalksnis.PaperlessDotNet.DependencyInjection.csproj b/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/VMelnalksnis.PaperlessDotNet.DependencyInjection.csproj index 9db2f99..cbc1598 100644 --- a/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/VMelnalksnis.PaperlessDotNet.DependencyInjection.csproj +++ b/source/VMelnalksnis.PaperlessDotNet.DependencyInjection/VMelnalksnis.PaperlessDotNet.DependencyInjection.csproj @@ -26,4 +26,15 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/source/VMelnalksnis.PaperlessDotNet/VMelnalksnis.PaperlessDotNet.csproj b/source/VMelnalksnis.PaperlessDotNet/VMelnalksnis.PaperlessDotNet.csproj index d9629a9..a131cf4 100644 --- a/source/VMelnalksnis.PaperlessDotNet/VMelnalksnis.PaperlessDotNet.csproj +++ b/source/VMelnalksnis.PaperlessDotNet/VMelnalksnis.PaperlessDotNet.csproj @@ -19,6 +19,11 @@ + + + + + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 9f1cb20..1dbc448 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -2,9 +2,12 @@ + netcoreapp3.1;net5.0;net6.0;net7.0 false false false + true + NETSDK1138 diff --git a/tests/VMelnalksnis.PaperlessDotNet.Tests.Integration/VMelnalksnis.PaperlessDotNet.Tests.Integration.csproj b/tests/VMelnalksnis.PaperlessDotNet.Tests.Integration/VMelnalksnis.PaperlessDotNet.Tests.Integration.csproj index afcb975..d20f5fc 100644 --- a/tests/VMelnalksnis.PaperlessDotNet.Tests.Integration/VMelnalksnis.PaperlessDotNet.Tests.Integration.csproj +++ b/tests/VMelnalksnis.PaperlessDotNet.Tests.Integration/VMelnalksnis.PaperlessDotNet.Tests.Integration.csproj @@ -1,7 +1,7 @@ - 20e7c251-0bc2-4764-b533-448d014f1212 + 20e7c251-0bc2-4764-b533-448d014f1212