Skip to content

Commit

Permalink
ci: add code coverage check
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Linne <[email protected]>
  • Loading branch information
alexanderlinne committed May 24, 2024
1 parent 98f7f0e commit e17e1d2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 37 deletions.
6 changes: 2 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"tools": {
"csharpier": {
"version": "0.28.0",
"commands": [
"dotnet-csharpier"
]
"commands": ["dotnet-csharpier"]
}
}
}
}
16 changes: 16 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ jobs:
run: dotnet tool restore
- name: Check formatting
run: dotnet csharpier --check .
coverage:
name: Check code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:
dotnet-version: 8.0.204
- name: Run tests
run: dotnet test -c Debug --collect:"XPlat Code Coverage" --settings coverlet.runsettings ArchUnitNETTests/
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
run-tests:
name: Run tests
strategy:
Expand Down
70 changes: 37 additions & 33 deletions ArchUnitNETTests/ArchUnitNETTests.csproj
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Company>TNG Technology Consulting GmbH</Company>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Company>TNG Technology Consulting GmbH</Company>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\ArchUnitNET.xUnit\ArchUnitNET.xUnit.csproj" />
<ProjectReference Include="..\TestAssembly\TestAssembly.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ArchUnitNET.xUnit\ArchUnitNET.xUnit.csproj" />
<ProjectReference Include="..\TestAssembly\TestAssembly.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
</ItemGroup>

<ItemGroup>
<None Update="Dependencies\cpplib\CppDllTest.dll">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="Domain\PlantUml\zzz_test_version_with_errors.puml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="Dependencies\cpplib\CppDllTest.dll">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="Domain\PlantUml\zzz_test_version_with_errors.puml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Dependencies\cpplib\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Dependencies\cpplib\" />
</ItemGroup>

<ItemGroup>
<Reference Include="CppDllTest">
<HintPath>Dependencies\cpplib\CppDllTest.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="CppDllTest">
<HintPath>Dependencies\cpplib\CppDllTest.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
</Project>
13 changes: 13 additions & 0 deletions coverlet.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>cobertura</Format>
<Include>[ArchUnitNET]*</Include>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>

0 comments on commit e17e1d2

Please sign in to comment.