Skip to content
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

[HUDI-627] Aggregate code coverage and publish to codecov.io during CI #1347

Merged
merged 1 commit into from
Feb 27, 2020

Conversation

ramachandranms
Copy link
Contributor

What is the purpose of the pull request

  • This PR aggregates code coverage across modules to get a holistic coverage number (since we have tests that gets run across modules. e.g. hudi-client tests classes in hudi-common)
  • This also published the report to codecov.io (e.g. report from the fork)
  • Above step automatically adds coverage report to every PR (e.g. PR from fork)

Brief change log

  • Modified pom files to include coverage in missing modules (hudi-hadoop-mr, hudi-spark & hudi-timeline-service)
  • Added a wrapper module for aggregation (due to limitations in jacoco). This can be remove in future once this PR gets merged to a release.

Verify this pull request

  • Ran travis in private fork and verified the published report & PR.

Committer checklist

  • Has a corresponding JIRA in PR title & commit

  • Commit message is descriptive of the change

  • CI is green

  • Necessary doc changes done or have another open PR

  • For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.

@vinothchandar vinothchandar self-assigned this Feb 21, 2020
@ramachandranms
Copy link
Contributor Author

we have a code coverage report already in codecov.io through this PR


mode=$1

if [ "$mode" = "unit" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration tests do not generate jacoco report (as yet). This is not detected by codecov as an error. So it may be simple to just add "bash <(curl -s https://codecov.io/bash)" directly to the travis.yml. Future changes to integration test wont require any changes here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made changes as u have suggested.

@@ -278,8 +276,6 @@
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the following link, you can have JaCoCo append coverage of all modules in the same file in the parent module target folder. We can change the dataFile to "${project.basedir}/../target/coverage-reports/jacoco-ut.exec".
Might also have to change the prepare-agent destFile.

https://community.sonarsource.com/t/unit-tests-across-multi-module-projects/9662/3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This seems to be specific to how sonarqube works and we don't use sonar/sonarqube for aggregation
  2. This is the recommendation from official jacoco documentation, which I have followed in this PR.

I did try out the sonar documentation on a test project locally and couldn't make it to work.

@codecov-io
Copy link

codecov-io commented Feb 24, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@078d482). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #1347   +/-   ##
========================================
  Coverage          ?   0.64%           
  Complexity        ?       2           
========================================
  Files             ?     287           
  Lines             ?   14310           
  Branches          ?    1463           
========================================
  Hits              ?      92           
  Misses            ?   14215           
  Partials          ?       3
Impacted Files Coverage Δ Complexity Δ
...main/scala/org/apache/hudi/DataSourceOptions.scala 67.04% <0%> (ø) 0 <0> (?)
...in/scala/org/apache/hudi/IncrementalRelation.scala 0% <0%> (ø) 0 <0> (?)
...on/table/view/RemoteHoodieTableFileSystemView.java 0% <0%> (ø) 0 <0> (?)
...rg/apache/hudi/common/util/SerializationUtils.java 0% <0%> (ø) 0 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 078d482...f348038. Read the comment docs.

pom.xml Outdated
@@ -51,6 +51,7 @@
<module>packaging/hudi-timeline-server-bundle</module>
<module>docker/hoodie/hadoop</module>
<module>hudi-integ-test</module>
<module>hudi-test-coverage-aggregator</module>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to do this without adding this module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now we cannot do without adding a new module in jacoco. there is a PR out in jacoco OSS to avoid this. But it is not getting much traction. i am closely following it. will remove this module once that PR gets merged to a release. for now this is just a wrapper module that does not get deployed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really dislike the additional module. can you reuse one of the bundle modules instead? or hudi-integ-test?

Copy link
Member

@vinothchandar vinothchandar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramachandranms who owns the codecov account

@ramachandranms
Copy link
Contributor Author

@vinothchandar codecov lets us just upload reports without ownership. here is a screenshot of the admin page. it says that anyone with github permissions will be able to modify the codecov settings for that repo.

image

@vinothchandar
Copy link
Member

@ramachandranms guess that coz its free for OSS? I am good with that part

@vinothchandar
Copy link
Member

@ramachandranms could you rebase again and push.. for some reason, its showing 72 files being changed

@ramachandranms
Copy link
Contributor Author

@vinothchandar will do. also the recent change was not showing coverage for hudi-hive module. will ping you once I get this back to working state.

@ramachandranms
Copy link
Contributor Author

@vinothchandar cleaned up the PR and everything looks good in my own fork build + codecov. please let me know if there are any other concerns. thanks

Copy link
Member

@vinothchandar vinothchandar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vinothchandar vinothchandar merged commit acf359c into apache:master Feb 27, 2020
@ramachandranms ramachandranms deleted the coverage branch February 27, 2020 21:55
lyogev pushed a commit to YotpoLtd/incubator-hudi that referenced this pull request Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants