No coverage reports found for @4, @5 using .NET's Microsoft.Testing.Platform
I'm trying to migrate some .NET test projects to the new Microsoft.Testing.Platform runner instead of the now-old Visual Studio based runner. However, I'm having issues getting the coverage file to be found by codecov after switching.
Here's my workflow file.
- name: Publish
run: |
dotnet restore
dotnet run -c Release --project src/${{ env.project_name }}.Tests/${{ env.project_name }}.Tests.csproj --coverage --coverage-output-format xml --results-directory ./coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage # I've also tried 'coverage' as well as not including this property at all.
verbose: true
Here's the job output:
Publish step
In process file artifacts produced:
- /home/runner/work/ars/ars/coverage/1dece2dd-61a2-4761-a929-71b9b28ff08a.xml
Test run summary: Passed! - /home/runner/work/ars/ars/src/Ars.Function.Tests/bin/Release/net9.0/Ars.Function.Tests.dll (net9.0|x64)
Upload coverage reports to Codecov step
Run codecov/codecov-action@v5
Run CC_ACTION_VERSION=$(cat ${GITHUB_ACTION_PATH}/src/version)
==> Running Action version 5.1.2
Run git config --global --add safe.directory /home/runner/work/ars/ars
Run CC_FORK="false"
Run if [ "false" == 'true' ] && [ "$CC_FORK" != 'true' ];
==> Token set from input
Run if [ -z "$CC_BRANCH" ] && [ -z "$CC_TOKEN" ] && [ "$CC_FORK" == 'true' ]
Run if [ -z "$CC_SHA" ];
Run ${GITHUB_ACTION_PATH}/dist/codecov.sh
_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Wrapper-0.0.31
==> Detected linux
-> Downloading https://cli.codecov.io/latest/linux/codecov
==> Finishing downloading linux:latest
Version: v9.1.1
gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: /home/runner/.gnupg/trustdb.gpg: trustdb created
gpg: key 806BB28AED779869: public key "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1
==> Verifying GPG signature integrity
-> Downloading https://cli.codecov.io/latest/linux/codecov.SHA256SUM
-> Downloading https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpg: Signature made Sat Dec 7 16:07:53 2024 UTC
gpg: using RSA key 27034E7FDB850E0BBC2C62FF806BB28AED779869
gpg: Good signature from "Codecov Uploader (Codecov Uploader Verification Key) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2703 4E7F DB85 0E0B BC2C 62FF 806B B28A ED77 9869
codecov: OK
==> CLI integrity verified
-> Token of length 36 detected
==> Running upload-coverage
./codecov --verbose upload-coverage -t <redacted> --git-service github --dir coverage --gcov-executable gcov
info - 2024-12-[30](https://github.com/sendtrucks/ars/actions/runs/12540533840/job/34967933585#step:5:32) 01:38:12,971 -- ci service found: github-actions
debug - 2024-12-30 01:38:12,973 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.GitVersioningSystem'>
debug - 2024-12-30 01:38:12,974 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.GitVersioningSystem'>
debug - 2024-12-30 01:38:12,976 -- Loading config from /home/runner/work/ars/ars/.github/codecov.yml
debug - 2024-12-30 01:38:12,979 -- Starting upload coverage --- {"verbose": true, "auto_load_params_from": null, "codecov_yml_path": null, "enterprise_url": null, "version": "cli-9.1.1", "command": "upload-coverage", "git_service": "github", "files_search_root_folder": "coverage", "gcov_executable": "gcov", "commit_sha": "90ffe39a730bcc6204[31](https://github.com/sendtrucks/ars/actions/runs/12540533840/job/34967933585#step:5:33)0d20af0753c9ead27165", "fail_on_error": false, "slug": "sendtrucks/ars", "report_code": "default", "network_root_folder": "/home/runner/work/ars/ars", "files_search_exclude_folders": [], "files_search_explicitly_listed_files": [], "disable_search": false, "disable_file_fixes": false, "build_code": "1254053[38](https://github.com/sendtrucks/ars/actions/runs/12540533840/job/34967933585#step:5:41)40", "build_url": "https://github.com/sendtrucks/ars/actions/runs/12[54](https://github.com/sendtrucks/ars/actions/runs/12540533840/job/34967933585#step:5:58)0533840", "job_code": "Deploy Function App", "name": "12540533840", "branch": "main", "pull_request_number": null, "env_vars": {}, "flags": [], "plugin_names": ["xcode", "gcov", "pycoverage"], "dry_run": false, "use_legacy_uploader": false, "handle_no_reports_found": false, "report_type": "coverage",
debug - 2024-12-30 01:38:12,9[80](https://github.com/sendtrucks/ars/actions/runs/12540533840/job/34967933585#step:5:85) -- Selected preparation plugins --- {"selected_plugins": ["<class 'codecov_cli.plugins.xcode.XcodePlugin'>", "<class 'codecov_cli.plugins.gcov.GcovPlugin'>", "<class 'codecov_cli.plugins.pycoverage.Pycoverage'>"], "cli_config": {}}
debug - 2024-12-30 01:38:12,980 -- Running preparation plugin: <class 'codecov_cli.plugins.xcode.XcodePlugin'>
debug - 2024-12-30 01:38:12,980 -- Running xcode plugin...
warning - 2024-12-30 01:38:12,980 -- xcrun is not installed or can't be found.
debug - 2024-12-30 01:38:12,980 -- Running preparation plugin: <class 'codecov_cli.plugins.gcov.GcovPlugin'>
debug - 2024-12-30 01:38:12,980 -- Running gcov plugin...
warning - 2024-12-30 01:38:12,980 -- No gcov data found.
debug - 2024-12-30 01:38:12,981 -- Running preparation plugin: <class 'codecov_cli.plugins.pycoverage.Pycoverage'>
warning - 2024-12-30 01:38:12,981 -- coverage.py is not installed or can't be found.
debug - 2024-12-30 01:38:12,981 -- Collecting relevant files
info - 2024-12-30 01:38:12,988 -- Found 0 coverage files to report
Error: No coverage reports found. Please make sure you're generating reports successfully.
==> Failed to upload coverage
Any ideas what this could be?
Same here. A simple action version change from v5 to v3 fixes the issue. Report files are there, indeed.
@rubo is this an open source repository? If so, can you link?
@thomasrockhu-codecov Here you go. This is a test branch supposed to run quickly producing just 2 report files.
@thomasrockhu-codecov Are there any updates, or do you need a simpler example?
@rubo sorry for the delay, still working on it
Any update?
This is still the case, so is there any progress for the fix?
@thomasrockhu-codecov Any progress?
@thomasrockhu-codecov
The workaround with v3 is also broken. No upload is possible anymore. Any progress with this?
FWIW I abandoned this product for this reason.
FWIW I abandoned this product for this reason.
A few hours later, I was able to fix the problem in my repositories.
@samtrion thank you and Daniel Palme!
For anyone wondering, the trick is to use Daniel Palme's ReportGenerator to combine all Cobertura XML files into one and then point the Codecov v5 action at that single file:
https://github.com/dailydevops/pipelines/blob/f4784567421204c44b7fdd9742136ff05450ac88/.github/workflows/step-dotnet-tests.yml#L97-L116