Skip to content

Commit bc91f82

Browse files
authored
Experimenting with test coverage (#16)
* Experimenting with test coverage * Test für CodeCoverage auf Serverseite * add experimental status to readme * Try to exclude the commandlineargs from test coverage report * Server side is now correctly reported
1 parent 2a97f41 commit bc91f82

File tree

4 files changed

+121
-83
lines changed

4 files changed

+121
-83
lines changed

.github/workflows/server.yml

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,70 @@
11
on:
2-
push:
2+
push:
33

44
env:
5-
DOTNET_VERSION: "7.0.x" # The .NET SDK version to use
6-
SOLUTION_DIR: "LocalNetAppChat"
7-
PROJECT: "./LocalNetAppChat.Server/LocalNetAppChat.Server.csproj"
8-
RELEASEPREFIX: "LocalNetAppChat"
5+
DOTNET_VERSION: "7.0.x" # The .NET SDK version to use
6+
SOLUTION_DIR: "LocalNetAppChat"
7+
PROJECT: "./LocalNetAppChat.Server/LocalNetAppChat.Server.csproj"
8+
RELEASEPREFIX: "LocalNetAppChat"
99

1010
jobs:
11-
build:
12-
name: build-${{matrix.os}}
13-
runs-on: ${{ matrix.os }}
14-
strategy:
15-
matrix:
16-
os: [ubuntu-latest, windows-latest]
17-
include:
18-
- os: ubuntu-latest
19-
RUNTIMEID: linux-x64
20-
OUTPUTDIR: lnac-server-linux-x64
21-
22-
- os: windows-latest
23-
RUNTIMEID: win-x64
24-
OUTPUTDIR: lnac-server-win-x64
25-
26-
steps:
27-
- uses: actions/checkout@v2
28-
- name: Setup .NET Core
29-
uses: actions/setup-dotnet@v1
30-
with:
31-
dotnet-version: ${{ env.DOTNET_VERSION }}
32-
33-
- name: Install dependencies
34-
run: dotnet restore
35-
working-directory: Source/${{ env.SOLUTION_DIR }}
36-
37-
# - name: Set version number
38-
# run: ./Set-Version-Number.ps1 "1.${{github.run_number}}"
39-
# working-directory: Scripts
40-
# shell: powershell
41-
42-
- name: Build
43-
run: dotnet build --configuration Release --no-restore
44-
working-directory: Source/${{ env.SOLUTION_DIR }}
45-
46-
# - name: Test + Cover
47-
# run: ./update-coverage.sh
48-
49-
- name: Publish
50-
run: dotnet publish ${{ env.PROJECT }} -c Release -o ${{matrix.OUTPUTDIR}} -p:PublishReadyToRun=true --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:UseAppHost=true -r ${{matrix.RUNTIMEID}}
51-
working-directory: Source/${{ env.SOLUTION_DIR }}
52-
53-
- uses: vimtor/action-zip@v1
54-
with:
55-
files: ./Source/${{ env.SOLUTION_DIR }}/${{matrix.OUTPUTDIR}}/
56-
dest: ${{ env.SOLUTION_DIR }}/${{matrix.OUTPUTDIR}}.zip
57-
58-
- name: Release
59-
uses: softprops/action-gh-release@v1
60-
if: startsWith(github.ref, 'refs/tags/')
61-
with:
62-
files: |
63-
${{ env.SOLUTION_DIR }}/${{matrix.OUTPUTDIR}}.zip
11+
build:
12+
name: build-${{matrix.os}}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest]
17+
include:
18+
- os: ubuntu-latest
19+
RUNTIMEID: linux-x64
20+
OUTPUTDIR: lnac-server-linux-x64
21+
22+
- os: windows-latest
23+
RUNTIMEID: win-x64
24+
OUTPUTDIR: lnac-server-win-x64
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Setup .NET Core
29+
uses: actions/setup-dotnet@v1
30+
with:
31+
dotnet-version: ${{ env.DOTNET_VERSION }}
32+
33+
- name: Install dependencies
34+
run: dotnet restore
35+
working-directory: Source/${{ env.SOLUTION_DIR }}
36+
37+
# - name: Set version number
38+
# run: ./Set-Version-Number.ps1 "1.${{github.run_number}}"
39+
# working-directory: Scripts
40+
# shell: powershell
41+
42+
- name: Build
43+
run: dotnet build --configuration Release --no-restore
44+
working-directory: Source/${{ env.SOLUTION_DIR }}
45+
46+
- name: Test + Cover
47+
run: dotnet test
48+
working-directory: Source/${{ env.SOLUTION_DIR }}
49+
50+
- name: Coveralls
51+
uses: coverallsapp/github-action@master
52+
with:
53+
github-token: ${{ secrets.GITHUB_TOKEN }}
54+
path-to-lcov: Source/${{ env.SOLUTION_DIR }}/LocalNetAppChat.Server.Domain.Tests/coverage.info
55+
56+
- name: Publish
57+
run: dotnet publish ${{ env.PROJECT }} -c Release -o ${{matrix.OUTPUTDIR}} -p:PublishReadyToRun=true --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:UseAppHost=true -r ${{matrix.RUNTIMEID}}
58+
working-directory: Source/${{ env.SOLUTION_DIR }}
59+
60+
- uses: vimtor/action-zip@v1
61+
with:
62+
files: ./Source/${{ env.SOLUTION_DIR }}/${{matrix.OUTPUTDIR}}/
63+
dest: ${{ env.SOLUTION_DIR }}/${{matrix.OUTPUTDIR}}.zip
64+
65+
- name: Release
66+
uses: softprops/action-gh-release@v1
67+
if: startsWith(github.ref, 'refs/tags/')
68+
with:
69+
files: |
70+
${{ env.SOLUTION_DIR }}/${{matrix.OUTPUTDIR}}.zip

README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
# LocalNetAppChat
22

3-
[![.github/workflows/bot.yml](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/bot.yml/badge.svg)](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/bot.yml)
4-
[![.github/workflows/client.yml](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/client.yml/badge.svg)](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/client.yml)
3+
[![.github/workflows/bot.yml](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/bot.yml/badge.svg)](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/bot.yml)
4+
[![.github/workflows/client.yml](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/client.yml/badge.svg)](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/client.yml)
55
[![.github/workflows/server.yml](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/server.yml/badge.svg)](https://github.com/CleverCodeCravers/LocalNetAppChat/actions/workflows/server.yml)
66

7+
[![Experimental Coverage Status](https://coveralls.io/repos/github/CleverCodeCravers/LocalNetAppChat/badge.svg?branch=main)](https://coveralls.io/github/CleverCodeCravers/LocalNetAppChat?branch=main)
8+
79
LocalNetAppChat (LNAC) is a server/client C# command line interface that gives your apps a way to communicate with each other over the local network.
810

911
<!-- TOC -->
1012

11-
- [Vision](#vision)
12-
- [Features](#features)
13-
- [Usage](#usage)
14-
- [Server CLI](./docs/Server/README.md)
15-
- [Client CLI](./docs/Client/README.md)
16-
- [Bot CLI](./docs/Bot/README.md)
17-
- [Installation](#installation)
18-
- [Server](#server)
19-
- [Client](#client)
20-
- [Bot](#bot)
21-
- [Contributions](#contributions)
22-
- [Questions?](#questions?)
13+
- [Vision](#vision)
14+
- [Features](#features)
15+
- [Usage](#usage)
16+
- [Server CLI](./docs/Server/README.md)
17+
- [Client CLI](./docs/Client/README.md)
18+
- [Bot CLI](./docs/Bot/README.md)
19+
- [Installation](#installation)
20+
- [Server](#server)
21+
- [Client](#client)
22+
- [Bot](#bot)
23+
- [Contributions](#contributions)
24+
- [Questions?](#questions?)
2325

2426
<!-- /TOC -->
2527

@@ -31,25 +33,25 @@ Without the need of programming skills, it gives you a server that supports text
3133

3234
The focus usage points at the moment are:
3335

34-
- Collecting execution log information (sending messages that can be reviewed by a human)
35-
- Sending commands to bots either direct or as a broadcast and receiving their results
36-
- Exchanging files between the computers that take part.
36+
- Collecting execution log information (sending messages that can be reviewed by a human)
37+
- Sending commands to bots either direct or as a broadcast and receiving their results
38+
- Exchanging files between the computers that take part.
3739

3840
It should be reasonably secure to use in a trusted local network.
3941

4042
Usage Scenarios include:
4143

42-
- [CI/CD-Pipeline](./docs/usage-cicd-pipeline.md)
43-
- [Central Log](./docs/usage-central-log.md)
44+
- [CI/CD-Pipeline](./docs/usage-cicd-pipeline.md)
45+
- [Central Log](./docs/usage-central-log.md)
4446

4547
## Features
4648

47-
- Available for Windows, Linux and macOS
48-
- Easy to use
49-
- Adds a few simple entry points / command line tools that enable network communication between a group of hosts and sub applications.
50-
- Ability to execute and run tasks between your local apps through command line over the network
51-
- Encrypted communication
52-
- and more
49+
- Available for Windows, Linux and macOS
50+
- Easy to use
51+
- Adds a few simple entry points / command line tools that enable network communication between a group of hosts and sub applications.
52+
- Ability to execute and run tasks between your local apps through command line over the network
53+
- Encrypted communication
54+
- and more
5355

5456
## Showcase
5557

Source/LocalNetAppChat/LocalNetAppChat.Domain.Tests/LocalNetAppChat.Domain.Tests.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

9+
<PropertyGroup Condition="$(MSBuildProjectName.Contains('.Tests'))">
10+
<CollectCoverage>true</CollectCoverage>
11+
<ExcludeByAttribute>GeneratedCodeAttribute</ExcludeByAttribute>
12+
<CoverletOutputFormat>lcov</CoverletOutputFormat>
13+
</PropertyGroup>
14+
915
<ItemGroup>
16+
<PackageReference Include="coverlet.collector" Version="3.2.0">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
20+
<PackageReference Include="coverlet.msbuild" Version="3.2.0">
21+
<PrivateAssets>all</PrivateAssets>
22+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
23+
</PackageReference>
1024
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221003-04" />
1125
<PackageReference Include="NUnit" Version="3.13.3" />
1226
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />

Source/LocalNetAppChat/LocalNetAppChat.Server.Domain.Tests/LocalNetAppChat.Server.Domain.Tests.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,22 @@
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

9+
<PropertyGroup Condition="$(MSBuildProjectName.Contains('.Tests'))">
10+
<CollectCoverage>true</CollectCoverage>
11+
<ExcludeByAttribute>GeneratedCodeAttribute</ExcludeByAttribute>
12+
<Exclude>[CommandLineArguments]*,[LocalNetAppChat.Domain]*</Exclude>
13+
<CoverletOutputFormat>lcov</CoverletOutputFormat>
14+
</PropertyGroup>
15+
916
<ItemGroup>
17+
<PackageReference Include="coverlet.collector" Version="3.2.0">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
</PackageReference>
21+
<PackageReference Include="coverlet.msbuild" Version="3.2.0">
22+
<PrivateAssets>all</PrivateAssets>
23+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24+
</PackageReference>
1025
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
1126
<PackageReference Include="NUnit" Version="3.13.3" />
1227
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />

0 commit comments

Comments
 (0)