Aggregate coverage from multiple GH actions jobs

I have a repo which contains a main package and a sub package located in /lib, for which I run CI in parallel using multiple GH-actions jobs (groups). This generally works well, except that it’s tricky to get coverage reports including coverage from all jobs.

I make use of

      - uses: julia-actions/julia-processcoverage@v1
          directories: src,lib/ControlSystemsBase/src

to ensure that both src and the subpackage located in lib/ControlSystemsBase/src are included in the coverage, but this does not quite do what I want. Each job reports code coverage to codecov independently, and thus only includes the coverage for the code that was run for this particular job. This has the effect that the last job to finish and report the coverage “wins” by somehow overwriting the report of the earlier job, and codecov will thus only consider the lines covered by the last finishing job.

What I think I need to do is to let each job somehow save the .lcov files or the processed result, and then wait with processing coverage until the coverage info from all jobs is available. Does anyone know how to make something like this (or any other approach to the problem) happen using Github actions?

1 Like

Are you sure about that? I was under the impression that Codecov somohow merged all code coverage results…

However, even if this is the case, it’s not ideal because you then receive alerts from codecov after each submission, until the last job finishes and the coverage statistics (as seen by codecov) are complete. So in any case I’d be interested to know if there is a good way to handle such cases.

Codecov should indeed be able to handle that. You can use .codecov.yml (e.g., to tell it to report results only after having received X reports.

For Coveralls, the situation is a bit different since we have seen some problems there. But you can use a manual workaround like

1 Like

Thanks, that appears to have solved half of my problems! :pray: The other half was solved by adding a forgotten Pkg.test(..., coverage=true). The full set of changes I had to do in my case, for anyone finding this thread in the future, can be found here