Skip to content

OBPIH-6649 Add support for Jacoco code coverage reporting#4933

Merged
ewaterman merged 3 commits intodevelopfrom
ft/OBPIH-6649-jacoco-code-coverage
Nov 12, 2024
Merged

OBPIH-6649 Add support for Jacoco code coverage reporting#4933
ewaterman merged 3 commits intodevelopfrom
ft/OBPIH-6649-jacoco-code-coverage

Conversation

@ewaterman
Copy link
Member

@ewaterman ewaterman commented Nov 8, 2024

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-6649

Description: Generates a code coverage report using Jacoco whenever tests are run and then uploads them to Codecov when commits are pushed to PRs or when PRs are merged to develop.

Codecov dashboard: https://app.codecov.io/gh/openboxes/openboxes/

image

image

And this is what the raw HTML Jacoco reports that codecov is built from look like (we probably won't use these much except for local testing):
Screenshot from 2024-11-07 17-34-05

@ewaterman ewaterman self-assigned this Nov 8, 2024
@github-actions github-actions bot added type: feature A new piece of functionality for the app domain: devops Changes or discussions relating to dev ops automation flag: config change Hilights a pull request that contains a change to the app config labels Nov 8, 2024
@ewaterman ewaterman added the status: work in progress For issues or pull requests that are in progress but not yet completed label Nov 8, 2024
@codecov
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@c24eb29). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             develop   #4933   +/-   ##
=========================================
  Coverage           ?   7.57%           
  Complexity         ?     803           
=========================================
  Files              ?     596           
  Lines              ?   42170           
  Branches           ?   10258           
=========================================
  Hits               ?    3195           
  Misses             ?   38512           
  Partials           ?     463           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ewaterman
Copy link
Member Author

The Codecov report comment here should be more interesting once we merge to develop and it has something to compare to. I still need to configure exactly what the comment displays (I want to make sure it does a diff on changed files and doesn't show the whole coverage) but I'll leave that for the next PR.

@ewaterman ewaterman removed the status: work in progress For issues or pull requests that are in progress but not yet completed label Nov 8, 2024
Copy link
Collaborator

@awalkowiak awalkowiak left a comment

Choose a reason for hiding this comment

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

Overall, looks good to me. Can we get a list of all files that it looks into? Is it everything from the build/classes/groovy/main? Locally I see some changelogs there and taglibs. 5% coverage seems small? It kinda aligns with the ~5% that we had in the 0.8.x, but feels like we bumped up the coverage by at least a few percentage points recently? 🤔

@ewaterman
Copy link
Member Author

@awalkowiak yeah everything under build/classes/groovy/main is included. Jacoco calculates coverage slightly differently than Cobretura does (which is what we were using in Grails 1 but has since fallen out of support) so I'm not surprised the percentage is somewhat off. We could do some more filtering out if we want (such as excluding all *TagLib) but I think it's fine that the number isn't perfect. The main goal is to have coverage gradually going up.

@ewaterman
Copy link
Member Author

ewaterman commented Nov 12, 2024

Actually you were right! The filter condition I had on closures was causing all closures to appear as 0% covered. I removed it and we're at 7.5% now which feels more accurate.

image

Copy link
Member

@jmiranda jmiranda left a comment

Choose a reason for hiding this comment

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

I am speechless. 🫶

@ewaterman ewaterman merged commit 47cc0e5 into develop Nov 12, 2024
@ewaterman ewaterman deleted the ft/OBPIH-6649-jacoco-code-coverage branch November 12, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: devops Changes or discussions relating to dev ops automation flag: config change Hilights a pull request that contains a change to the app config type: feature A new piece of functionality for the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants