Skip to content

Commit e170d4d

Browse files
committed
Inhibiting CodeCov upload for individual reports if they don't exist.
1 parent 52ba336 commit e170d4d

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,20 @@ jobs:
209209
$ProgressPreference = 'SilentlyContinue'
210210
Invoke-WebRequest -Uri https://cli.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
211211
212-
./codecov --verbose upload-process --fail-on-error -t $(CODECOV_TOKEN) -f "coveragereportNetFx\Cobertura.xml" -F netfx
213-
./codecov --verbose upload-process --fail-on-error -t $(CODECOV_TOKEN) -f "coveragereportNetCore\Cobertura.xml" -F netcore
214-
./codecov --verbose upload-process --fail-on-error -t $(CODECOV_TOKEN) -f "coveragereportAddOns\Cobertura.xml" -F addons
212+
# The CodeCov CLI fails if the report files aren't found, so confirm
213+
# they exist before uploading.
214+
if (Test-Path "coveragereportNetFx\Cobertura.xml")
215+
{
216+
./codecov --verbose upload-process --fail-on-error -t $(CODECOV_TOKEN) -f "coveragereportNetFx\Cobertura.xml" -F netfx
217+
}
218+
if (Test-Path "coveragereportNetCore\Cobertura.xml")
219+
{
220+
./codecov --verbose upload-process --fail-on-error -t $(CODECOV_TOKEN) -f "coveragereportNetCore\Cobertura.xml" -F netcore
221+
}
222+
if (Test-Path "coveragereportAddOns\Cobertura.xml")
223+
{
224+
./codecov --verbose upload-process --fail-on-error -t $(CODECOV_TOKEN) -f "coveragereportAddOns\Cobertura.xml" -F addons
225+
}
215226
displayName: Upload to CodeCov
216227
217228
- pwsh: |

0 commit comments

Comments
 (0)