microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.47k stars 2.6k forks source link

[enhancement]: Option to not generate HTML report in PublishCodeCoverageResults@2 #20249

Open agehrke opened 1 month ago

agehrke commented 1 month ago

Task name

No response

Describe your feature request here

The docs for PublishCodeCoverageResults@2 states:

It will also produce a code coverage HTML report under the build artifacts

I will like to request an option to disable this - mostly because it takes ~2 mins in my pipelines to upload ~800 HTML files - see output from pipeline run below.

I have tried to read and understand the source code of PublishCodeCoverageResults@2 task. It seems most of the work is implemented in microsoft/azure-pipelines-coveragepublisher. This tool does seem to support not generating a HTML report

2024-08-01T12:05:35.3005553Z ##[section]Starting: Publish code coverage results
2024-08-01T12:05:35.3020062Z ==============================================================================
2024-08-01T12:05:35.3020209Z Task         : Publish code coverage results v2
2024-08-01T12:05:35.3020303Z Description  : Publish any of the code coverage results from a build
2024-08-01T12:05:35.3020404Z Version      : 2.242.1
2024-08-01T12:05:35.3020466Z Author       : Microsoft Corporation
2024-08-01T12:05:35.3020568Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
2024-08-01T12:05:35.3020693Z ==============================================================================

... a lot of lines omitted ...

2024-08-01T12:05:49.3367522Z Publishing coverage summary data.
2024-08-01T12:05:49.3369287Z line- 20232 of 40241 covered.
2024-08-01T12:05:49.4695291Z Publishing file coverage data.
2024-08-01T12:05:49.9591761Z Publishing code coverage HTML report.
2024-08-01T12:05:49.9691129Z Uploading 824 files.
2024-08-01T12:05:54.9732162Z Total file: 824 ---- Processed file: 32 (3%).
2024-08-01T12:06:04.9694755Z Total file: 824 ---- Processed file: 100 (12%).
2024-08-01T12:06:14.9733978Z Total file: 824 ---- Processed file: 165 (20%).
2024-08-01T12:06:24.9719017Z Total file: 824 ---- Processed file: 219 (26%).
2024-08-01T12:06:34.9706516Z Total file: 824 ---- Processed file: 283 (34%).
2024-08-01T12:06:44.9712204Z Total file: 824 ---- Processed file: 349 (42%).
2024-08-01T12:06:54.9726442Z Total file: 824 ---- Processed file: 413 (50%).
2024-08-01T12:07:04.9747968Z Total file: 824 ---- Processed file: 478 (58%).
2024-08-01T12:07:14.9857012Z Total file: 824 ---- Processed file: 548 (66%).
2024-08-01T12:07:24.9901476Z Total file: 824 ---- Processed file: 613 (74%).
2024-08-01T12:07:34.9904984Z Total file: 824 ---- Processed file: 671 (81%).
2024-08-01T12:07:44.9905137Z Total file: 824 ---- Processed file: 729 (88%).
2024-08-01T12:07:49.4200426Z 
2024-08-01T12:07:49.4274002Z ##[section]Finishing: Publish code coverage results
agehrke commented 1 month ago

I have tried to implement the functionality in this commit: https://github.com/microsoft/azure-pipelines-tasks/compare/master...agehrke:azure-pipelines-tasks:disableHtmlReport-PublishCodeCoverageResults

PublishCodeCoverageResults@2 task seems to be the only task that uses Tasks/Common/coveragepublisher/coveragepublisher.ts so above commit contains a breaking change to the PublishCodeCoverage() function.