-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][CI] Generate unit test code coverage reports and upload to Codecov #17382
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a significant change to run Pulsar CI every commit on master. Comments inline.
Except that, the new steps take a few seconds to complete. I'm +0 to introduce it. Although, I'd say I never read a coverage report and don't find it helpful. If anyone who gets benefit from such a report instead of be bothered, please let me know (how).
.github/workflows/pulsar-ci.yaml
Outdated
@@ -25,6 +25,7 @@ on: | |||
push: | |||
branches: | |||
- branch-* | |||
- master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should run tests for every commit on the master. If you want to generate a codecov report every day, you may schedule a daily cron job. Anyway, this is a significant change to the CI workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, for each PR, we should only generate the codecov report for the new changes. I'm not sure does codecov can support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find any configuration on report for the new changes
except require_changes
in comment
selection and patch
in coverage/status section
, but It seems they are not what @codelipenghui wants. Could you help to take a look again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started the same work a couple of months ago here #14600 - my pull is no more valid because I did with the old CI
but I suggest you to add the jacoco config file (see my pull) and I will close mine
Also we need to discuss it on dev@
we need to document why it's important, how to see it and what are the future plans.
That was my thread discussion https://lists.apache.org/thread/o002mmb85jf2948ffq0fsgmg3cvbmh64
you can start replying to that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your initiative @yaalsn !
I agree with @tisonkun and with @nicoloboschi
we should discuss on dev@ and if the community really wants to go this path we must define a work flow.
I have seen (and also promoted) a few times to add Codecov or other similar tools in other OSS projects.
it is pretty hard to make it useful, especially with big projects like Pulsar.
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
|
@tisonkun @nicoloboschi Could you take a look at the coverage data again? It looks good to me, what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM. Since it doesn't affect the CI workload a lot, it's OK we fire the gun and give this report a try.
pom.xml
Outdated
<outputDirectory>target/report</outputDirectory> | ||
<excludes> | ||
<exclude>**/*.jar</exclude> | ||
</excludes> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just need to scan class file code coverage not jar files'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it may lead to some error if we scan the jar files.
@yaalsn interesting. The result seems not quite correct or useful. |
Codecov Report
@@ Coverage Diff @@
## master #17382 +/- ##
=========================================
Coverage ? 45.92%
Complexity ? 17525
=========================================
Files ? 1569
Lines ? 127638
Branches ? 14038
=========================================
Hits ? 58614
Misses ? 63028
Partials ? 5996
Flags with carried forward coverage won't be shown. Click here to find out more. |
@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 |
3 similar comments
/pulsarbot rerun-failure-checks |
/pulsarbot rerun-failure-checks |
/pulsarbot rerun-failure-checks |
Hi @yaalsn, the CI looks broken, we should rerun all jobs.
|
Co-authored-by: tison <[email protected]>
…he email notification times.
/pulsarbot rerun-failure-checks |
/pulsarbot rerun-failure-checks |
@@ -129,7 +129,7 @@ function test_group_proxy() { | |||
|
|||
function test_group_other() { | |||
mvn_test --clean --install \ | |||
-pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution' \ | |||
-pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution,!org.apache.pulsar:pulsar-all-docker-image' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change related to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I think it's something related to network, it does no harm to exclude org.apache.pulsar:pulsar-all-docker-image
in test_group_other
.
@tisonkun @nicoloboschi @eolivelli Could you please help review this PR again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go :)
@@ -129,7 +129,7 @@ function test_group_proxy() { | |||
|
|||
function test_group_other() { | |||
mvn_test --clean --install \ | |||
-pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution' \ | |||
-pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution,!org.apache.pulsar:pulsar-all-docker-image' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I think it's something related to network, it does no harm to exclude org.apache.pulsar:pulsar-all-docker-image
in test_group_other
.
<outputDirectory>target/report</outputDirectory> | ||
<excludes> | ||
<exclude>META-INF/**</exclude> | ||
</excludes> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the reason you made this change. Could you explain it a bit @yaalsn?
The last time you changed to **/*.jar
and now a new change, we need some background here.
However, given that the CI result looks good, I assume this change is OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaalsn Thank you. One more question: why remove <outputDirectory>target/report</outputDirectory>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tisonkun Because I think the default value makes sense: target/jacoco
directory means jacoco reports but target/report
means multi kinds of reports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tisonkun Thanks for your comments! I think all the questions are very good which I met during this PR, others see the discussion can know clearly about these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
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
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)
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