Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage reports #1044

Merged
merged 11 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 54 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
# between datacenter versions and home versions
- rid: win-x64
os: windows-latest
name: win-x64
- rid: win-x86
os: windows-latest
name: win-x86

# given there appear to be significant differences
# we test all available ubuntu versions here
Expand All @@ -31,6 +33,7 @@ jobs:

- rid: ubuntu.20.04-x64
os: ubuntu-20.04
name: ubuntu-20.04-x64

# Ubuntu raises an SEH exception, see https://discord.com/channels/521092042781229087/1004867182787838043/1004887853500739684
# - rid: ubuntu.18.04-x64
Expand All @@ -42,18 +45,21 @@ jobs:
os: macos-12
xcode_sdk: macosx12.3 # macos-12 image is currently (5th August 2022) on MacOS 12.5 but the latest sdk is macosx12.3
xcode_version: Xcode_13.4.1
name: macosx12.3-xcode13

- rid: osx.11.0-x64
os: macos-11
xcode_sdk: macosx11.3
xcode_version: Xcode_12.5.1
name: macosx11.3-xcode12
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: "true"
- name: Setup .NET
uses: actions/setup-dotnet@v2

- name: Restore
run: dotnet restore --runtime ${{ matrix.rid }}
# Build can't be done in a separate step as building for a specific runtime & configuration is unsupported for some reason...
Expand All @@ -63,6 +69,53 @@ jobs:
if: matrix.xcode_version != 0
run: sudo xcode-select -switch /Applications/${{ matrix.xcode_version }}.app
- name: Test
run: dotnet test -c Release --no-restore --runtime ${{ matrix.rid }}
run: dotnet test -c Release --no-restore --runtime ${{ matrix.rid }} --collect:"XPlat Code Coverage" --results-directory ./coverage
env:
SILK_DOTNET_Scraper__XcodeSdk: ${{ matrix.xcode_sdk }}
- name: Upload Coverage Results
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.name }}
path: ./coverage/**/coverage.cobertura.xml
Report_Coverage:
runs-on: ubuntu-latest
needs: Test
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@v3
with:
path: ./coverage
- name: Setup .NET Core # Required to execute ReportGenerator
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.300

- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.9
with:
reports: './coverage/**/**/coverage.cobertura.xml'
targetdir: './coveragereport'
reporttypes: 'Cobertura'
# historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution.
# plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon).
verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version.
- name: Generate Summary
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: './coveragereport/Cobertura.xml'
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: file
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: always() && github.event_name == 'pull_request'
with:
header: coverage-results
path: code-coverage-results.md
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(MsExtensionNugetVersion)" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MsExtensionNugetVersion)" />
<PackageVersion Include="Bogus" Version="34.0.2" />
<PackageVersion Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>
</Project>
15 changes: 8 additions & 7 deletions tests/Silk.NET.Maths.Tests/Silk.NET.Maths.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\libraries\Silk.NET.Maths\Silk.NET.Maths.csproj" />
<ProjectReference Include="..\..\src\libraries\Silk.NET.Maths\Silk.NET.Maths.csproj" />
</ItemGroup>

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

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\generators\Silk.NET.SilkTouch.Emitter\Silk.NET.SilkTouch.Emitter.csproj" />
<ProjectReference Include="..\Silk.NET.SilkTouch.TestFramework\Silk.NET.SilkTouch.TestFramework.csproj" />
<ProjectReference Include="..\..\src\generators\Silk.NET.SilkTouch.Emitter\Silk.NET.SilkTouch.Emitter.csproj" />
<ProjectReference Include="..\Silk.NET.SilkTouch.TestFramework\Silk.NET.SilkTouch.TestFramework.csproj" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<PackageReference Include="Verify.Xunit" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PackageReference Include="libClangSharp" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\generators\Silk.NET.SilkTouch.Symbols\Silk.NET.SilkTouch.Symbols.csproj" />
<ProjectReference Include="..\Silk.NET.SilkTouch.TestFramework\Silk.NET.SilkTouch.TestFramework.csproj" />
<ProjectReference Include="..\Silk.NET.SilkTouch.Tests.Common\Silk.NET.SilkTouch.Tests.Common.csproj" />
<PackageReference Include="Bogus" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>

<ItemGroup>
Expand Down