coverage-reporter icon indicating copy to clipboard operation
coverage-reporter copied to clipboard

Upload incremental coverage reports

Open erazemk opened this issue 11 months ago • 2 comments

To reduce the CI pipeline deployment time for one of my company's Go libraries, I added support for only running unit tests on packages that had changes in each PR, but this means that only those test cases are reported in the code coverage file, which is then uploaded to Coveralls. This results in incorrect coverage reports, since Coveralls assumes those are the only tests we have across our whole library.

Is there a way to push incremental code coverage reports to Coveralls with the universal coverage reporter?

erazemk avatar Dec 20 '24 14:12 erazemk

Hi @erazemk,

Yes! The feature is called Carryforward Flags, and you enable it by passing the carryforward flag with your call to the (close) Parallel Build Webhook. (Here's a little more about it.)

From docs:

With Carryforward Flags, you can tell Coveralls that, if some coverage reports, for some portions of your project, are missing from a given build, it should carry forward the last known report it has on file for those subprojects. This is useful because it saves you from having to build your entire project on every pull request.

Carryforward Flags Usage: If you're using the Coveralls Orb for CircleCI, which I think you are, you'll want to add the carryforward param to the upload command along with parallel_finished:

          - coveralls/upload:
              parallel_finished: true
              carryforward: job1,job2

Or alternatively:

              carryforward: all

If you are using Coverage Reporter directly, your new call should look something like this:

coveralls done --carryforward "unit-tests,integration-tests" --build-number 123

afinetooth avatar Dec 20 '24 23:12 afinetooth

@afinetooth Thanks so much for your response! I’ll test it out and close the issue once I confirm everything went well.

erazemk avatar Dec 22 '24 12:12 erazemk