Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
chore: support net8.0 preview (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnmoreels authored Feb 7, 2024
1 parent 3d2e7ec commit 76457c5
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 57 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions build/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ stages:
parameters:
dotnetSdkVersion: '$(DotNet.Sdk.Version)'
versionSuffix: '$(packageVersion)'
includePreviewVersions: true
- task: CopyFiles@2
displayName: 'Copy build artifacts'
inputs:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions build/nuget-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ stages:
parameters:
dotnetSdkVersion: '$(DotNet.Sdk.Version)'
version: '$(Build.BuildNumber)'
includePreviewVersions: true
- task: CopyFiles@2
displayName: 'Copy build artifacts'
inputs:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build/variables/build.yml
Original file line number Diff line number Diff line change
@@ -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'
15 changes: 10 additions & 5 deletions src/Arcus.EventGrid.Core/Arcus.EventGrid.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1</TargetFrameworks>
<Authors>Arcus</Authors>
<Company>Arcus</Company>
<PackageProjectUrl>https://eventgrid.arcus-azure.net/</PackageProjectUrl>
Expand All @@ -17,20 +17,25 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<!-- Temporary disable preview package usage warning as we are building our preview Arcus .NET 8 package, will be removed once we have a new major Arcus package -->
<NoWarn>NU5104</NoWarn>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<None Include="..\..\LICENSE" Pack="true" PackagePath="\" />
<None Include="..\..\docs\static\img\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Text.Json" Version="6.0.5" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Arcus.Observability.Correlation" Version="[2.5.0,3.0.0)" />
<PackageReference Include="Arcus.Observability.Telemetry.Core" Version="[2.5.0,3.0.0)" />
<PackageReference Include="Arcus.Security.Core" Version="[1.9.0,2.0.0)" />
<PackageReference Include="Arcus.Observability.Correlation" Version="[3.0.0-preview-1-net8.0,4.0.0)" />
<PackageReference Include="Arcus.Observability.Telemetry.Core" Version="[3.0.0-preview-1-net8.0,4.0.0)" />
<PackageReference Include="Arcus.Security.Core" Version="[2.0.0-preview-1-net8.0,3.0.0)" />
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.11.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<Copyright>Copyright (c) Arcus</Copyright>
<PackageProjectUrl>https://eventgrid.arcus-azure.net/</PackageProjectUrl>
<RepositoryUrl>https://github.com/arcus-azure/arcus.eventgrid</RepositoryUrl>
Expand All @@ -19,7 +19,7 @@
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<None Include="..\..\LICENSE" Pack="true" PackagePath="\" />
<None Include="..\..\docs\static\img\icon.png" Pack="true" PackagePath="\"/>
<None Include="..\..\docs\static\img\icon.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<Copyright>Copyright (c) Arcus</Copyright>
<PackageProjectUrl>https://eventgrid.arcus-azure.net/</PackageProjectUrl>
<RepositoryUrl>https://github.com/arcus-azure/arcus.eventgrid</RepositoryUrl>
Expand All @@ -22,12 +22,8 @@
<None Include="..\..\docs\static\img\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Guard.NET" Version="2.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<PackageReference Include="Guard.NET" Version="1.2.0" />
<ItemGroup>
<PackageReference Include="Guard.NET" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<Copyright>Copyright (c) Arcus</Copyright>
<PackageProjectUrl>https://eventgrid.arcus-azure.net/</PackageProjectUrl>
<RepositoryUrl>https://github.com/arcus-azure/arcus.eventgrid</RepositoryUrl>
Expand All @@ -16,22 +16,21 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<!-- Temporary disable preview package usage warning as we are building our preview Arcus .NET 8 package, will be removed once we have a new major Arcus package -->
<NoWarn>NU5104</NoWarn>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<None Include="..\..\LICENSE" Pack="true" PackagePath="\" />
<None Include="..\..\docs\static\img\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Arcus.Observability.Telemetry.Core" Version="[2.4.0,3.0.0)" />
<PackageReference Include="Arcus.Security.Core" Version="[1.7.0,2.0.0)" />
<PackageReference Include="Guard.NET" Version="2.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<PackageReference Include="Arcus.Observability.Telemetry.Core" Version="[2.0.0,3.0.0)" />
<PackageReference Include="Arcus.Security.Core" Version="[1.4.0,2.0.0)" />
<PackageReference Include="Guard.NET" Version="1.2.0" />
<ItemGroup>
<PackageReference Include="Arcus.Observability.Telemetry.Core" Version="[3.0.0-preview-1-net8.0,4.0.0)" />
<PackageReference Include="Arcus.Security.Core" Version="[2.0.0-preview-1-net8.0,3.0.0)" />
<PackageReference Include="Guard.NET" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 3 additions & 9 deletions src/Arcus.EventGrid.Testing/Arcus.EventGrid.Testing.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<Authors>Arcus</Authors>
<Copyright>Copyright (c) Arcus</Copyright>
<PackageProjectUrl>https://eventgrid.arcus-azure.net/</PackageProjectUrl>
Expand All @@ -22,18 +22,12 @@
<None Include="..\..\docs\static\img\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Guard.NET" Version="2.0.0" />
<ItemGroup>
<PackageReference Include="Guard.NET" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.2.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<PackageReference Include="Guard.NET" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.8" />
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<!-- Deprecated packages -->
<PackageReference Include="Arcus.EventGrid" Version="3.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -157,7 +155,6 @@ public string GetReceivedEvent(string eventId, TimeSpan timeout)
return result.Result;
}

#if NET6_0
/// <summary>
/// Gets the event envelope that includes a requested event (uses timeout).
/// </summary>
Expand Down Expand Up @@ -200,7 +197,6 @@ public NewCloudEvent GetReceivedEvent(Func<NewCloudEvent, bool> cloudEventFilter

return result.Result;
}
#endif

/// <summary>
/// Gets the event envelope that includes a requested event (uses timeout).
Expand All @@ -215,9 +211,7 @@ public NewCloudEvent GetReceivedEvent(Func<NewCloudEvent, bool> cloudEventFilter
/// <exception cref="TimeoutException">
/// Thrown when no event could be received within the specified <paramref name="timeout"/> time range that matches the given <paramref name="cloudEventFilter"/>.
/// </exception>
#if NET6_0
[Obsolete("Use 'CloudEvent' overload from 'Azure.Messaging.EventGrid' package")]
#endif
public OldCloudEvent GetReceivedEvent(Func<OldCloudEvent, bool> cloudEventFilter, TimeSpan timeout)
{
Guard.NotNull(cloudEventFilter, nameof(cloudEventFilter), "Requires a function to filter out received CloudEvent events");
Expand Down Expand Up @@ -245,7 +239,6 @@ public OldCloudEvent GetReceivedEvent(Func<OldCloudEvent, bool> cloudEventFilter
return result.Result;
}

#if NET6_0
/// <summary>
/// Gets the event envelope that includes a requested event (uses timeout).
/// </summary>
Expand Down Expand Up @@ -287,8 +280,7 @@ public NewEventGridEvent GetReceivedEvent(Func<NewEventGridEvent, bool> eventGri
}

return result.Result;
}
#endif
}

/// <summary>
/// Gets the event envelope that includes a requested event (uses timeout).
Expand All @@ -303,9 +295,7 @@ public NewEventGridEvent GetReceivedEvent(Func<NewEventGridEvent, bool> eventGri
/// <exception cref="TimeoutException">
/// Thrown when no event could be received within the specified <paramref name="timeout"/> time range that matches the given <paramref name="eventGridEventFilter"/>.
/// </exception>
#if NET6_0
[Obsolete("Use 'EventGridEvent' overload from 'Azure.Messaging.EventGrid' package")]
#endif
public OldEventGridEvent GetReceivedEvent(Func<OldEventGridEvent, bool> eventGridEventFilter, TimeSpan timeout)
{
Guard.NotNull(eventGridEventFilter, nameof(eventGridEventFilter), "Requires a function to filter out received CloudEvent events");
Expand Down Expand Up @@ -347,9 +337,7 @@ public OldEventGridEvent GetReceivedEvent(Func<OldEventGridEvent, bool> eventGri
/// Thrown when no event could be retrieved within the specified <paramref name="timeout"/> time range
/// whose event payload matches the given <paramref name="eventPayloadFilter"/>.
/// </exception>
#if NET6_0
[Obsolete("Use either 'CloudEvent' or 'EventGridEvent' overloads")]
#endif
public Event GetReceivedEvent<TEventPayload>(Func<TEventPayload, bool> eventPayloadFilter, TimeSpan timeout)
{
Guard.NotNull(eventPayloadFilter, nameof(eventPayloadFilter), "Requires a function to filter out received CloudEvent events");
Expand Down Expand Up @@ -402,7 +390,6 @@ private static Policy<TResult> CreateTimeoutPolicy<TResult>(Func<TResult, bool>
return timeoutPolicy;
}

#if NET6_0
private TEvent TryGetReceivedEvent<TEvent>(
Func<string, TEvent> eventParser,
Func<TEvent, bool> eventFilter)
Expand Down Expand Up @@ -438,7 +425,6 @@ private TEvent TryGetReceivedEvent<TEvent>(

return null;
}
#endif

private Event TryGetReceivedEvent(Func<Event, bool> eventFilter)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Guard.Net" Version="2.0.0" />
<PackageReference Include="Guard.Net" Version="3.0.0" />
<PackageReference Include="xunit.assert" Version="2.4.0" />
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.11.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down

0 comments on commit 76457c5

Please sign in to comment.