Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .NET 8, bump System.Text.Json from 6.0.0 to non-vulnerable 8.0.5 #350

Merged
merged 22 commits into from
Feb 24, 2025
106 changes: 71 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,77 +13,113 @@ permissions:
contents: read

jobs:
lint-and-tests:
name: Lint & Tests
lint-and-approval-tests:
name: Lint & Approval Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core 7.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.x'
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln
- name: Check formatting
run: dotnet format --no-restore --verify-no-changes --severity warn ./Source/EasyNetQ.Management.Client.sln || (echo "Run 'dotnet format' to fix issues" && exit 1)
- name: Build
run: dotnet build ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln --configuration Release
- name: Tests
run: |
cd ${{ github.workspace }}/Source/EasyNetQ.Management.Client.Tests
dotnet test --configuration Release --no-build
- name: Approval Tests
run: |
cd ${{ github.workspace }}/Source/EasyNetQ.Management.Client.ApprovalTests
dotnet test --configuration Release --no-build
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core 8.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln
- name: Check formatting
run: dotnet format --no-restore --verify-no-changes --severity warn ./Source/EasyNetQ.Management.Client.sln || (echo "Run 'dotnet format' to fix issues" && exit 1)
- name: Build
run: dotnet build ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln --configuration Release
- name: Approval Tests
run: |
cd ${{ github.workspace }}/Source/EasyNetQ.Management.Client.ApprovalTests
dotnet test --configuration Release --no-build

unit-tests:
name: Unit Tests
runs-on: ${{ matrix.os }}
needs: lint-and-approval-tests
timeout-minutes: 15
strategy:
max-parallel: 3
matrix:
include:
- os: ubuntu-latest
framework: net8.0
- os: windows-latest
framework: net48
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core 8.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln
- name: Build
run: dotnet build ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln --configuration Release
- name: Tests
run: |
cd ${{ github.workspace }}/Source/EasyNetQ.Management.Client.Tests
dotnet test --configuration Release --framework ${{ matrix.framework }} --no-build

integration-tests:
name: Integrations Tests
runs-on: ubuntu-latest
needs: lint-and-tests
runs-on: ${{ matrix.os }}
needs: lint-and-approval-tests
timeout-minutes: 15
strategy:
max-parallel: 3
max-parallel: 6
matrix:
rabbitmq: ['3.10', '3.11', '3.12', '3.13']
rabbitmq: ['3.12', '3.13']
# os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
include:
- os: ubuntu-latest
framework: net8.0
# - os: windows-latest
# framework: net48
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core 7.x
- name: Setup .NET Core 8.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.x
dotnet-version: 8.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln
- name: Build
run: dotnet build ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln --configuration Release
- name: Integration Tests
env:
RABBITMQ_VERSION: ${{ matrix.rabbitmq }}
run: |
cd ${{ github.workspace }}/Source/EasyNetQ.Management.Client.IntegrationTests
export RABBITMQ_VERSION=${{ matrix.rabbitmq }}
dotnet test --configuration Release --no-build
dotnet test --configuration Release --framework ${{ matrix.framework }} --no-build

publish-to-nuget:
name: Publish to NuGet
runs-on: ubuntu-latest
needs: [lint-and-tests, integration-tests]
needs: [lint-and-approval-tests, unit-tests, integration-tests]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core 7.x
- name: Setup .NET Core 8.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.x'
dotnet-version: 8.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.sln
- name: Build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ namespace EasyNetQ.Management.Client
{
public UnexpectedHttpStatusCodeException() { }
public UnexpectedHttpStatusCodeException(string message) { }
protected UnexpectedHttpStatusCodeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public UnexpectedHttpStatusCodeException(string message, System.Exception inner) { }
protected UnexpectedHttpStatusCodeException(string message, System.Net.HttpStatusCode statusCode) { }
public System.Net.HttpStatusCode StatusCode { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7</TargetFramework>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net7.0</TargetFrameworks>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>

Expand All @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>

Expand Down Expand Up @@ -47,8 +47,8 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="6.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NET8_0_OR_GREATER
#if !NET8_0_OR_GREATER && !NETSTANDARD2_0

namespace System.Text.Json.Serialization;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net;
using System.Runtime.Serialization;
using System.Text;

namespace EasyNetQ.Management.Client;
Expand Down Expand Up @@ -29,13 +28,6 @@ public UnexpectedHttpStatusCodeException(string message, Exception inner) : base
{
}

protected UnexpectedHttpStatusCodeException(
SerializationInfo info,
StreamingContext context
) : base(info, context)
{
}

protected UnexpectedHttpStatusCodeException(string message, HttpStatusCode statusCode) : base(message)
{
StatusCode = statusCode;
Expand Down
Loading