Skip to content

Commit

Permalink
Add .NET 7.0 target (#202)
Browse files Browse the repository at this point in the history
Drop winpcap tests on Windows as it keeps failing.
  • Loading branch information
PhyxionNL authored May 31, 2023
1 parent 2423f2d commit 3cded41
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 61 deletions.
43 changes: 16 additions & 27 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
7.0.x
- name: Install .NET dependencies
run: dotnet restore
Expand All @@ -23,21 +25,23 @@ jobs:
run: sudo -E bash Scripts/install-libpcap.sh

- name: Build
run: dotnet build PacketDotNet/PacketDotNet.csproj -c Release -f "netstandard2.0"
run: dotnet build PacketDotNet/PacketDotNet.csproj -c Release -f "net7.0"

- name: Test
run: dotnet test -c Release -f "net6.0"
run: dotnet test -c Release -f "net7.0"

windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
7.0.x
- uses: dorny/paths-filter@v2
id: changes
Expand All @@ -61,30 +65,15 @@ jobs:
- name: Install .NET dependencies
run: dotnet restore

- name: Install winpcap
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install winpcap

- name: Build
run: dotnet build -c Release

- name: Test
run: dotnet test -c Release

- name: Publish net47
uses: actions/upload-artifact@v2
with:
name: PacketDotNet-net47
path: |
PacketDotNet/bin/Release/net47
- name: Publish netstandard20
uses: actions/upload-artifact@v2
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: PacketDotNet-netstandard20
name: PacketDotNet
path: |
PacketDotNet/bin/Release/netstandard2.0
PacketDotNet/bin/Release/net*
- name: Publish to NuGet
run: nuget push **\*.nupkg -SkipDuplicate -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
43 changes: 16 additions & 27 deletions .github/workflows/pull requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
7.0.x
- name: Install .NET dependencies
run: dotnet restore
Expand All @@ -23,21 +25,23 @@ jobs:
run: sudo -E bash Scripts/install-libpcap.sh

- name: Build
run: dotnet build PacketDotNet/PacketDotNet.csproj -c Release -f "netstandard2.0"
run: dotnet build PacketDotNet/PacketDotNet.csproj -c Release -f "net7.0"

- name: Test
run: dotnet test -c Release -f "net6.0"
run: dotnet test -c Release -f "net7.0"

windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: |
6.0.x
7.0.x
- uses: dorny/paths-filter@v2
id: changes
Expand All @@ -61,27 +65,12 @@ jobs:
- name: Install .NET dependencies
run: dotnet restore

- name: Install winpcap
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install winpcap

- name: Build
run: dotnet build -c Release

- name: Test
run: dotnet test -c Release

- name: Publish net47
uses: actions/upload-artifact@v2
with:
name: PacketDotNet-net47
path: |
PacketDotNet/bin/Release/net47
- name: Publish netstandard20
uses: actions/upload-artifact@v2
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: PacketDotNet-netstandard20
name: PacketDotNet
path: |
PacketDotNet/bin/Release/netstandard2.0
PacketDotNet/bin/Release/net*
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Examples/ConstructingPackets/ConstructingPackets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion PacketDotNet/IPPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public static IPAddress GetIPAddress
}
case AddressFamily.InterNetworkV6:
{
#if NETSTANDARD2_1_OR_GREATER
#if NETCOREAPP
return new IPAddress(bytes.AsSpan(fieldOffset, IPv6Fields.AddressLength));
#else
var address = new byte[IPv6Fields.AddressLength];
Expand Down
4 changes: 2 additions & 2 deletions PacketDotNet/PacketDotNet.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net47</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net472</TargetFrameworks>
<Authors>Chris Morgan ([email protected])</Authors>
<LangVersion>latest</LangVersion>
<SignAssembly>true</SignAssembly>
Expand Down Expand Up @@ -40,4 +40,4 @@
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
</ItemGroup>

</Project>
</Project>
1 change: 0 additions & 1 deletion PacketNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CA0EF028-81F3-4D7F-97DD-B6AA049DB25B}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
appveyor.yml = appveyor.yml
ArchitectureNotes = ArchitectureNotes
Directory.Build.props = Directory.Build.props
LICENSE = LICENSE
Expand Down
2 changes: 1 addition & 1 deletion Test/Test.csproj
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>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down

0 comments on commit 3cded41

Please sign in to comment.