Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2cbece5
Add IODD parsing and device analysis functionality
Jul 4, 2025
3e0d121
Enhance IIoddDataConverter and IoddConverter with ConvertToBytes meth…
Jul 4, 2025
4015982
Refactor IoddComplexWriter to public; enhance bit conversion logic an…
Jul 4, 2025
d15763d
Refactor StandardDefinitionReader for improved readability; format ex…
domdeger Aug 18, 2025
272cb72
Refactors project to streamline packages and improve architecture
domdeger Aug 18, 2025
8801243
Checkpoint
domdeger Aug 18, 2025
5e48605
Adapts tests to new project structure
domdeger Aug 18, 2025
527bc83
Removes FluentAssertions
domdeger Aug 18, 2025
9f7dc30
Enhance IODDPortReaderTests and IoddConverterWriterTests for improved…
domdeger Aug 18, 2025
a65c8dd
Adds multi target build for NET 7, 8 and 9
domdeger Aug 18, 2025
4228e5d
Update package versions for Shouldly, Microsoft.NET.Test.Sdk, xunit, …
domdeger Aug 18, 2025
0efef70
Update package versions and enhance null safety in tests
domdeger Aug 18, 2025
c91866a
semver: breaking
domdeger Aug 18, 2025
378b6f8
Merge branch 'main' into feature/refactor_project
domdeger Aug 18, 2025
9cf7d82
Update .NET version to 9.0.x in CI, release, and security workflows
domdeger Aug 18, 2025
bb36bba
Update .NET setup in CI to support multiple versions (7.0.x, 8.0.x, 9…
domdeger Aug 18, 2025
0ce7a6b
Add comprehensive unit tests for device and port information models, …
domdeger Aug 18, 2025
c994cc8
Add unit tests for IfmIoTCoreClientFactory and related classes; refac…
domdeger Aug 18, 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
26 changes: 25 additions & 1 deletion .github/actions/build_nuget/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ runs:
- name: Build Nuget Package for ${{ inputs.projectPath }}
shell: bash
working-directory: ${{ inputs.projectPath }}
run: dotnet pack --include-source --include-symbols /p:ContinuousIntegrationBuild=true /p:PackageVersion=${{ steps.gitversion.outputs.nugetVersionV2 }} -c Release -o ${{ inputs.outputDirectory }}
run: |
echo "Building NuGet package for ${{ inputs.projectPath }}"
echo "Package version: ${{ steps.gitversion.outputs.nugetVersionV2 }}"
echo "Output directory: ${{ inputs.outputDirectory }}"

# Create output directory if it doesn't exist
mkdir -p ${{ inputs.outputDirectory }}

# Build the package
dotnet pack \
--include-source \
--include-symbols \
/p:ContinuousIntegrationBuild=true \
/p:PackageVersion=${{ steps.gitversion.outputs.nugetVersionV2 }} \
-c Release \
-o ${{ inputs.outputDirectory }}

# Verify package was created
if [ ! "$(ls -A ${{ inputs.outputDirectory }})" ]; then
echo "ERROR: No package was created in ${{ inputs.outputDirectory }}"
exit 1
fi

echo "Successfully created package(s):"
ls -la ${{ inputs.outputDirectory }}


6 changes: 4 additions & 2 deletions .github/actions/publish_nuget/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ runs:

- name: Publish Nuget Packages
shell: bash
working-directory: ${{ inputs.projectPath }}
run: |
for file in ${{ inputs.nugetPackageDirectory }}/*.nupkg; do
dotnet nuget push $file -k ${{ inputs.nugetApiKey }} -s ${{ inputs.nugetPackageSource }} --skip-duplicate
if [ -f "$file" ]; then
echo "Publishing $file to ${{ inputs.nugetPackageSource }}"
dotnet nuget push "$file" -k ${{ inputs.nugetApiKey }} -s ${{ inputs.nugetPackageSource }} --skip-duplicate
fi
done


31 changes: 31 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# Enable version updates for NuGet
- package-ecosystem: "nuget"
directory: "/src"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
reviewers:
- "domdeger"
commit-message:
prefix: "deps"
prefix-development: "deps-dev"
include: "scope"

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
reviewers:
- "domdeger"
commit-message:
prefix: "ci"
include: "scope"
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Description
Brief description of what this PR does.

## Type of change
Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?
Please describe the tests that you ran to verify your changes.

- [ ] Unit tests
- [ ] Integration tests
- [ ] Manual testing

## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
26 changes: 23 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,32 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: |
7.0.x
8.0.x
9.0.x

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp

- name: Restore dependencies
run: dotnet restore ./src

Expand All @@ -32,6 +49,9 @@ jobs:
- name: Test
run: dotnet test ./src --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage --filter Category!=IntegrationTest

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

- name: Merge Code Coverage files with Reportgenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5.2.0
with:
Expand Down
80 changes: 61 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Build Nuget Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -23,7 +23,21 @@ jobs:
updateAssemblyInfo: true
useConfigFile: true

- run: mkdir -p $PWD/npks
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Create output directory
run: mkdir -p $PWD/npkgs

- uses: ./.github/actions/build_nuget
name: Build Nuget Package for Conversion
Expand Down Expand Up @@ -75,48 +89,76 @@ jobs:
name: Build Nuget Package for Vendors.Ifm
with:
projectPath: ./src/Vendors/Ifm
outputDirectory: ../../../npkgs
outputDirectory: ../../npkgs

- run: echo $PWD
- run: ls -la $PWD/npkgs
- name: Publish Nuget Package for ${{ inputs.projectPath }}
- name: Verify packages were created
run: |
if [ ! "$(ls -A $PWD/npkgs)" ]; then
echo "No packages were created!"
exit 1
fi
echo "Created packages:"
ls -la $PWD/npkgs

- name: Publish Nuget Package for packages
uses: actions/upload-artifact@v4
with:
name: packages
name: nuget-packages
path: ./npkgs
retention-days: 30

publish:
name: Publish Nuget Packages
runs-on: ubuntu-latest
needs: pack
environment: production
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: packages
name: nuget-packages
path: ./packages

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Verify downloaded packages
run: |
echo "Downloaded packages:"
ls -la $PWD/packages
if [ ! "$(ls -A $PWD/packages)" ]; then
echo "No packages downloaded!"
exit 1
fi

- name: Validate package versions
run: |
echo "Validating package versions..."
for file in $PWD/packages/*.nupkg; do
if [ -f "$file" ]; then
filename=$(basename "$file")
echo "Checking if $filename already exists on NuGet.org..."
# Extract package name and version from filename
# This is a basic validation - you might want to enhance this
echo "Package: $filename"
fi
done

- run: echo "$GITHUB_CONTEXT"
- name: Upload Packages to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for file in $PWD/packages/*.nupkg; do
gh release upload ${{ github.event.release.tag_name }} $file
if [ -f "$file" ]; then
echo "Uploading $file to release ${{ github.event.release.tag_name }}"
gh release upload ${{ github.event.release.tag_name }} "$file" --clobber
fi
done

# - uses: ./.github/actions/publish_nuget
# name: Publish Nuget Packages to GitHub
# with:
# nugetApiKey: ${{ secrets.GITHUB_TOKEN }}
# nugetPackageSource: ${{ vars.NUGET_PACKAGE_SOURCE }}
# nugetPackageDirectory: $PWD/packages

- uses: ./.github/actions/publish_nuget
name: Publish Nuget Packages to Nuget.org
with:
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Security Scan

on:
schedule:
# Run weekly on Mondays at 9 AM UTC
- cron: '0 9 * * 1'
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
security:
name: Security Scan
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
actions: read

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore dependencies
run: dotnet restore ./src

- name: Run .NET security scan
run: |
dotnet list ./src package --vulnerable --include-transitive --include-prerelease > vulnerability-report.txt 2>&1 || true
if grep -q "has the following vulnerable packages" vulnerability-report.txt; then
echo "Vulnerable packages found:"
cat vulnerability-report.txt
echo "::warning::Vulnerable NuGet packages detected"
else
echo "No vulnerable packages found"
fi

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp

- name: Build for security analysis
run: dotnet build ./src --no-restore

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:csharp"

- name: Upload vulnerability report
if: always()
uses: actions/upload-artifact@v4
with:
name: vulnerability-report
path: vulnerability-report.txt
retention-days: 30
6 changes: 3 additions & 3 deletions samples/01_convert_iol_data_with_iodd/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
using IOLinkNET.IODD;
using IOLinkNET.IODD.Resolution;


// First we need to parse an IODD definition. This can be done by using the IODDParser class. Or by directly retrieving the IODD from the IODD finder with the IODDFinderPublicClient class.
IODDParser parser = new();
var device = parser.Parse(XElement.Load("../iodds/Balluff-BISM4A308240107S4-CCM-20210928-IODD1.1.xml"));
var device = parser.Parse(
XElement.Load("./iodds/Balluff-BISM4A308240107S4-CCM-20210928-IODD1.1.xml")
);

// Now we can use the IoddConverter class to convert the data.
var converter = new IoddConverter();
Expand All @@ -19,7 +20,6 @@

void DecodeParameterData()
{

// Retrieve the parameter data from the device
var data = Convert.FromBase64String("SGVsbG9IZWxsb0hlbGxvSGVsbG9IZWxsb0hlbGxvSGVsbG9IZWxsbw==");

Expand Down
21 changes: 21 additions & 0 deletions samples/03_work_with_iodds/03_work_with_iodds.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="IOLinkNET.Integration" Version="0.2.5" />
<PackageReference Include="IOLinkNET.Vendors.Ifm" Version="0.2.5" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>03_work_with_iodds</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Content Include="..\iodds\**">
<Link>iodds\%(RecursiveDir)/%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Loading