codecov-action
codecov-action copied to clipboard
"Ignore paths" not working with custom Codecov config file location
With these lines in our GitHub actions workflow, we report our test coverage to codecov.
- name: Report test coverage to codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./coverage/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
codecov_yml_path: ./.config/codecov.yml
Note that we're using codecov_yml_path to refer to a custom location of the codecov.yml file inside a .config/ folder. The file is recognized as can be seen in the last GitHub Actions run here:
debug - 2024-06-01 14:01:52,870 -- Loading config from .config/codecov.yml
Inside the .config/codecov.yml file, we specify that the spec/ folder should be ignored entirely by codecov as we don't want our test files themselves to contribute to the coverage statistics.
# Ignore test files themselves in the Codecov report
# see: https://about.codecov.io/blog/should-i-include-test-files-in-code-coverage-calculations/
ignore:
- "../spec/**/*"
- "**/*_spec.rb"
However, in the codecov dashboard, we still see the spec/ folder and all of its contents in the code tree.
Some questions
- From the "Ignoring paths" documentation page, it's not clear whether we should use
../spec/**/*or./spec/**/*when a custom location for thecodecov.ymlfile is set up. Both variants don't seem to work for us. Maybe it's something obvious that I can't see? - Should the file
coverage.xmlonly contain results that are not ignored by Codecov? Or is Codecov smart enough to filter this according to theignorekey in thecodecov.ymlfile?
Hey, just let me know if there's any information missing that you need to track down the bug.
@Splines just fyi, the codecov_yml_path is not meant to be used this way. It is for a separate feature, although I see the naming is extremely confusing.
You will still need to have the yaml in the root, dev/ or .github folders.
@thomasrockhu-codecov ah ok, thanks for your response. Too bad it doesn't work with the .config/ folder...
It is for a separate feature
Out of interest, would you mind sharing with me what other feature it refers to?
@Splines Automated test selection