Skip to content

Commit eb771a3

Browse files
committed
Updated build process
Refactored tests
1 parent fcd150a commit eb771a3

File tree

9 files changed

+77
-40
lines changed

9 files changed

+77
-40
lines changed

.github/workflows/build.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,9 @@ jobs:
2525
- name: Build
2626
run: dotnet build --no-restore
2727
- name: Test
28-
run: dotnet test --no-build --verbosity normal
28+
run: dotnet test --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx"
29+
- uses: actions/upload-artifact@v4 # upload test results
30+
if: success() || failure() # run this step even if previous step failed
31+
with:
32+
name: test-results
33+
path: /home/runner/work/RfmUsb.Net/RfmUsb.Net.UnitTests/TestResults/test-results.trx

.github/workflows/test-report.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Test Report'
2+
on:
3+
workflow_run:
4+
workflows: ['Build'] # runs after CI workflow
5+
types:
6+
- completed
7+
permissions:
8+
contents: read
9+
actions: read
10+
checks: write
11+
jobs:
12+
report:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: dorny/test-reporter@v1
16+
with:
17+
artifact: test-results # artifact name
18+
name: xUnit Tests # Name of the check run which will be created
19+
path: '*.trx' # Path to test results (inside artifact .zip)
20+
reporter: dotnet-trx # Format of test results
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2023 Derek Goslin
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace RfmUsb.Net.IntTests.Options
26+
{
27+
public class DeviceConfigurationOptions
28+
{
29+
public int BaudRate { get; init; }
30+
31+
public string? Rfm69ComPort { get; init; }
32+
33+
public string? Rfm9xComPort { get; init; }
34+
}
35+
}

RfmUsb.Net.IntTests/RfmUsb.Net.IntTests.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@
3030
<None Update="appsettings.json">
3131
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3232
</None>
33-
<None Update="Tests.runsettings">
33+
<None Update="Runsettings\Tests.runsettings">
3434
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3535
</None>
3636
</ItemGroup>
3737

38+
<PropertyGroup>
39+
<RunSettingsFilePath>$(MSBuildProjectDirectory)\RunSettings\Tests.runsettings</RunSettingsFilePath>
40+
</PropertyGroup>
3841
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<RunSettings>
3+
</RunSettings>

RfmUsb.Net.IntTests/Tests.runsettings

-37
This file was deleted.

RfmUsb.Net.IntTests/appsettings.json

+5
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@
1313
"Name": "Console"
1414
}
1515
]
16+
},
17+
"DeviceConfigurationOptions": {
18+
"BaudRate": 230400,
19+
"Rfm69ComPort": "COM6",
20+
"Rfm9xComPort": "COM3"
1621
}
1722
}

RfmUsb.Net.UnitTests/RfmUsb.Net.UnitTests.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@
2828
</ItemGroup>
2929

3030
<ItemGroup>
31-
<None Update="Tests.runsettings">
31+
<None Update="Runsettings\Tests.runsettings">
3232
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3333
</None>
3434
</ItemGroup>
3535

36+
<PropertyGroup>
37+
<RunSettingsFilePath>$(MSBuildProjectDirectory)\RunSettings\Tests.runsettings</RunSettingsFilePath>
38+
</PropertyGroup>
3639
</Project>

0 commit comments

Comments
 (0)