chore: Add workflow to generate code coverage report#3022
chore: Add workflow to generate code coverage report#3022timcassell merged 1 commit intodotnet:masterfrom
Conversation
| matrix: | ||
| # https://github.com/microsoft/codecoverage/blob/main/docs/supported-os.md | ||
| # Note: ARM64 on linux/macos are not supported. And it's not works as expected on macos-15-intel. | ||
| os: [windows-latest, ubuntu-latest] |
There was a problem hiding this comment.
windows-11-arm image is not added here.
Because it's executed with x64 emulation layer.
To run native arm64 code. It need add net481 target framework.
https://learn.microsoft.com/en-us/dotnet/framework/whats-new/#arm64native481
There was a problem hiding this comment.
I don't think it runs emulated without net481 tfm. Unlike .Net Core, it runs on the framework that's installed on the machine (which is 4.8.1) regardless of the project's tfm.
There was a problem hiding this comment.
I reconfirmed behaviors on windows-11-arm.
And It seems my description was incorrect.
When running app on windows-11-arm with Any CPU build.
It's running on x64 architecture (emulated) by default.
And when explicitly setting PreferNativeArm64=true setting.
It's running on native arm64 architecture.
TestCode.cs
#! dotnet
#:property PublishAot = false
#:property LangVersion = Latest
#:property PreferNativeArm64 = true
using System;
using System.Runtime.InteropServices;
// .NET Runtime information
Console.WriteLine(RuntimeInformation.FrameworkDescription);
Console.WriteLine(RuntimeInformation.OSDescription);
Console.WriteLine();
// Environment information
Console.WriteLine($"{nameof(RuntimeInformation.OSArchitecture)}: {RuntimeInformation.OSArchitecture}");
Test Workflow
name: run
on:
pull_request:
push:
workflow_dispatch:
jobs:
test-windows-core:
strategy:
matrix:
os: [windows-latest, windows-11-arm]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Run net472
run: |
dotnet run -c Release -f net472 TestCode.cs # Use .NET 4.7.2 because 4.6.2 don't have RuntimeInformation
- name: Run net481
run: |
dotnet run -c Release -f net481 TestCode.cs
- name: Run net80
run: |
dotnet run -c Release -f net80 TestCode.cs
1609f26 to
3512e9b
Compare
6bb9d3a to
a19717e
Compare
204c2b4 to
fe24ea6
Compare
|
HTML coverate report generation is removed from this PR. When it need to generate HTML report, run following steps.
Sample file-based app that generate HTML report |
|
On latest CI DotTraceSmokeTest failed with following transient error. (On windows-latest) |
|
Can you use irongut/CodeCoverageSummary for the report? |
Coverage summary information is already outputted as Job Summary. Sample URL Some |
|
Oh ok. Since we get the job summary, html probably isn't a big deal. Does the html report have better info than the job summary? |
|
I've attached sample HTML below (It's generated without running IntegrationTests) Unzip archive then try to open |
|
Oh, that's a lot of html files. 😅 I think it's fine. If someone wants to inspect the coverage more closely they can download the artifacts and generate the html. Is this ready to merge? |
I'm currently retrying HTML generation on GitHub Actions side. |
51479ab to
acb05d5
Compare
acb05d5 to
26e5d2d
Compare
|
I've added following changes.
Example output |
This PR add GitHub Actions workflow
generate-coverage-report.yaml.This workflow contains following steps.
5.1. Write generated markdown to job summary.
5.2. Upload generated HTML report files
How to run
generate-coverate-report.yamlworkflowThis workflow is expected to be manually invoked.
It can run workflow with following command. (Note: Workflow file need be merged to
masterbefore execute workflow)1. Run workflow with Web UI
https://github.com/dotnet/BenchmarkDotNet/actions/workflows/generate-coverage-report.yaml
2.1. Collect full coverage data with gh command
2.2 Collect code coverage without IntegrationTests with gh command
Example report summary
Summary
Coverage
BenchmarkDotNet - 72.8%
icPresenter
cPresenter
isticPresenter
ter
tor
rer
riptor
or
escriptor
riptor
er
arer
rter
ter
gFieldInfo
Helpers
kAction
kActionBase
kActionByRef
kActionByRefReadonly
kActionTask
kActionTask
kActionValueTask
kActionValueTask
kActionVoid
kActionVoidPointer
arer
omparer
BenchmarkDotNet.Analyzers - 93.1%
BenchmarkDotNet.Annotations - 19%
BenchmarkDotNet.Diagnostics.dotMemory - 20%
BenchmarkDotNet.Diagnostics.dotTrace - 18.7%
BenchmarkDotNet.Diagnostics.Windows - 9.3%
tribute
criptor
or
or