Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message: No coverage reports found #1712

Open
stefanofusai opened this issue Dec 5, 2024 · 7 comments
Open

Error message: No coverage reports found #1712

stefanofusai opened this issue Dec 5, 2024 · 7 comments
Assignees
Labels
Low Low Priority Issues (to be fixed or re-evaluated in 12 months support

Comments

@stefanofusai
Copy link

Hello team,
Since upgrading from v4 to v5 I've been unable to upload coverage reports and status checks are always stuck in pending. Here are the logs I'm seeing:

...
==> Running do-upload
      ./codecov  do-upload -t <redacted> --gcov-executable gcov --git-service github --slug <REDACTED>
info - 2024-12-05 09:02:11,8[75](<REDACTED>) -- ci service found: github-actions
warning - 2024-12-05 09:02:11,883 -- No config file could be found. Ignoring config.
warning - 2024-12-05 09:02:11,886 -- xcrun is not installed or can't be found.
warning - 2024-12-05 09:02:11,931 -- No gcov data found.
warning - 2024-12-05 09:02:11,932 -- coverage.py is not installed or can't be found.
info - 2024-12-05 09:02:11,940 -- Found 0 coverage files to report
Error: No coverage reports found. Please make sure you're generating reports successfully.
==> Failed to upload

Here's what my workflow file looks like:

name: CI Pipeline
on:
  - push
  - pull_request
jobs:
  run-tests:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version-file: pyproject.toml
      - name: Set up uv
        uses: astral-sh/setup-uv@v4
        with:
          version: 0.5.5
          enable-cache: true
      - name: Install the project
        run: uv sync --group=testing
      - name: Run tests
        run: uv run pytest
      - name: Upload coverage reports to Codecov
        uses: codecov/[email protected]
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          slug: <REDACTED>

My pyproject.toml tells pytest to generate coverage reports, and everything was working fine in with codecov-action v4:

[tool.pytest.ini_options]
addopts = "--cov --verbose --cov-report=term-missing:skip-covered --durations=10 --numprocesses=auto"

Image

Let me know if I can provide more info!

@thomasrockhu-codecov
Copy link
Contributor

@stefanofusai would you be able to do a ls -alrt before running Codecov? I'm wondering what coverage report is getting create dand where it might be. I'm guessing if you're using --cov it'll probably be a .coverage file somewhere.

@thomasrockhu-codecov thomasrockhu-codecov self-assigned this Dec 5, 2024
@thomasrockhu-codecov thomasrockhu-codecov added bug Something isn't working support Low Low Priority Issues (to be fixed or re-evaluated in 12 months and removed bug Something isn't working labels Dec 5, 2024
@stefanofusai
Copy link
Author

Sure thing. Here's the output:


2024-12-05T20:31:23.7954679Z ##[group]Run ls -alrt
2024-12-05T20:31:23.7955270Z �[36;1mls -alrt�[0m
2024-12-05T20:31:23.8038008Z shell: /usr/bin/bash -e {0}
2024-12-05T20:31:23.8038598Z env:
2024-12-05T20:31:23.8039313Z   pythonLocation: /opt/hostedtoolcache/Python/3.13.1/x64
2024-12-05T20:31:23.8040263Z   PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.13.1/x64/lib/pkgconfig
2024-12-05T20:31:23.8041200Z   Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.13.1/x64
2024-12-05T20:31:23.8042292Z   Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.13.1/x64
2024-12-05T20:31:23.8043162Z   Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.13.1/x64
2024-12-05T20:31:23.8044096Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.13.1/x64/lib
2024-12-05T20:31:23.8044946Z   UV_CACHE_DIR: /home/runner/work/_temp/setup-uv-cache
2024-12-05T20:31:23.8045580Z ##[endgroup]
2024-12-05T20:31:23.8167817Z total 148
2024-12-05T20:31:23.8168349Z drwxr-xr-x 3 runner docker  4096 Dec  5 20:30 ..
2024-12-05T20:31:23.8169233Z -rw-r--r-- 1 runner docker 47984 Dec  5 20:30 uv.lock
2024-12-05T20:31:23.8170072Z drwxr-xr-x 3 runner docker  4096 Dec  5 20:30 src
2024-12-05T20:31:23.8170973Z -rw-r--r-- 1 runner docker  1651 Dec  5 20:30 pyproject.toml
2024-12-05T20:31:23.8171700Z -rw-r--r-- 1 runner docker   758 Dec  5 20:30 README.md
2024-12-05T20:31:23.8172534Z -rw-r--r-- 1 runner docker  2078 Dec  5 20:30 .pre-commit-config.yaml
2024-12-05T20:31:23.8173321Z -rw-r--r-- 1 runner docker  2699 Dec  5 20:30 .gitignore
2024-12-05T20:31:23.8174167Z drwxr-xr-x 3 runner docker  4096 Dec  5 20:30 .github
2024-12-05T20:31:23.8174930Z drwxr-xr-x 8 runner docker  4096 Dec  5 20:30 .git
2024-12-05T20:31:23.8175653Z drwxr-xr-x 4 runner docker  4096 Dec  5 20:31 .venv
2024-12-05T20:31:23.8176510Z drwxr-xr-x 3 runner docker  4096 Dec  5 20:31 tests
2024-12-05T20:31:23.8177209Z -rw-r--r-- 1 runner docker 53248 Dec  5 20:31 .coverage
2024-12-05T20:31:23.8177928Z drwxr-xr-x 3 runner docker  4096 Dec  5 20:31 .pytest_cache
2024-12-05T20:31:23.8178912Z drwxr-xr-x 8 runner docker  4096 Dec  5 20:31 .

I'd like to point out that nothing changed in my workflow except upgrading to codecov 5

@thomasrockhu-codecov
Copy link
Contributor

@stefanofusai yeah I figured. I just... I don't know why we aren't seeing the .coverage file.

I would love to have an open source repro of this, but I realize that might not be possible. I think if you run coverage xml, that should solve your problem quickly. But again, I'd love to dig into this more as to why this is happening.

@stefanofusai
Copy link
Author

Not sure either. Let me know if I can be of further help.

@stefanofusai
Copy link
Author

stefanofusai commented Dec 6, 2024

Hey @thomasrockhu-codecov, just noticed that one of my OS repos also has the same problem since switching to uv projects.
That seems to be the culprit as I'm still using [email protected] in this repo and just migrated yesterday to uv projects.

Compared to the last test run before migrating to uv projects, available at https://github.com/stefanofusai/pyamldantic/actions/runs/12006346040/job/33464710427, it seems to me that the issue is that coverage is not being installed:

Before uv projects:

==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4.6.0/dist/codecov do-upload'
/home/runner/work/_actions/codecov/codecov-action/v4.6.0/dist/codecov do-upload --git-service github
info - 2024-11-25 08:47:07,465 -- ci service found: github-actions
warning - 2024-11-25 08:47:07,473 -- No config file could be found. Ignoring config.
warning - 2024-11-25 08:47:07,474 -- xcrun is not installed or can't be found.
warning - 2024-11-25 08:47:07,477 -- No gcov data found.
info - 2024-11-25 08:47:07,477 -- Generating coverage.xml report in /home/runner/work/pyamldantic/pyamldantic
info - 2024-11-25 08:47:07,596 -- Wrote XML report to coverage.xml
info - 2024-11-25 08:47:07,605 -- Found 1 coverage files to report
info - 2024-11-25 08:47:07,605 -- > /home/runner/work/pyamldantic/pyamldantic/coverage.xml
info - 2024-11-25 08:47:08,094 -- Your upload is now processing. When finished, results will be available at: https://app.codecov.io/github/stefanofusai/pyamldantic/commit/dd2db2ab9fa2b9a1cb038f[46](https://github.com/stefanofusai/pyamldantic/actions/runs/12006346040/job/33464710427#step:7:47)bf81639853a5cd47
info - 2024-11-25 08:47:08,287 -- Process Upload complete

After uv projects:

==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4.6.0/dist/codecov do-upload'
/home/runner/work/_actions/codecov/codecov-action/v4.6.0/dist/codecov do-upload --git-service github -C 7a4ea41cda[44](https://github.com/stefanofusai/pyamldantic/actions/runs/12195810439/job/34022169158?pr=41#step:7:45)ac9b331407c792fe5615564df9a7
info - 2024-12-06 08:53:04,352 -- ci service found: github-actions
warning - 2024-12-06 08:53:04,361 -- No config file could be found. Ignoring config.
warning - 2024-12-06 08:53:04,364 -- xcrun is not installed or can't be found.
warning - 2024-12-06 08:53:04,374 -- No gcov data found.
warning - 2024-12-06 08:53:04,374 -- coverage.py is not installed or can't be found.
info - 2024-12-06 08:53:04,382 -- Found 0 coverage files to report
Error: No coverage reports found. Please make sure you're generating reports successfully.
Warning: Codecov:
                        Failed to properly upload report: The process '/home/runner/work/_actions/codecov/codecov-action/v4.6.0/dist/codecov' failed with exit code 1

@stefanofusai
Copy link
Author

Hey @thomasrockhu-codecov, would you be able to take a look at this?
Thank you for the help once again!

@stefanofusai
Copy link
Author

stefanofusai commented Dec 10, 2024

@thomasrockhu-codecov I think that I have found the issue, it's due to https://github.com/codecov/codecov-cli/blob/8295b035779b3fc8f16149ff5a50dc2aa03b5f44/codecov_cli/services/upload/file_finder.py#L45 and the fact that "*.coverage" is present in coverage_files_excluded_patterns

In fact, when adding files: .coverage (and, optionally, disable_search: true), to my codecov-action workflow, I get the following output:

| warning - 2024-12-10 16:58:09,492 -- Some files being explicitly added are found in the list of excluded files for upload. We are still going to search for the explicitly added files. --- {"files": [".coverage"]}
| info - 2024-12-10 16:58:09,501 -- Found 1 coverage files to report

And everything works fine. I am not sure why I wasn't getting this before... Let me know if you have any ideas/better ways to fix this!

As you said, another fix is to generate the xml report but I didn't want to generate a duplicate coverage file if I already had generated the .coverage file. Can you let me know what the reasoning is behind it being present in coverage_files_excluded_patterns?

Edit:

Unfortunately, even after uploading the reports (I can see them on the CodeCov website), my status checks are stuck:
Image

You can see it here with codecov-action@v4: stefanofusai/pyamldantic#49
And in my private repos with codecov-action@v5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Low Low Priority Issues (to be fixed or re-evaluated in 12 months support
Projects
None yet
Development

No branches or pull requests

2 participants