pulsar
pulsar copied to clipboard
[improve][CI] Generate unit test code coverage reports and upload to Codecov
Motivation
Add code coverage to make sure good quality of PRs. Although unit tests run in different runners, by using Codecov the coverage XML reports can be aggregated automately.
We can add the coverage to take a look first and then adjust the rule of coverage.
Verifying this change
- [x] Make sure that the change passes the CI checks.
Documentation
Check the box below or label this PR directly.
Need to update docs?
-
[ ]
doc-required
(Your PR needs to update docs and you will update later) -
[x]
doc-not-needed
(Please explain why) -
[ ]
doc
(Your PR contains doc changes) -
[ ]
doc-complete
(Docs have been already added)
Matching PR in forked repository
PR in forked repository: https://github.com/yaalsn/pulsar/pull/7
https://github.com/codecov/sourcegraph-codecov/blob/master/README.md This Chrome ext can show code coverage information from Codecov on GitHub directly which means no need to jump to Codecov to take look.
@yaalsn can you share the report of Pulsar right now? I'm afraid that we just add one more workflow while no one cares about it especially when the result is overwhelming all consumers.
@tisonkun Thanks for your reminder.
https://app.codecov.io/gh/apache/pulsar/tree/add-code-coverage This is this PR's coverage report, and Codecov will comment a message to this PR's body after the CI uploads the report.
I added some configuration to codecov.yml in my repo's pulsar because of the apache/pulsar's runner resources lacking. This is the result: https://github.com/yaalsn/pulsar/pull/11
-
We can get the uncovered part from Files Changed
-
The coverage and impacted files general information in comment

- Status check in action check, but it doesn't block the merge even if the coverage down
@tisonkun @nicoloboschi Could you take a look at the coverage data again? It looks good to me, what do you think?
@yaalsn interesting. The result seems not quite correct or useful.

And it seems quite noisy. Perhaps some settings are incorrect.
Codecov Report
:exclamation: No coverage uploaded for pull request base (
master@2b9ffac
). Click here to learn what that means. The diff coverage isn/a
.
@@ Coverage Diff @@
## master #17382 +/- ##
=========================================
Coverage ? 45.92%
Complexity ? 17525
=========================================
Files ? 1569
Lines ? 127638
Branches ? 14038
=========================================
Hits ? 58614
Misses ? 63028
Partials ? 5996
Flag | Coverage Δ | |
---|---|---|
unittests | 45.92% <0.00%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
@yaalsn interesting. The result seems not quite correct or useful.
@tisonkun Because there are some flaky tests, and if the job run success, the result will be different. If we want to turn off the email notification, we need to disable the comment from codecov too.
Another way is to change the behaviour to default, and it will send a email at the first time. (but it is not the final result)
/pulsarbot rerun-failure-checks
/pulsarbot rerun-failure-checks
/pulsarbot rerun-failure-checks
/pulsarbot rerun-failure-checks
Hi @yaalsn, the CI looks broken, we should rerun all jobs.
Error: Failed to execute goal on project pulsar-all-docker-image: Could not resolve dependencies for project org.apache.pulsar:pulsar-all-docker-image:pom:2.11.0-SNAPSHOT: The following artifacts could not be resolved: org.apache.pulsar:pulsar-io-distribution:pom:2.11.0-SNAPSHOT, org.apache.pulsar:pulsar-offloader-distribution:tar.gz:bin:2.11.0-SNAPSHOT: org.apache.pulsar:pulsar-io-distribution:pom:2.11.0-SNAPSHOT was not found in https://repository.apache.org/snapshots during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of apache.snapshots has elapsed or updates are forced -> [Help 1]
/pulsarbot rerun-failure-checks
/pulsarbot rerun-failure-checks
@tisonkun @nicoloboschi @eolivelli Could you please help review this PR again?