From db2a0e0b46e6f010087b88468e0745ea2315c446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 10 Jun 2026 14:35:47 +0200 Subject: [PATCH] Drop codecov.io upload; publish coverage to Azure DevOps instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit testfx already collects coverage with Microsoft Code Coverage (MTP `--coverage` configured by `test/coverage.config`). The only codecov.io-specific bits were the upload step and dashboard publishing — replace them with an AzDO-native publish that surfaces coverage in the build's Code Coverage tab and on the build summary (one click from the GitHub PR status check). Changes: * Remove `codecov.yml` and the `Codecov` NuGet package reference. * Delete `eng/CodeCoverage.proj` outright — no merge or conversion step is needed because `PublishCodeCoverageResults@2` ingests the binary `.coverage` format Microsoft Code Coverage emits natively (per the AzDO docs: "The task supports all kinds of coverage formats such as: .coverage, .covx, .covb, .cjson, .xml, .lcov, pycov, etc."), and merges multiple files via the minimatch glob input. * Replace the "Upload coverage to codecov.io" pipeline step with `PublishCodeCoverageResults@2` pointed at the per-test-module `*.coverage` files in `artifacts/TestResults/Debug`. * Update the matching comment in `eng/pipelines/steps/test-non-windows.yml`. Reviewers no longer get a Codecov PR comment; coverage is one click away on the AzDO build (linked from the GitHub PR status check). Same path as dotnet/runtime, dotnet/sdk, etc. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Directory.Packages.props | 1 - azure-pipelines.yml | 25 ++++--- codecov.yml | 22 ------ eng/CodeCoverage.proj | 91 ------------------------ eng/pipelines/steps/test-non-windows.yml | 5 +- 5 files changed, 19 insertions(+), 125 deletions(-) delete mode 100644 codecov.yml delete mode 100644 eng/CodeCoverage.proj diff --git a/Directory.Packages.props b/Directory.Packages.props index 1cb3496760..2e56ac1556 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -65,7 +65,6 @@ - diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 37f9367e1f..1243ed43aa 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -130,8 +130,9 @@ stages: # ValidateTestHostEnvironmentVariablesAsync hard-fails the run on non-NETCoreApp hosts # (see src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs), # and this glob mixes net4x and net8+/net9+ hosts. - # --coverage — Codecov upload is Debug-only (see "Upload coverage to codecov.io" step - # below), so collecting coverage in Release would just write unused .coverage files. + # --coverage — coverage upload is Debug-only (see "Merge coverage" / "Publish coverage to + # Azure DevOps" steps below), so collecting coverage in Release would just write unused + # .coverage files. - script: dotnet test --no-build --test-modules "artifacts/bin/*UnitTests*/$(_BuildConfig)/**/*UnitTests.exe" --results-directory $(BUILD.SOURCESDIRECTORY)\artifacts\TestResults\$(_BuildConfig) --no-progress --output detailed --report-trx --report-trx-filename "{asm}_{tfm}.trx" --report-azdo --report-azdo-progress --report-azdo-summary --report-junit --report-junit-filename "{asm}_{tfm}.xml" --hangdump --hangdump-timeout 15m --diagnostic --diagnostic-output-directory $(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig) --diagnostic-verbosity trace name: TestRelease displayName: Test (unit tests only) @@ -160,13 +161,19 @@ stages: ArtifactName: Integration_Tests_Windows_Binlogs_$(_BuildConfig) condition: and(always(), eq(variables._BuildConfig, 'Debug')) - # Upload code coverage to codecov.io - - script: dotnet msbuild -restore - eng/CodeCoverage.proj - /p:Configuration=$(_BuildConfig) - /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\CodeCoverage.binlog - displayName: Upload coverage to codecov.io - condition: and(succeeded(), eq(variables._BuildConfig, 'Debug')) + # Publish coverage to Azure DevOps. PublishCodeCoverageResults@2 accepts the binary + # .coverage format Microsoft Code Coverage emits natively (per + # https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/publish-code-coverage-results-v2: + # "The task supports all kinds of coverage formats such as: .coverage, .covx, .covb, + # .cjson, .xml, .lcov, pycov, etc."), and merges multiple files via the minimatch glob. + # Coverage shows up in the build's "Code Coverage" tab and on the build summary, one + # click from the GitHub PR status check (we used to upload to codecov.io here). + - task: PublishCodeCoverageResults@2 + displayName: 'Publish coverage to Azure DevOps' + inputs: + summaryFileLocation: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/*.coverage' + pathToSources: '$(Build.SourcesDirectory)/src' + condition: and(succeededOrFailed(), eq(variables._BuildConfig, 'Debug')) - task: PublishBuildArtifacts@1 displayName: 'Publish local dumps' diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 28165ad155..0000000000 --- a/codecov.yml +++ /dev/null @@ -1,22 +0,0 @@ -# https://docs.codecov.io/docs/codecov-yaml -# https://github.com/codecov/support/wiki/Codecov-Yaml - -coverage: - status: - project: - default: false - patch: - default: false - fixes: - - "eng/src/::src/" - -comment: - layout: "diff, flags, files" - -flags: - production: - paths: - - src/ - test: - paths: - - test/ diff --git a/eng/CodeCoverage.proj b/eng/CodeCoverage.proj deleted file mode 100644 index c336517d96..0000000000 --- a/eng/CodeCoverage.proj +++ /dev/null @@ -1,91 +0,0 @@ - - - - - $(NetCurrent) - $(ArtifactsDir)coverage\ - - - - - - - - - <_CodecovPath>$(PkgCodecov)\tools\Codecov.exe - <_LocalDotNetPath>$(DotNetRoot)\dotnet.exe - $(ArtifactsCoverageDir)full\ - $(ArtifactsCoverageDir)unit\ - $(ArtifactsCoverageDir)integration\ - Cobertura.xml - - - - <_CoverageReports Include="$(ArtifactsTestResultsDir)\*.coverage" /> - <_CoverageReports Include="@(_CoverageReports->'"%(Identity)"', ' ')" /> - <_UnitCoverageReports Include="@(_CoverageReports)" Condition="$([System.String]::Copy('%(Identity)').Contains('.UnitTests_'))" /> - <_UnitCoverageReports Include="@(_UnitCoverageReports->'"%(Identity)"', ' ')" /> - <_IntegrationCoverageReports Include="@(_CoverageReports)" Condition="$([System.String]::Copy('%(Identity)').Contains('.IntegrationTests_'))" /> - <_IntegrationCoverageReports Include="@(_IntegrationCoverageReports->'"%(Identity)"', ' ')" /> - - - - - - - - - - - - - - - - - - - - - <_CodecovFullArgs Include="-f;$(MergedFullCoverageDirectory)$(CoberturaFileName)" /> - <_CodecovUnitArgs Include="-f;$(MergedUnitCoverageDirectory)$(CoberturaFileName)" /> - <_CodecovIntegrationArgs Include="-f;$(MergedIntegrationCoverageDirectory)$(CoberturaFileName)" /> - - - <_CodecovArgs Include="--required" /> - - <_CodecovFlags Include="$(Configuration)" Condition="'$(Configuration)' != ''" /> - <_CodecovProductionFlags Include="@(_CodecovFlags)" /> - <_CodecovProductionFlags Include="production" /> - <_CodecovTestFlags Include="@(_CodecovFlags)" /> - <_CodecovTestFlags Include="test" /> - - <_CodecovProductionUnitFlags Include="@(_CodecovProductionFlags)" /> - <_CodecovProductionUnitFlags Include="unit" /> - <_CodecovTestUnitFlags Include="@(_CodecovTestFlags)" /> - <_CodecovTestUnitFlags Include="unit" /> - - <_CodecovProductionIntegrationFlags Include="@(_CodecovProductionFlags)" /> - <_CodecovProductionIntegrationFlags Include="integration" /> - <_CodecovTestIntegrationFlags Include="@(_CodecovTestFlags)" /> - <_CodecovTestIntegrationFlags Include="integration" /> - - - - - - - - - - - - - - - - diff --git a/eng/pipelines/steps/test-non-windows.yml b/eng/pipelines/steps/test-non-windows.yml index 736ec44328..4d68eb1e71 100644 --- a/eng/pipelines/steps/test-non-windows.yml +++ b/eng/pipelines/steps/test-non-windows.yml @@ -47,8 +47,9 @@ steps: # ValidateTestHostEnvironmentVariablesAsync hard-fails the run on non-NETCoreApp hosts # (see src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs). # Skipped here too for cross-platform parity with the Windows script (mixed net4x+netcoreapp glob). -# --coverage — Codecov upload is Debug-only (see "Upload coverage to codecov.io" step -# in azure-pipelines.yml), so collecting coverage in Release would just write unused .coverage files. +# --coverage — coverage upload is Debug-only (see "Merge coverage" / "Publish coverage to +# Azure DevOps" steps in azure-pipelines.yml), so collecting coverage in Release would just +# write unused .coverage files. - script: dotnet test --no-build --test-modules "artifacts/bin/*UnitTests*/$(_BuildConfig)/**/*UnitTests.dll" --results-directory $(BUILD.SOURCESDIRECTORY)/artifacts/TestResults/$(_BuildConfig) --no-progress --output detailed --report-trx --report-trx-filename "{asm}_{tfm}.trx" --report-azdo --report-azdo-progress --report-azdo-summary --report-junit --report-junit-filename "{asm}_{tfm}.xml" --hangdump --hangdump-timeout 15m --diagnostic --diagnostic-output-directory $(BUILD.SOURCESDIRECTORY)/artifacts/log/$(_BuildConfig) --diagnostic-verbosity trace name: TestRelease displayName: Test (unit tests only)