Help with path fixing (configuration does not seem to take effect)

Description

Hello I am experimenting with a complicated CI setup where I need to move the folder where my code resides before running the tests to force the test suite to run against the packaged/installed version of the software instead of the “unpackaged” version available on the CWD.

To be more specific, I have a few folders under the root of the project, and, just before running the tests, I move them to a src/ folder that I just create in the CI.

Since the src folder does not exist in the repository, I tried to use path fixing to allow codecov to find the source code for the files. This is my configuration:

# codecov.yml
comment: false
coverage:
  status:
    project:
      threshold: 0.5%
fixes:
  - "src/::"        # reduce root e.g., "src/setuptools/" => "setuptools/"

However, this configuration does not seem to take any effect, and the src directory still shows up in the report:

Moreover I cannot see coverage line by line, because codecov is not able to find the source files…

I wonder if anyone could help me with that…

CI/CD URL

CI: Allow codecov to correctly find file paths · abravalheri/setuptools@789e974 · GitHub
commit: Allow codecov to correctly find file paths · abravalheri/setuptools@789e974 · GitHub

Codecov Output

Please provide the full output of running the uploader on your CI/CD. This will typically have the Codecov logo as ASCII.

/usr/bin/bash codecov.sh -n  -F Linux, 3.10 -Q github-action-v1.5.2

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-1.0.3


==> git version 2.34.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> GitHub Actions detected.
    Env vars used:
      -> GITHUB_ACTIONS:    true
      -> GITHUB_HEAD_REF:   
      -> GITHUB_REF:        refs/heads/isolated-ci-bkp
      -> GITHUB_REPOSITORY: abravalheri/setuptools
      -> GITHUB_RUN_ID:     1746316062
      -> GITHUB_SHA:        789e974b15c1c73da529093b70f74f2c37ebdd32
      -> GITHUB_WORKFLOW:   tests
    project root: .
    Yaml found at: .codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Searching for coverage reports in:
    + .
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./coverage.xml bytes=315785
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    -> No adjustments found
==> Gzipping contents
        28K	/tmp/codecov.S0tSYK.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=isolated-ci-bkp&commit=789e974b15c1c73da529093b70f74f2c37ebdd32&build=1746316062&build_url=http%3A%2F%2Fgithub.com%2Fabravalheri%2Fsetuptools%2Factions%2Fruns%2F1746316062&name=&tag=&slug=abravalheri%2Fsetuptools&service=github-actions&flags=Linux,3.10&pr=&job=tests&cmd_args=n,F,Q
->  Pinging Codecov
https://codecov.io/upload/v4?package=github-action-v1.5.2-1.0.3&token=secret&branch=isolated-ci-bkp&commit=789e974b15c1c73da529093b70f74f2c37ebdd32&build=1746316062&build_url=http%3A%2F%2Fgithub.com%2Fabravalheri%2Fsetuptools%2Factions%2Fruns%2F1746316062&name=&tag=&slug=abravalheri%2Fsetuptools&service=github-actions&flags=Linux,3.10&pr=&job=tests&cmd_args=n,F,Q
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2022-01-25/55D75BD7CC9277244A6086C573053C17/789e974b15c1c73da529093b70f74f2c37ebdd32/829accbd-f7cc-4dd6-bd87-3af7f0a905f8.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EKKHVKCKHW7KBCGM7IHR55T63V2PAVJWLVFNITJHDU5G6R5IRN3LMWJA%2F20220125%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20220125T160002Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=0b6de12425dd3f3a829f2ba0eea5496efcf495b3d7f1ca6529f7ae6e40a36bff
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 24654    0     0  100 24654      0  62892 --:--:-- --:--:-- --:--:-- 62892
    -> Reports have been successfully queued for processing at https://codecov.io/github/abravalheri/setuptools/commit/789e974b15c1c73da529093b70f74f2c37ebdd32

Expected Results

  • to not see any mentions to src in the codecov UI
  • to be able to browse the report in the codecov UI and see the files line by line (codecov should be able to find the correct files in the github repository).

Actual Results

  • the src directory shows up in the codecov UI
  • codecov cannot find the correct files in the github repository (since it does not seem to apply the path fix specified in the codecov.yml file).

Additional Information

Example of paths in the XML file being uploaded (note how they start with src/ and therefore should be fixed by the rule in codecov.yml):

<class name="__init__.py" filename="src/pkg_resources/__init__.py" complexity="0" line-rate="0.8342" branch-rate="0">

My expectation would be this showing up as pkg_resources/__init__.py in the UI, after the path fix.

@abravalheri you have an error in your yaml

comment: false
coverage:
  status:
    project:
      default:
        threshold: 0.5%
fixes:
  - "src/::" 

You can validate it in the future following these instructions. Let me know if that fixes your issue.

Thank you very much @tom, that was indeed the issue!