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

MAINT: Use dotnet-coverage instead of Coverlet for coverage collection #10809

Merged
merged 2 commits into from
May 25, 2023

Conversation

asilverman
Copy link
Contributor

@asilverman asilverman commented May 23, 2023

Description

3 years back, Coverlet was only xplat solution available for .NET and that is why it's such popular. VS Code Coverage solution was only available for Windows. Things have changed since. Today the VS Code Coverage solution is more reliable and considerably faster, it offers static or dynamic instrumentation and unlike Coverlet it supports native C++.

There is a Code Coverage window in which you can run code coverage and display results is only available in VS Ent SKU, however, you can collect coverage in command line scenarios and it's also used in Azure pipelines.

Now it's also offered as .NET global tool and it allows you to export results into various format such as popular Cobertura.

PR Changes:

  • Changes .github\workflows\codecov.runsettings to use the VS Code Coverage tool to increase speed and enhance coverage collection
  • Folds some settings to .github\workflows\codecov.runsettings that were previously passed to the dotnet test command as command line arguments so that we have more readable pipelines
Microsoft Reviewers: Open in CodeFlow

@asilverman asilverman added this to the v0.18 milestone May 23, 2023
@asilverman asilverman requested a review from majastrz May 23, 2023 20:07
@asilverman asilverman self-assigned this May 23, 2023
@asilverman asilverman marked this pull request as ready for review May 23, 2023 20:40
@majastrz
Copy link
Member

This is a good find btw!

@asilverman asilverman requested a review from majastrz May 24, 2023 05:20
@@ -532,7 +532,7 @@ jobs:
uses: actions/setup-dotnet@v3

- name: Run Tests
run: dotnet test --filter '${{ matrix.config.filter}}' --configuration release --logger trx --blame --collect:"XPlat Code Coverage" --settings ./.github/workflows/codecov.runsettings --results-directory ./TestResults/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blame

Btw, why did you take out the --blame option?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind. I see it in the run settings file.

@@ -532,7 +532,7 @@ jobs:
uses: actions/setup-dotnet@v3

- name: Run Tests
run: dotnet test --filter '${{ matrix.config.filter}}' --configuration release --logger trx --blame --collect:"XPlat Code Coverage" --settings ./.github/workflows/codecov.runsettings --results-directory ./TestResults/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trx

I also noticed you took out the --logger trx option. Are trx files being dropped to the test results directory? The task that follows this one uploads trx files as a build artifact in case they are needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind. I see the logger settings in runsettings.

Copy link
Member

@majastrz majastrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@asilverman asilverman merged commit eb63729 into main May 25, 2023
44 checks passed
@asilverman asilverman deleted the asilverman/code-coverage branch May 25, 2023 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants