Skip to content

Step 1 (PR-H): Add grails-jacoco convention plugin + Codecov coverage (depends on PR-G)#15687

Draft
jamesfredley wants to merge 6 commits into
feat/grails-code-analysis-pluginfrom
feat/grails-jacoco-plugin
Draft

Step 1 (PR-H): Add grails-jacoco convention plugin + Codecov coverage (depends on PR-G)#15687
jamesfredley wants to merge 6 commits into
feat/grails-code-analysis-pluginfrom
feat/grails-jacoco-plugin

Conversation

@jamesfredley
Copy link
Copy Markdown
Contributor

Step 1 (PR-H): grails-jacoco convention plugin + Codecov coverage

Carved out of the Hibernate 7 Step 1 PR (#15654) per review feedback from @matrei that JaCoCo should be introduced in its own focused PR for the project to review/decide on independently.

Depends on PR-G (#15686). This PR targets the feat/grails-code-analysis-plugin branch so the diff shows only the JaCoCo-specific changes. PR-G provides the build-logic test scaffold and plugin registration block this layers on. Once PR-G merges, this can be retargeted to 8.0.x.

What this adds

  • grails-jacoco convention plugin: configures JaCoCo per subproject, wires jacocoTestReport after each test, and registers a root jacocoAggregateReport task that produces a single XML report for Codecov - handling the hibernate5/hibernate7 duplicate-class case (identical class names across the two variants).
  • Applies grails-jacoco to the same 96 subprojects as grails-code-analysis.
  • coverage.yml workflow that runs jacocoAggregateReport across grails-core and grails-gradle and uploads to Codecov via the existing codecov.yml.

Notes

Assisted-by: claude-code:claude-4.7-opus

Adds a grails-jacoco convention plugin that configures JaCoCo per subproject
and registers a root jacocoAggregateReport task producing a single XML report
for Codecov, handling the hibernate5/hibernate7 duplicate-class case. Applies
grails-jacoco to 96 subprojects and adds the Coverage workflow that uploads to
the existing codecov.yml configuration.

Layers on top of PR-G (grails-code-analysis / grails-violation-aggregation),
which provides the build-logic test infrastructure and plugin registration
scaffold. Folds in the standalone coverage work from #15668.

Extracted from the Hibernate 7 staging branch (PR #15654) per review feedback
that JaCoCo should be introduced as its own focused PR for the project to
review independently.

Assisted-by: claude-code:claude-4.7-opus
Copilot AI review requested due to automatic review settings May 28, 2026 16:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a grails-jacoco Gradle convention plugin and corresponding GitHub Actions workflow to enable code coverage reporting and Codecov uploads. It's carved out from a larger Hibernate 7 work stream, depends on PR-G (grails-code-analysis), and is intended to be re-targeted at 8.0.x after that PR merges.

Changes:

  • New GrailsJacocoPlugin build-logic convention plugin (with TestKit specs) that configures per-project JaCoCo and lazily registers a root jacocoAggregateReport task, excluding hibernate7 source/class dirs to avoid duplicate-class errors while still aggregating their exec data.
  • Applies the new plugin alongside grails-code-style and grails-code-analysis in ~84 subproject build.gradle files (single-line plugin additions).
  • Adds .github/workflows/coverage.yml running jacocoAggregateReport for grails-core and the nested grails-gradle build across a 3-OS matrix, then uploads the artifacts to Codecov.

Reviewed changes

Copilot reviewed 100 out of 100 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
build-logic/plugins/build.gradle Registers the new grailsJacoco plugin id.
build-logic/plugins/src/main/groovy/.../GrailsJacocoPlugin.groovy New convention plugin: applies JaCoCo, wires jacocoTestReport, contributes to root jacocoAggregateReport.
build-logic/plugins/src/test/groovy/.../GrailsJacocoPluginSpec.groovy TestKit specs for per-project task registration, aggregate dependency wiring, and skip behavior.
.github/workflows/coverage.yml New CI workflow running coverage on a 3-OS matrix for both core and grails-gradle, uploading to Codecov.
~84 */build.gradle files Apply the grails-jacoco plugin alongside existing code-style/analysis plugins.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/coverage.yml Outdated
@bito-code-review
Copy link
Copy Markdown

The PR comments file appears to be empty (only the header row is present). I cannot analyze review discussions or suggestions without actual comment data.

jamesfredley added a commit that referenced this pull request May 28, 2026
)

Continues shrinking the PR-A review surface by reverting the portions of
this branch split into standalone PRs against 8.0.x, matching the
established B/C/D/E revert pattern. Once these land on 8.0.x and 8.0.x is
merged back into this branch, the reverted changes return through the
merge, so the final state of stage-hibernate7 is unchanged - only the
diff visible on PR-A is reduced.

Reverted content:

  grails-code-analysis convention plugin (PR #15686, PR-G)
    GrailsCodeAnalysisPlugin/Extension, GrailsViolationAggregationPlugin
    (+specs), the codeanalysis workflow, the pmd ruleset resource, the
    codenarcFix improvements and config relocation in GrailsCodeStylePlugin,
    spotbugs/pmd build deps, and the grails-code-analysis apply-line across
    all modules (incl. the h7 clones).

  grails-jacoco convention plugin (PR #15687, PR-H)
    GrailsJacocoPlugin (+spec), the coverage workflow, and the
    grails-jacoco apply-line across all modules (incl. the h7 clones).

NOT reverted (intentionally kept):
  - The codenarc violation fixes (f18465a) - reverting would
    re-introduce style violations; they are plugin-independent.
  - All hibernate7 BOM/clone content (the actual PR-A work).

Verified: ./gradlew help configures the root, grails-gradle, and
grails-forge builds; :build-logic-root:build-logic:test passes.

Assisted-by: claude-code:claude-4.7-opus
…co-plugin

Assisted-by: claude-code:claude-4.8-opus
The jacoco coverage.yml workflow used floating action tags (checkout@v6,
setup-java@v4, upload-artifact@v7.0.1, download-artifact@v7.0.0) and an
outdated setup-gradle pin, which the ASF org policy rejects, causing the
Coverage workflow to fail at startup. Pin every action to the ASF-approved
commit SHAs used elsewhere in the repo (checkout v6.0.2, setup-java v5.2.0,
setup-gradle v6.1.0 with cache-provider: basic, upload-artifact v7.0.1,
download-artifact v8.0.1).

Assisted-by: claude-code:claude-4.8-opus
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (feat/grails-code-analysis-plugin@57ae6d6). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@                          Coverage Diff                          @@
##             feat/grails-code-analysis-plugin     #15687   +/-   ##
=====================================================================
  Coverage                                    ?   49.0118%           
  Complexity                                  ?      16320           
=====================================================================
  Files                                       ?       1998           
  Lines                                       ?      93853           
  Branches                                    ?      16352           
=====================================================================
  Hits                                        ?      45999           
  Misses                                      ?      40624           
  Partials                                    ?       7230           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jamesfredley jamesfredley marked this pull request as draft May 29, 2026 15:17
@jamesfredley
Copy link
Copy Markdown
Contributor Author

Converted to draft. This PR is stacked on #15686 ( eat/grails-code-analysis-plugin) and inherits its code-analysis jobs. I merged the updated base in, so it now carries the PMD 7.25.0 fix and the report-only CI config. It shouldn't leave draft until the violation-scope decision on #15686 is resolved - see #15686 (comment) for the full breakdown (~5k PMD + 187 SpotBugs in Core alone).

@jamesfredley
Copy link
Copy Markdown
Contributor Author

Deferred for now, see #15686 (comment)

@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented May 29, 2026

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

Check Project/Task Test Runs
CI / Functional Tests (Java 21, indy=false) :grails-test-examples-scaffolding:integrationTest UserControllerSpec > User list

🏷️ Commit: 236d8a9
▶️ Tests: 29948 executed
⚪️ Checks: 36/36 completed

Test Failures

UserControllerSpec > User list (:grails-test-examples-scaffolding:integrationTest in CI / Functional Tests (Java 21, indy=false))
geb.waiting.WaitTimeoutException: condition did not pass in 10 seconds (failed with exception)
	at geb.waiting.Wait.waitFor(Wait.groovy:128)
	at geb.waiting.DefaultWaitingSupport.doWaitFor(DefaultWaitingSupport.groovy:55)
	at geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy:41)
	at geb.Page.waitFor(Page.groovy:120)
	at com.example.pages.LoginPage.login(LoginPage.groovy:39)
	at com.example.UserControllerSpec.setup(UserControllerSpec.groovy:33)
Caused by: Assertion failed: 

title != pageTitle
|     |  |
|     |  'Please sign in'
|     false
'Please sign in'

	at com.example.pages.LoginPage.login_closure1(LoginPage.groovy:39)
	at com.example.pages.LoginPage.login_closure1(LoginPage.groovy)
	at geb.waiting.Wait.waitFor(Wait.groovy:117)
	... 5 more

Muted Tests

Select tests to mute in this pull request:

  • UserControllerSpec > User list

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants