diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 5343365c..978f8ade 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -23,6 +23,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + dotnet-quality: 'preview' - name: Coverlet coverage unit test run: dotnet test -c Debug -p:coverletOutput=coverage.xml -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:Threshold=80 -p:ThresholdStat=Total -p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\" -p:Exclude=\"[Arcus.EventGrid.Tests.*]*\" src/Arcus.EventGrid.Tests.Unit/Arcus.EventGrid.Tests.Unit.csproj diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ffe9dedf..3ff92d55 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,6 +39,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + dotnet-quality: 'preview' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/build/ci-build.yml b/build/ci-build.yml index 3e1913cb..d68cd48f 100644 --- a/build/ci-build.yml +++ b/build/ci-build.yml @@ -51,6 +51,7 @@ stages: parameters: dotnetSdkVersion: '$(DotNet.Sdk.Version)' versionSuffix: '$(packageVersion)' + includePreviewVersions: true - task: CopyFiles@2 displayName: 'Copy build artifacts' inputs: @@ -85,6 +86,7 @@ stages: - template: test/run-unit-tests.yml@templates parameters: dotnetSdkVersion: '$(DotNet.Sdk.Version)' + includePreviewVersions: true projectName: '$(Project).Tests.Unit' - stage: IntegrationTests @@ -110,6 +112,7 @@ stages: - template: test/run-integration-tests.yml@templates parameters: dotnetSdkVersion: '$(DotNet.Sdk.Version)' + includePreviewVersions: true projectName: '$(Project).Tests.Integration' - stage: ReleaseToMyget diff --git a/build/nuget-release.yml b/build/nuget-release.yml index 4b9d1233..463543ed 100644 --- a/build/nuget-release.yml +++ b/build/nuget-release.yml @@ -40,6 +40,7 @@ stages: parameters: dotnetSdkVersion: '$(DotNet.Sdk.Version)' version: '$(Build.BuildNumber)' + includePreviewVersions: true - task: CopyFiles@2 displayName: 'Copy build artifacts' inputs: @@ -74,6 +75,7 @@ stages: - template: test/run-unit-tests.yml@templates parameters: dotnetSdkVersion: '$(DotNet.Sdk.Version)' + includePreviewVersions: true projectName: '$(Project).Tests.Unit' - stage: IntegrationTests @@ -99,6 +101,7 @@ stages: - template: test/run-integration-tests.yml@templates parameters: dotnetSdkVersion: '$(DotNet.Sdk.Version)' + includePreviewVersions: true projectName: '$(Project).Tests.Integration' - stage: Release diff --git a/build/variables/build.yml b/build/variables/build.yml index a7475ca7..610e41b9 100644 --- a/build/variables/build.yml +++ b/build/variables/build.yml @@ -1,5 +1,5 @@ variables: - DotNet.Sdk.Version: '6.0.100' - DotNet.Sdk.VersionBC: '3.1.201' + DotNet.Sdk.Version: '8.0.x' + DotNet.Sdk.VersionBC: '6.0.100' Project: 'Arcus.EventGrid' Vm.Image: 'ubuntu-latest' \ No newline at end of file diff --git a/src/Arcus.EventGrid.Core/Arcus.EventGrid.Core.csproj b/src/Arcus.EventGrid.Core/Arcus.EventGrid.Core.csproj index 28feec40..4f18829d 100644 --- a/src/Arcus.EventGrid.Core/Arcus.EventGrid.Core.csproj +++ b/src/Arcus.EventGrid.Core/Arcus.EventGrid.Core.csproj @@ -1,7 +1,7 @@  - net6.0;netcoreapp3.1;netstandard2.1 + net8.0;net6.0;netstandard2.1 Arcus Arcus https://eventgrid.arcus-azure.net/ @@ -17,20 +17,25 @@ true + + + NU5104 + + - + - - - + + + diff --git a/src/Arcus.EventGrid.Security.AzureFunctions/Arcus.EventGrid.Security.AzureFunctions.csproj b/src/Arcus.EventGrid.Security.AzureFunctions/Arcus.EventGrid.Security.AzureFunctions.csproj index 067ab1af..f597c59a 100644 --- a/src/Arcus.EventGrid.Security.AzureFunctions/Arcus.EventGrid.Security.AzureFunctions.csproj +++ b/src/Arcus.EventGrid.Security.AzureFunctions/Arcus.EventGrid.Security.AzureFunctions.csproj @@ -1,7 +1,7 @@  - net6.0;netcoreapp3.1 + net8.0;net6.0 Copyright (c) Arcus https://eventgrid.arcus-azure.net/ https://github.com/arcus-azure/arcus.eventgrid @@ -19,7 +19,7 @@ - + diff --git a/src/Arcus.EventGrid.Security.Core/Arcus.EventGrid.Security.Core.csproj b/src/Arcus.EventGrid.Security.Core/Arcus.EventGrid.Security.Core.csproj index 7cffcc9a..ae2deb58 100644 --- a/src/Arcus.EventGrid.Security.Core/Arcus.EventGrid.Security.Core.csproj +++ b/src/Arcus.EventGrid.Security.Core/Arcus.EventGrid.Security.Core.csproj @@ -1,7 +1,7 @@  - net6.0;netcoreapp3.1 + net8.0;net6.0 Copyright (c) Arcus https://eventgrid.arcus-azure.net/ https://github.com/arcus-azure/arcus.eventgrid @@ -22,12 +22,8 @@ - - - - - - + + diff --git a/src/Arcus.EventGrid.Security.Core/Validation/EventGridSubscriptionValidator.cs b/src/Arcus.EventGrid.Security.Core/Validation/EventGridSubscriptionValidator.cs index ba6d14a5..90e7655b 100644 --- a/src/Arcus.EventGrid.Security.Core/Validation/EventGridSubscriptionValidator.cs +++ b/src/Arcus.EventGrid.Security.Core/Validation/EventGridSubscriptionValidator.cs @@ -45,8 +45,8 @@ public IActionResult ValidateCloudEventsHandshakeRequest(HttpRequest request) if (request.Headers.TryGetValue(headerName, out StringValues requestOrigins)) { // TODO: configurable rate? - request.HttpContext.Response.Headers.Add("WebHook-Allowed-Rate", "*"); - request.HttpContext.Response.Headers.Add("WebHook-Allowed-Origin", requestOrigins); + request.HttpContext.Response.Headers["WebHook-Allowed-Rate"] = "*"; + request.HttpContext.Response.Headers["WebHook-Allowed-Origin"] = requestOrigins; return new OkResult(); } diff --git a/src/Arcus.EventGrid.Security.WebApi/Arcus.EventGrid.Security.WebApi.csproj b/src/Arcus.EventGrid.Security.WebApi/Arcus.EventGrid.Security.WebApi.csproj index 46a095d7..1f20912c 100644 --- a/src/Arcus.EventGrid.Security.WebApi/Arcus.EventGrid.Security.WebApi.csproj +++ b/src/Arcus.EventGrid.Security.WebApi/Arcus.EventGrid.Security.WebApi.csproj @@ -1,7 +1,7 @@  - net6.0;netcoreapp3.1 + net8.0;net6.0 Copyright (c) Arcus https://eventgrid.arcus-azure.net/ https://github.com/arcus-azure/arcus.eventgrid @@ -16,22 +16,21 @@ true + + + NU5104 + + - - - - - - - - - - + + + + diff --git a/src/Arcus.EventGrid.Testing/Arcus.EventGrid.Testing.csproj b/src/Arcus.EventGrid.Testing/Arcus.EventGrid.Testing.csproj index 6d24d154..e8ffd935 100644 --- a/src/Arcus.EventGrid.Testing/Arcus.EventGrid.Testing.csproj +++ b/src/Arcus.EventGrid.Testing/Arcus.EventGrid.Testing.csproj @@ -1,7 +1,7 @@  - net6.0;netcoreapp3.1 + net8.0;net6.0 Arcus Copyright (c) Arcus https://eventgrid.arcus-azure.net/ @@ -22,18 +22,12 @@ - - + + - - - - - - diff --git a/src/Arcus.EventGrid.Testing/Infrastructure/Hosts/EventConsumerHost.cs b/src/Arcus.EventGrid.Testing/Infrastructure/Hosts/EventConsumerHost.cs index eb59818a..7bdbcab4 100644 --- a/src/Arcus.EventGrid.Testing/Infrastructure/Hosts/EventConsumerHost.cs +++ b/src/Arcus.EventGrid.Testing/Infrastructure/Hosts/EventConsumerHost.cs @@ -13,10 +13,8 @@ using Newtonsoft.Json; using Polly; using Polly.Timeout; -#if NET6_0 using NewCloudEvent = Azure.Messaging.CloudEvent; using NewEventGridEvent = Azure.Messaging.EventGrid.EventGridEvent; -#endif using OldCloudEvent = CloudNative.CloudEvents.CloudEvent; using OldEventGridEvent = Microsoft.Azure.EventGrid.Models.EventGridEvent; @@ -157,7 +155,6 @@ public string GetReceivedEvent(string eventId, TimeSpan timeout) return result.Result; } -#if NET6_0 /// /// Gets the event envelope that includes a requested event (uses timeout). /// @@ -200,7 +197,6 @@ public NewCloudEvent GetReceivedEvent(Func cloudEventFilter return result.Result; } -#endif /// /// Gets the event envelope that includes a requested event (uses timeout). @@ -215,9 +211,7 @@ public NewCloudEvent GetReceivedEvent(Func cloudEventFilter /// /// Thrown when no event could be received within the specified time range that matches the given . /// -#if NET6_0 [Obsolete("Use 'CloudEvent' overload from 'Azure.Messaging.EventGrid' package")] -#endif public OldCloudEvent GetReceivedEvent(Func cloudEventFilter, TimeSpan timeout) { Guard.NotNull(cloudEventFilter, nameof(cloudEventFilter), "Requires a function to filter out received CloudEvent events"); @@ -245,7 +239,6 @@ public OldCloudEvent GetReceivedEvent(Func cloudEventFilter return result.Result; } -#if NET6_0 /// /// Gets the event envelope that includes a requested event (uses timeout). /// @@ -287,8 +280,7 @@ public NewEventGridEvent GetReceivedEvent(Func eventGri } return result.Result; - } -#endif + } /// /// Gets the event envelope that includes a requested event (uses timeout). @@ -303,9 +295,7 @@ public NewEventGridEvent GetReceivedEvent(Func eventGri /// /// Thrown when no event could be received within the specified time range that matches the given . /// -#if NET6_0 [Obsolete("Use 'EventGridEvent' overload from 'Azure.Messaging.EventGrid' package")] -#endif public OldEventGridEvent GetReceivedEvent(Func eventGridEventFilter, TimeSpan timeout) { Guard.NotNull(eventGridEventFilter, nameof(eventGridEventFilter), "Requires a function to filter out received CloudEvent events"); @@ -347,9 +337,7 @@ public OldEventGridEvent GetReceivedEvent(Func eventGri /// Thrown when no event could be retrieved within the specified time range /// whose event payload matches the given . /// -#if NET6_0 [Obsolete("Use either 'CloudEvent' or 'EventGridEvent' overloads")] -#endif public Event GetReceivedEvent(Func eventPayloadFilter, TimeSpan timeout) { Guard.NotNull(eventPayloadFilter, nameof(eventPayloadFilter), "Requires a function to filter out received CloudEvent events"); @@ -402,7 +390,6 @@ private static Policy CreateTimeoutPolicy(Func return timeoutPolicy; } - #if NET6_0 private TEvent TryGetReceivedEvent( Func eventParser, Func eventFilter) @@ -438,7 +425,6 @@ private TEvent TryGetReceivedEvent( return null; } -#endif private Event TryGetReceivedEvent(Func eventFilter) { diff --git a/src/Arcus.EventGrid.Tests.Core/Arcus.EventGrid.Tests.Core.csproj b/src/Arcus.EventGrid.Tests.Core/Arcus.EventGrid.Tests.Core.csproj index f07e4137..8af80af5 100644 --- a/src/Arcus.EventGrid.Tests.Core/Arcus.EventGrid.Tests.Core.csproj +++ b/src/Arcus.EventGrid.Tests.Core/Arcus.EventGrid.Tests.Core.csproj @@ -1,11 +1,11 @@  - net6.0 + net8.0 - + diff --git a/src/Arcus.EventGrid.Tests.Integration/Arcus.EventGrid.Tests.Integration.csproj b/src/Arcus.EventGrid.Tests.Integration/Arcus.EventGrid.Tests.Integration.csproj index 7c4277ad..a4639b9a 100644 --- a/src/Arcus.EventGrid.Tests.Integration/Arcus.EventGrid.Tests.Integration.csproj +++ b/src/Arcus.EventGrid.Tests.Integration/Arcus.EventGrid.Tests.Integration.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Arcus.EventGrid.Tests.Unit/Arcus.EventGrid.Tests.Unit.csproj b/src/Arcus.EventGrid.Tests.Unit/Arcus.EventGrid.Tests.Unit.csproj index 67324cf8..36742f8f 100644 --- a/src/Arcus.EventGrid.Tests.Unit/Arcus.EventGrid.Tests.Unit.csproj +++ b/src/Arcus.EventGrid.Tests.Unit/Arcus.EventGrid.Tests.Unit.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false