mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 11:11:23 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bd07bb520 | ||
|
|
f99af9511b | ||
|
|
b13b2d0199 | ||
|
|
364e0637bb | ||
|
|
bba90106cb | ||
|
|
3dea18d285 | ||
|
|
ad61361008 | ||
|
|
0e0659000a | ||
|
|
8cc47b496a | ||
|
|
9eb09fc7ec | ||
|
|
9b8fca6561 | ||
|
|
6205f81931 | ||
|
|
a8960f12c8 | ||
|
|
0b670b1a27 | ||
|
|
63a1348704 | ||
|
|
61fe2aff65 |
101
.github/workflows/build-pipeline.yml
vendored
101
.github/workflows/build-pipeline.yml
vendored
@@ -1,101 +0,0 @@
|
|||||||
name: Build pipeline
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
#Check the online status of the test PLCs first
|
|
||||||
check-plcs-online:
|
|
||||||
name: 'Test PLC online status'
|
|
||||||
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
|
||||||
steps:
|
|
||||||
- name: 'Ping FPX-H-C30T'
|
|
||||||
run: ping 192.168.115.210 -w 5
|
|
||||||
- name: 'Ping FPX-H-C14R'
|
|
||||||
run: ping 192.168.115.212 -w 5
|
|
||||||
- name: 'Ping FPX-C30T'
|
|
||||||
run: ping 192.168.115.213 -w 5
|
|
||||||
|
|
||||||
#Run unit tests on the test PLCs
|
|
||||||
run-unit-tests:
|
|
||||||
name: 'Run unit tests'
|
|
||||||
needs: check-plcs-online
|
|
||||||
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
dotnet-version: [ '6.0.x' ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: 'Setup dotnet ${{ matrix.dotnet-version }}'
|
|
||||||
uses: actions/setup-dotnet@v2
|
|
||||||
with:
|
|
||||||
dotnet-version: ${{ matrix.dotnet-version }}
|
|
||||||
- name: 'Run tests'
|
|
||||||
run: |
|
|
||||||
cd '${{ github.workspace }}/MewtocolTests'
|
|
||||||
dotnet test --logger "trx;logfilename=testresults.trx"
|
|
||||||
#Generate a test report
|
|
||||||
- name: 'Generate Test Report'
|
|
||||||
uses: dorny/test-reporter@v1
|
|
||||||
if: success() || failure() # run this step even if previous step failed
|
|
||||||
with:
|
|
||||||
name: Unit Test Report # Name of the check run which will be created
|
|
||||||
path: '${{ github.workspace }}/MewtocolTests/TestResults/testresults.trx' # Path to test results
|
|
||||||
reporter: dotnet-trx # Format of test results
|
|
||||||
|
|
||||||
#Run code ql check
|
|
||||||
#code-ql-check:
|
|
||||||
# uses: ./.github/workflows/codeql.yml
|
|
||||||
|
|
||||||
#Publish to nuget if version tag change detected
|
|
||||||
publish-and-push-nuget:
|
|
||||||
name: 'Build and publish to NuGet'
|
|
||||||
needs: [run-unit-tests, ]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
# Publish
|
|
||||||
- name: publish on version change
|
|
||||||
id: publish_nuget
|
|
||||||
uses: brandedoutcast/publish-nuget@v2
|
|
||||||
with:
|
|
||||||
# Filepath of the project to be packaged, relative to root of repository
|
|
||||||
PROJECT_FILE_PATH: MewtocolNet/MewtocolNet.csproj
|
|
||||||
|
|
||||||
# Configuration to build and package
|
|
||||||
# BUILD_CONFIGURATION: Release
|
|
||||||
|
|
||||||
# Platform target to compile (default is empty/AnyCPU)
|
|
||||||
# BUILD_PLATFORM: x64
|
|
||||||
|
|
||||||
# NuGet package id, used for version detection & defaults to project name
|
|
||||||
PACKAGE_NAME: Mewtocol.NET
|
|
||||||
|
|
||||||
# Filepath with version info, relative to root of repository & defaults to PROJECT_FILE_PATH
|
|
||||||
# VERSION_FILE_PATH: Directory.Build.props
|
|
||||||
|
|
||||||
# Regex pattern to extract version info in a capturing group
|
|
||||||
# VERSION_REGEX: ^\s*<Version>(.*)<\/Version>\s*$
|
|
||||||
|
|
||||||
# Useful with external providers like Nerdbank.GitVersioning, ignores VERSION_FILE_PATH & VERSION_REGEX
|
|
||||||
# VERSION_STATIC: 1.0.0
|
|
||||||
|
|
||||||
# Flag to toggle git tagging, enabled by default
|
|
||||||
# TAG_COMMIT: true
|
|
||||||
|
|
||||||
# Format of the git tag, [*] gets replaced with actual version
|
|
||||||
# TAG_FORMAT: v*
|
|
||||||
|
|
||||||
# API key to authenticate with NuGet server
|
|
||||||
NUGET_KEY: ${{secrets.NUGET_KEY}}
|
|
||||||
|
|
||||||
# NuGet server uri hosting the packages, defaults to https://api.nuget.org
|
|
||||||
# NUGET_SOURCE: https://api.nuget.org
|
|
||||||
|
|
||||||
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default
|
|
||||||
# INCLUDE_SYMBOLS: false
|
|
||||||
63
.github/workflows/publish-pipeline.yml
vendored
Normal file
63
.github/workflows/publish-pipeline.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
name: Publish pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
permissions: write-all
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test-pipeline:
|
||||||
|
name: 'Invoke the test pipeline'
|
||||||
|
uses: ./.github/workflows/test-pipeline.yml
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
#Deploy package
|
||||||
|
publish-package:
|
||||||
|
name: 'Build and publish package'
|
||||||
|
needs: test-pipeline
|
||||||
|
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Parse version tag
|
||||||
|
run: |
|
||||||
|
VERSION=${{ github.ref_name }}
|
||||||
|
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set .csproj version to ${{ env.VERSION }}
|
||||||
|
run: |
|
||||||
|
sed -i 's/<Version>[0-9].[0-9].[0-9]<\/Version>/<Version>${{ env.VERSION }}<\/Version>/g' MewtocolNet/MewtocolNet.csproj
|
||||||
|
less MewtocolNet/MewtocolNet.csproj
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v2
|
||||||
|
with:
|
||||||
|
dotnet-version: '6.0.x'
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: Build as ${{ env.VERSION }}
|
||||||
|
run: dotnet build "MewtocolNet" --no-incremental
|
||||||
|
|
||||||
|
- name: Pack as ${{ env.VERSION }}
|
||||||
|
run: dotnet pack "MewtocolNet"
|
||||||
|
|
||||||
|
- name: Publish as ${{ env.VERSION }}
|
||||||
|
run: |
|
||||||
|
cd '${{ github.workspace }}/Builds'
|
||||||
|
ls -l
|
||||||
|
dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/WOmed/index.json"
|
||||||
|
|
||||||
|
- name: 'Upload artifacts to latest release'
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
upload_url: "${{ github.event.release.upload_url }}"
|
||||||
|
asset_path: ${{ github.workspace }}/Builds/Mewtocol.NET.${{ env.VERSION }}.nupkg
|
||||||
|
asset_name: Mewtocol.NET.${{ env.VERSION }}.nupkg
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
50
.github/workflows/test-pipeline.yml
vendored
Normal file
50
.github/workflows/test-pipeline.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Test pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
workflow_call:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
permissions: write-all
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
#Check the online status of the test PLCs first
|
||||||
|
check-plcs-online:
|
||||||
|
name: 'Test PLC online status'
|
||||||
|
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
||||||
|
steps:
|
||||||
|
- name: 'Ping FPX-H-C30T'
|
||||||
|
run: ping 192.168.115.210 -w 5
|
||||||
|
- name: 'Ping FPX-H-C14R'
|
||||||
|
run: ping 192.168.115.212 -w 5
|
||||||
|
- name: 'Ping FPX-C30T'
|
||||||
|
run: ping 192.168.115.213 -w 5
|
||||||
|
|
||||||
|
#Run unit tests on the test PLCs
|
||||||
|
run-unit-tests:
|
||||||
|
name: 'Run unit tests'
|
||||||
|
needs: check-plcs-online
|
||||||
|
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: 'Setup dotnet'
|
||||||
|
uses: actions/setup-dotnet@v2
|
||||||
|
with:
|
||||||
|
dotnet-version: '6.0.x'
|
||||||
|
|
||||||
|
- name: 'Run tests'
|
||||||
|
run: |
|
||||||
|
cd '${{ github.workspace }}/MewtocolTests'
|
||||||
|
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
|
||||||
|
|
||||||
|
#Upload to codecov
|
||||||
|
- name: Upload coverage reports to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
@@ -9,6 +9,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[](https://github.com/WOmed/MewtocolNet/actions/workflows/build-pipeline.yml)
|
[](https://github.com/WOmed/MewtocolNet/actions/workflows/build-pipeline.yml)
|
||||||
[](https://www.nuget.org/packages/Mewtocol.NET)
|
[](https://www.nuget.org/packages/Mewtocol.NET)
|
||||||

|
[](https://codecov.io/gh/WOmed/MewtocolNet)
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
@@ -141,8 +141,6 @@ await plc.ConnectAsync(
|
|||||||
|
|
||||||
## Writing data registers / contacts
|
## Writing data registers / contacts
|
||||||
|
|
||||||
⚠ **Never set a register by setting the property, always use one of the provided methods**
|
|
||||||
|
|
||||||
Registers are stored in an underlying layer for automatic handling, each register has a unique name and address.
|
Registers are stored in an underlying layer for automatic handling, each register has a unique name and address.
|
||||||
|
|
||||||
Classes that derive from `RegisterCollectionBase` reference these registers automatically using attributes.
|
Classes that derive from `RegisterCollectionBase` reference these registers automatically using attributes.
|
||||||
|
|||||||
Reference in New Issue
Block a user