Skip to content

Commit 17cf86a

Browse files
EvangelinkCopilot
andcommitted
Drop codecov.io upload; publish coverage to Azure DevOps instead
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 — its only remaining job was a `dotnet coverage merge` invocation, which is now a one-line YAML script step. The unit/integration split it used to do was a codecov.io flag thing and has no equivalent in `PublishCodeCoverageResults@2`. * Replace the "Upload coverage to codecov.io" pipeline step with a "Merge coverage to Cobertura" script (one line, invokes the `dotnet-coverage` local tool already declared in `.config/dotnet-tools.json`) plus `PublishCodeCoverageResults@2`, which renders Cobertura natively in Azure DevOps. * 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>
1 parent 741048f commit 17cf86a

5 files changed

Lines changed: 26 additions & 124 deletions

File tree

Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" />
6666
</ItemGroup>
6767
<ItemGroup Label="Test dependencies">
68-
<PackageVersion Include="Codecov" Version="1.12.3" />
6968
<PackageVersion Include="AwesomeAssertions" Version="9.4.0" />
7069
<PackageVersion Include="FSharp.Core" Version="11.0.100" />
7170
<PackageVersion Include="NUnit" Version="4.6.0" />

azure-pipelines.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ stages:
130130
# ValidateTestHostEnvironmentVariablesAsync hard-fails the run on non-NETCoreApp hosts
131131
# (see src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs),
132132
# and this glob mixes net4x and net8+/net9+ hosts.
133-
# --coverage — Codecov upload is Debug-only (see "Upload coverage to codecov.io" step
134-
# below), so collecting coverage in Release would just write unused .coverage files.
133+
# --coverage — coverage upload is Debug-only (see "Merge coverage" / "Publish coverage to
134+
# Azure DevOps" steps below), so collecting coverage in Release would just write unused
135+
# .coverage files.
135136
- 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
136137
name: TestRelease
137138
displayName: Test (unit tests only)
@@ -160,14 +161,28 @@ stages:
160161
ArtifactName: Integration_Tests_Windows_Binlogs_$(_BuildConfig)
161162
condition: and(always(), eq(variables._BuildConfig, 'Debug'))
162163

163-
# Upload code coverage to codecov.io
164-
- script: dotnet msbuild -restore
165-
eng/CodeCoverage.proj
166-
/p:Configuration=$(_BuildConfig)
167-
/bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\CodeCoverage.binlog
168-
displayName: Upload coverage to codecov.io
164+
# Merge per-test-module .coverage files (Microsoft Code Coverage, collected via MTP
165+
# --coverage configured by test/coverage.config) into a single Cobertura.xml. We invoke
166+
# dotnet-coverage (declared as a local tool in .config/dotnet-tools.json) directly — the
167+
# tool is restored as part of the build above.
168+
- script: dotnet coverage merge
169+
--output $(BUILD.SOURCESDIRECTORY)\artifacts\coverage\Cobertura.xml
170+
--output-format Cobertura
171+
$(BUILD.SOURCESDIRECTORY)\artifacts\TestResults\$(_BuildConfig)\*.coverage
172+
displayName: Merge coverage to Cobertura
169173
condition: and(succeeded(), eq(variables._BuildConfig, 'Debug'))
170174

175+
# Publish the merged Cobertura report to Azure DevOps. Coverage shows up in the build's
176+
# "Code Coverage" tab and on the build summary; the GitHub PR status check links back to
177+
# this build, so reviewers can click through to see coverage without a third-party
178+
# dashboard (we used to upload to codecov.io here).
179+
- task: PublishCodeCoverageResults@2
180+
displayName: 'Publish coverage to Azure DevOps'
181+
inputs:
182+
summaryFileLocation: '$(Build.SourcesDirectory)/artifacts/coverage/Cobertura.xml'
183+
pathToSources: '$(Build.SourcesDirectory)/src'
184+
condition: and(succeededOrFailed(), eq(variables._BuildConfig, 'Debug'))
185+
171186
- task: PublishBuildArtifacts@1
172187
displayName: 'Publish local dumps'
173188
inputs:

codecov.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

eng/CodeCoverage.proj

Lines changed: 0 additions & 91 deletions
This file was deleted.

eng/pipelines/steps/test-non-windows.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ steps:
4747
# ValidateTestHostEnvironmentVariablesAsync hard-fails the run on non-NETCoreApp hosts
4848
# (see src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs).
4949
# Skipped here too for cross-platform parity with the Windows script (mixed net4x+netcoreapp glob).
50-
# --coverage — Codecov upload is Debug-only (see "Upload coverage to codecov.io" step
51-
# in azure-pipelines.yml), so collecting coverage in Release would just write unused .coverage files.
50+
# --coverage — coverage upload is Debug-only (see "Merge coverage" / "Publish coverage to
51+
# Azure DevOps" steps in azure-pipelines.yml), so collecting coverage in Release would just
52+
# write unused .coverage files.
5253
- 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
5354
name: TestRelease
5455
displayName: Test (unit tests only)

0 commit comments

Comments
 (0)