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

Feat/static linking #554

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0c86b45
Update config.yml
KoenPlasmansLS May 7, 2022
a2dde4e
Update config.yml
KoenPlasmansLS May 7, 2022
072f2c8
Update config.yml
KoenPlasmansLS May 7, 2022
062f272
Update config.yml
KoenPlasmansLS May 7, 2022
3441a56
Update config.yml
KoenPlasmansLS May 7, 2022
05d7268
Update config.yml
KoenPlasmansLS May 7, 2022
a1dab8c
Update config.yml
KoenPlasmansLS May 7, 2022
24f8b8c
Update SharpPcap.csproj
KoenPlasmansLS May 7, 2022
911d738
Update SharpPcap.csproj
KoenPlasmansLS May 7, 2022
2d4b606
Update config.yml
KoenPlasmansLS May 7, 2022
f1cf65c
Fix merge conflicts
KoenPlasmansLS May 9, 2022
0935b98
Merge branch 'dotpcap-master'
KoenPlasmansLS May 9, 2022
ad7a28a
Use suggested fix
KoenPlasmansLS May 9, 2022
c283a5e
Aha
KoenPlasmansLS May 9, 2022
4eff4fe
double
KoenPlasmansLS May 9, 2022
462d992
feat: extract and expand interface + fix test
irisvdz83 Aug 23, 2022
6c26368
Merge pull request #2 from Lansweeper/feat/extract-and-expand-interface
PeterVD-Lansweeper Aug 23, 2022
8de70d8
feat: changed version for nuget
irisvdz83 Aug 23, 2022
3132722
Merge pull request #3 from Lansweeper/feat/changed-version-for-nuget
PeterVD-Lansweeper Aug 23, 2022
3f10766
feat: extracted interface
irisvdz83 Aug 23, 2022
c677b24
feat: added info to readme and changed version in config
irisvdz83 Aug 23, 2022
e0f5ae6
Merge pull request #4 from Lansweeper/feat/extracted-interface
irisvdz83 Aug 23, 2022
2276fbf
feat: extracted interface + version change
irisvdz83 Aug 23, 2022
a890a94
Merge branch 'master' into feat/extracted-interface
irisvdz83 Aug 23, 2022
331fb96
Merge pull request #5 from Lansweeper/feat/extracted-interface
irisvdz83 Aug 23, 2022
57a69bf
feat: resolve interface issues
irisvdz83 Aug 24, 2022
0acbc46
Merge pull request #6 from Lansweeper/feat/resolve-interface-issues
PeterVD-Lansweeper Aug 24, 2022
6f6348c
feat: change version
irisvdz83 Aug 24, 2022
96764bd
Merge branch 'master' into feat/resolve-interface-issues
irisvdz83 Aug 24, 2022
0cfcb67
Merge pull request #7 from Lansweeper/feat/resolve-interface-issues
PeterVD-Lansweeper Aug 24, 2022
aac57e4
feat: resolve interface issues
irisvdz83 Aug 24, 2022
450ea6f
Merge branch 'master' into feat/resolve-interface-issues
irisvdz83 Aug 24, 2022
41dc295
feat: change version
irisvdz83 Aug 24, 2022
c6f2bd5
feat: fix code smell
irisvdz83 Aug 24, 2022
6a368f9
Merge pull request #8 from Lansweeper/feat/resolve-interface-issues
irisvdz83 Aug 24, 2022
f9b4da7
Merge remote-tracking branch 'dotpcap/master' into test
LSJoranVC Nov 24, 2023
969e834
feat: ITD-1716: fix build when updating sharppcap
LSJoranVC Nov 24, 2023
0745778
feat: ITD-1716: update package version
LSJoranVC Nov 24, 2023
2b31aed
try fix sonar
LSJoranVC Nov 24, 2023
fed4ed1
code smell
LSJoranVC Nov 24, 2023
c67a5d5
code smells
LSJoranVC Nov 24, 2023
3eb1cef
try fix build
LSJoranVC Nov 24, 2023
5284d93
Merge pull request #9 from Lansweeper/feat/ITD-1716
LSJoranVC Nov 24, 2023
307d033
fix: ITD-1716: try to fix package publish
LSJoranVC Nov 24, 2023
f199c72
Merge pull request #10 from Lansweeper/feat/ITD-1716
LSJoranVC Nov 24, 2023
69f83c9
feat: ITD-1716: MacOS trimming support
LSJoranVC Nov 27, 2023
462e24d
Merge branch 'master' into feat/ITD-1716
LSJoranVC Nov 27, 2023
c6f61c5
indentation
LSJoranVC Nov 27, 2023
bd23758
feat: ITD-1716: change version
LSJoranVC Nov 27, 2023
c8249ab
feat: ITD-1716: use RuntimeIdentifier instead of RuntimeInformation
LSJoranVC Nov 28, 2023
92e9a92
feat: ITD-1716: extend DefineConstants
LSJoranVC Nov 28, 2023
eff4a18
Merge pull request #11 from Lansweeper/feat/ITD-1716
LSJoranVC Nov 28, 2023
843cdc2
feat: ITD-1716: fix build
LSJoranVC Nov 28, 2023
1bacda7
Merge pull request #12 from Lansweeper/feat/ITD-1716
LSJoranVC Nov 28, 2023
ea5fff5
feat: ITD-1716: cleanup (not working)
LSJoranVC Nov 29, 2023
e8bbef8
update package
LSJoranVC Nov 29, 2023
3444ec2
undo null check
LSJoranVC Nov 29, 2023
4e9edc1
Merge pull request #13 from Lansweeper/feat/ITD-1716
LSJoranVC Nov 29, 2023
0ea973c
Add catalog file ./catalog-info.repo.yml [skip ci]
LansweeperCloudDevelopment Nov 20, 2024
2b4abd3
Add catalog file ./catalog-info.repo.yaml [skip ci]
LansweeperCloudDevelopment Nov 20, 2024
718157e
Remove file ./catalog-info.repo.yml [skip ci]
LansweeperCloudDevelopment Nov 20, 2024
13a09fe
Update ./catalog-info.repo.yaml [skip ci]
LansweeperCloudDevelopment Nov 26, 2024
33bfc03
merge after sync
landerverhacklansweeper Jan 14, 2025
3dcac3c
fix circle ci for .net 8
landerverhacklansweeper Jan 14, 2025
bb6ef49
removed license check and code coverage
landerverhacklansweeper Jan 14, 2025
2253053
specifying NuGetPackage version
landerverhacklansweeper Jan 14, 2025
08ea5b5
Merge pull request #16 from Lansweeper/chore/sync-with-original
landerverhacklansweeper Jan 14, 2025
3ae66f3
chore: fix nuget publish
landerverhacklansweeper Jan 14, 2025
29f3ceb
Merge pull request #17 from Lansweeper/chore/try-fix-pipeline
landerverhacklansweeper Jan 14, 2025
41da05c
corrected version
landerverhacklansweeper Jan 14, 2025
11d93df
Merge pull request #18 from Lansweeper/chore/try-fix-pipeline
landerverhacklansweeper Jan 14, 2025
086af1b
support .NET8 only
landerverhacklansweeper Jan 15, 2025
6b769dc
using pcap_open_live instead of pcap_open
landerverhacklansweeper Jan 15, 2025
6c8f6b9
mitigated some AoT risks
landerverhacklansweeper Jan 15, 2025
b99ba96
Added separate NuGet package for StaticLinking 🔗
landerverhacklansweeper Jan 15, 2025
8dfeea1
temp disable master only, to test NuGets
landerverhacklansweeper Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 161 additions & 53 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
# Copyright 2020-2021 Chris Morgan <[email protected]>
# SPDX-License-Identifier: MIT

version: 2.1

parameters:
csproj-file:
type: string
default: "SharpPcap/SharpPcap.csproj"
sonar-project:
type: string
default: "Lansweeper_sharppcap"
nuget-output-file:
type: string
default: "SharpPcap/bin/Release/Lansweeper.SharpPcap.$PACKAGE_VERSION.nupkg"
nuget-output-file-static:
type: string
default: "SharpPcap/bin/Release/Lansweeper.SharpPcap.StaticLinking.$PACKAGE_VERSION.nupkg"

executors:
node:
docker:
- image: circleci/node:12

orbs:
win: circleci/[email protected]
sonar-check: lansweeper/[email protected]

commands:
report:
Expand All @@ -15,64 +32,155 @@ commands:
path: Test/TestResults

jobs:
test-windows:
build:
executor: win/default
steps:
- checkout
- run:
name: Extract version from .csproj
command: |
$file = Get-Item << parameters.csproj-file >>
[xml]$cn = Get-Content $file
$version = $cn.Project.PropertyGroup.Version
echo "##vso[task.setvariable variable=PACKAGE_VERSION]$version"
- run:
name: Install SonarScanner for MSBuild .NET Core Global Tool
command: dotnet tool install --global dotnet-sonarscanner
- run:
name: Start SonarScanner
command: dotnet sonarscanner begin /k="<< parameters.sonar-project >>" /d:sonar.verbose=true /o:"lansweeper" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login=$Env:SONAR_TOKEN /d:sonar.language="cs"
- run: dotnet build << parameters.csproj-file >> --configuration Release
- run:
name: Upload SonarScanner results
command: dotnet sonarscanner end /d:sonar.login=$Env:SONAR_TOKEN
- persist_to_workspace:
root: .
paths:
- .

nuget-prepare:
executor:
name: win/default
steps:
- checkout
- run: ./scripts/install-windows.ps1
- run: dotnet build -c Release
- run: bash scripts/test.sh --filter "TestCategory=WinDivert"
- report
- attach_workspace:
at: .
- run:
name: Create local nuget config file
command: |
$xml = "<?xml version='1.0' encoding='utf-8'?>
<configuration>
<packageSources>
<add key='github' value='https://nuget.pkg.github.com/Lansweeper/index.json' />
</packageSources>
<packageSourceCredentials>
<github>
<add key='Username' value='$env:GITHUB_USER' />
<add key='ClearTextPassword' value='$env:GITHUB_TOKEN' />
</github>
</packageSourceCredentials>
</configuration>"
Out-File -FilePath nuget.config -InputObject $xml -Encoding ASCII
- run: type nuget.config
- persist_to_workspace:
root: .
paths:
- .

test-ubuntu:
parameters:
libpcap:
description: How to install libpcap
type: string
machine:
image: ubuntu-2004:202201-02
nuget-publish:
executor:
name: win/default
steps:
- checkout
- run: sudo -E bash scripts/install-tap.sh
# Download and compile latest libpcap
- when:
condition: { equal: [ libpcap-script, << parameters.libpcap >> ] }
steps:
- run: sudo -E bash scripts/install-libpcap.sh
# Install libpcap from apt-get
- when:
condition: {not: { equal: [ libpcap-script, << parameters.libpcap >> ] } }
steps:
- run: sudo apt-get install << parameters.libpcap >>
- run: sudo -E bash scripts/test.sh
- run:
when: always
command: sudo chmod -R +r Test/TestResults
- report
- attach_workspace:
at: .
- run:
name: Set correct version in csproj file, build and pack it
command: |
$file = Get-Item << parameters.csproj-file >>
[xml]$cn = Get-Content $file
$cn.Project.PropertyGroup.Version="$env:PACKAGE_VERSION"
$cn.Save($file.FullName)
type ./<< parameters.csproj-file >>
- run:
name: Pack the default package
command: dotnet pack << parameters.csproj-file >> --configuration Release
- run:
name: Pack the StaticLinking package
command: dotnet pack << parameters.csproj-file >> --configuration StaticLinking --configuration Release
- run:
name: Publish the default package
command: |
dotnet nuget push << parameters.nuget-output-file >> --source "github" --api-key $env:GITHUB_TOKEN
- run:
name: Publish the StaticLinking package
command: |
dotnet nuget push << parameters.nuget-output-file-static >> --source "github" --api-key $env:GITHUB_TOKEN

test-arm:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
sonar:
executor: node
steps:
- checkout
- run: sudo -E bash scripts/install-tap.sh
- run: sudo apt-get install libpcap0.8
- run: sudo -E bash scripts/test.sh
- run:
when: always
command: sudo chmod -R +r Test/TestResults
- report
- attach_workspace:
at: .
- sonar-check/get_sonar_status:
report_file: "/home/circleci/project/.sonarqube/out/.sonar/report-task.txt"

workflows:
version: 2
build:

ci_on_pr:
jobs:
- build:
context:
- lec-github-packages-rw
- SonarCloud
filters:
branches:
ignore: master

- sonar:
context:
- SonarCloud
requires:
- build
filters:
branches:
ignore: master

ci_and_release_master:
jobs:
- build:
context:
- lec-github-packages-rw
- SonarCloud
filters:
branches:
only: master
- nuget-prepare:
requires:
- build
context:
- lec-github-packages-rw
filters:
branches:
only: master
- nuget-publish:
requires:
- nuget-prepare
context:
- lec-github-packages-rw
# filters:
# branches:
# only: master

run-daily-tests:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only: master

jobs:
- test-windows
- test-arm
- test-ubuntu:
name: << matrix.libpcap >>
matrix:
parameters:
libpcap: [ "libpcap-script", "libpcap-dev", "libpcap0.8" ]
- build:
context:
- lec-github-packages-rw
- SonarCloud
46 changes: 23 additions & 23 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
run: dotnet build SharpPcap/SharpPcap.csproj
- name: Test
run: sudo -E bash scripts/test.sh
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- run: sudo chmod -R +r Test/TestResults
if: always()
Expand All @@ -42,27 +42,27 @@ jobs:
name: artifacts
path: Test/TestResults/

- name: publish on version change
id: publish_nuget
uses: alirezanet/[email protected]
with:
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: SharpPcap/SharpPcap.csproj
# - name: publish on version change
# id: publish_nuget
# uses: alirezanet/[email protected]
# with:
# # Filepath of the project to be packaged, relative to root of repository
# PROJECT_FILE_PATH: SharpPcap/SharpPcap.csproj

# API key to authenticate with NuGet server
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
# # API key to authenticate with NuGet server
# NUGET_KEY: ${{secrets.NUGET_API_KEY}}

# Flag to toggle pushing symbols along with nuget package to the server, disabled by default
INCLUDE_SYMBOLS: true
# # Flag to toggle pushing symbols along with nuget package to the server, disabled by default
# INCLUDE_SYMBOLS: true

license-check:
# We use https://github.com/fsfe/reuse-tool to ensure EVERY file has correct license and copyright info
# Either in the file itself, or in .reuse\dep5 for binary files and files that don't support comments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install -r requirements.txt
- run: reuse lint
# license-check:
# # We use https://github.com/fsfe/reuse-tool to ensure EVERY file has correct license and copyright info
# # Either in the file itself, or in .reuse\dep5 for binary files and files that don't support comments
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# - run: pip install -r requirements.txt
# - run: reuse lint
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ SPDX-License-Identifier: MIT
<Deterministic>true</Deterministic>
<DebugType>full</DebugType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions Examples/Example3.BasicCap/Example03.BasicCap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharpPcap\SharpPcap.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>.\publish\lin-arm64-aot\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>.\publish\lin-x64-aot\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>.\publish\lin-x64\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>.\publish\win-x64-aot\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>
Loading
Loading