Skip to content

Share one TestKit directory among modules for TestKit coverage - #831

Merged
alexander-yevsyukov merged 1 commit into
masterfrom
claude/shared-testkit-home
Nov 3, 2026
Merged

alexander-yevsyukov merged 1 commit into
masterfrom
claude/shared-testkit-home

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

enableTestKitCoverage() now also passes io.spine.tools.gradle.testkit.coverage.home to the test JVM. The property names caches/spine-testkit under the Gradle user home, a TestKit directory shared by the worker builds of all modules.

Why:

  • Today the plugin-testlib harness gives each module build/testkit-home as the Gradle user home of its TestKit worker builds. On CI that directory is empty on every run, so the first worker build of each module downloads its dependencies and generates the Gradle API JARs again.
  • gradle/actions/setup-gradle saves and restores caches/ of the Gradle user home; our Windows logs show cache-includes: caches. A directory placed there is kept between runs, so a pull request run starts warm.

The plugin-testlib side, which reads the property and moves the JaCoCo agent from a gradle.properties in the TestKit directory to the command line, is SpineEventEngine/tool-base#207.

Compatibility: a plugin-testlib version that predates the property ignores it and keeps a per-module directory, so the two changes can land in either order.

Measurements

Tests of the four TestKit modules of tool-base, local, wall-clock:

TestKit home Time
Per module, empty (every CI run today) 37 s
Shared, empty (one-time) 53 s
Shared, warm 14–16 s

Kover line and branch totals of those modules are identical with shared and per-module homes. Without the TestKit data they drop sharply (gradle-plugin-api: 13/14 lines down to 7/14), so the match shows that the worker coverage is still merged.

Worth watching after merge

  • Cache size: the shared directory is about 234 MB for tool-base's worker builds. It goes into the main Gradle-home cache entry of each OS job. The repo currently uses 4.85 of 10 GB.
  • First cold run: modules that start their worker builds together wait on Gradle's cache locks while the Gradle API JARs are generated. Locally that cost the one-time 53 s above. Watch the first Windows run on master for a lock timeout.
  • No clean reset: the directory lives outside build/. Delete ~/.gradle/caches/spine-testkit to start from an empty one; the KDoc says so.

Test plan

  • ./gradlew :buildSrc:build detekt
  • In tool-base, with this buildSrc and the new plugin-testlib: tests pass, and Kover totals match per-module homes.
  • Reviews: gradle-review, kotlin-engineer, review-docs. All approved; their doc findings are applied.
  • After merge and a pull into tool-base: a Windows PR run restores the shared directory, and its test time drops.

🤖 Generated with Claude Code

`enableTestKitCoverage()` now also passes the
`io.spine.tools.gradle.testkit.coverage.home` system property, naming
`caches/spine-testkit` under the Gradle user home. A `plugin-testlib` that
reads it points the TestKit runners of all modules at that directory, which
`setup-gradle` keeps between CI runs, instead of an empty
`build/testkit-home` per module. An older `plugin-testlib` ignores it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 02:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T02:37:57.176069Z 1370e33 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approved

No active review issues are recorded for the change enabling shared TestKit caches across modules and CI runs.

No open issues 🎉

What changed in this PR

Updates enableTestKitCoverage() to let compatible plugin-testlib versions share a TestKit directory across modules, enabling reuse of worker-build caches locally and across CI runs.

Changes:

  • Passes io.spine.tools.gradle.testkit.coverage.home to test JVMs, pointing to caches/spine-testkit under the Gradle user home.
  • Documents compatibility with older harness versions, cache persistence, and manual cleanup.
File Description
buildSrc/​src/​main/​kotlin/​io/​spine/​gradle/​testing/​TestKitCoverage.kt Adds the shared-directory system property and documents its behavior.

Review effort: Balanced

@alexander-yevsyukov alexander-yevsyukov self-assigned this Nov 3, 2026
@alexander-yevsyukov alexander-yevsyukov moved this to In Review in v2.0 Nov 3, 2026
@alexander-yevsyukov
alexander-yevsyukov merged commit 4f80b39 into master Nov 3, 2026
3 checks passed
@alexander-yevsyukov
alexander-yevsyukov deleted the claude/shared-testkit-home branch November 3, 2026 15:43
@github-project-automation github-project-automation Bot moved this from In Review to ✅ Done in v2.0 Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants