I would like to skip the coverage testing (via codecov.io) for some of the files in a github repo. I’m using github actions to run workflows for continuous integration. The files I want to skip are not part of the primary modules anymore, but I’m not ready to delete them from the repo altogether.
I’ve come across a lot of conflicting information about how to do this, but nothing I have tried has actually worked. I reached to support at codecov.io, and after a bit of back and forth, got something figured out. Posted below in hopes it might be useful to others as well.
Here’s what worked for me.
- The list of files to be skipped is not included in the main
CI.yml file but included in a separate yml file with the ignore tag. Here’s my specific example:
ignore:
- "src/proto*.jl"
- "src/plotsForPaper.jl"
- "src/early_tests_of_bases.jl"
- "src/convertStrin.jl"
- "src/convertVaspData.jl"
- This file is named
codecov.yml (not .codecov.yml)
- This file is placed in the root folder of the repo, not in
.github/workflows.
Thanks for this solution. It was a good start for my investigation of a similar problem.
In my case I had a file with the file extension .jl, but which is actually just a template file that contains non-julia tokens. These extra tokens lead to the error
ERROR: LoadError: ParseError("parsing error in ext/julia.templ.jl:16")
inside of the coverage tool directory processing, i.e., CoverageTools.process_folder, which uses Meta.parse(...) and throws. I wanted to ignore this file from processing, but the solution presented above does not work here.
The file codecov.yml seems to only affects upload/reporting after the coverage file is already created and thus too late to prevent this error from happening.
My solution is, to restrict the coverage processing to specific directories only and put the templ.jl file somewhere else, e.g., with something like
- uses: julia-actions/julia-processcoverage@v1
with:
directories: src
in the CI.yml file.
This is actually just an include-list and not an exclude-list, but it works for me.