Skip to content

Speed up CI via Gradle caching (setup-gradle + build cache)#685

Merged
alexander-yevsyukov merged 9 commits into
masterfrom
advance-gradle-caching
Jun 9, 2026
Merged

Speed up CI via Gradle caching (setup-gradle + build cache)#685
alexander-yevsyukov merged 9 commits into
masterfrom
advance-gradle-caching

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What & why

config is the shared submodule pulled into every Spine repository, so enabling Gradle's free
caching layers here speeds up CI org-wide with no per-repo edits. This PR turns on the
dependency cache and the local build cache via gradle/actions/setup-gradle, and modernizes the
workflow action pins.

Changes

Phase 1 — switch CI to gradle/actions/setup-gradle@v6
Removed actions/setup-java's cache: gradle (which conflicts with setup-gradle) and added
setup-gradle after Java setup in every Gradle-invoking workflow. setup-gradle persists the
Gradle User Home — dependencies, wrapper, and caches/build-cache-1 — across CI runs, writing
the cache only from the default branch (PR builds read it).

  • Propagated templates (.github-workflows/): build-on-ubuntu, build-on-windows, publish, increment-guard
  • config's own CI (.github/workflows/): detekt-code-analysis

Phase 2 — enable the local build cache (gradle.properties)
Set org.gradle.caching=true (was commented out). org.gradle.parallel=true was already enabled.

Action-version consistency
actions/checkout@v6 and actions/setup-java@v5 across all workflows — several still trailed on @v4.

Windows build speedup
Dropped --no-daemon from build-on-windows. It was a workaround for the old actions/cache
mechanism (actions/cache#454) that setup-gradle makes unnecessary; allowing the daemon should
noticeably cut Windows build time.

Also on this branch

  • ConfigTester / config-tester.gradle.kts + README.md: completed the core-javacore-jvm
    repo rename (symbol, comments, dependant list, and link URL).
  • .agents/tasks/gradle-caching-plan.md: the implementation plan and its verification rewrite.

Deferred by design

  • Configuration cache (Phase 3) — held until the pilot validates this PR; planned follow-up in
    warn mode (org.gradle.configuration-cache.problems=warn).
  • Remote build cache (Phase 4) — out of scope; requires infrastructure.

How to verify

setup-gradle only runs on GitHub, so the real signal comes from a pilot rollout in a consuming
repo (suggest base): bump the config submodule, run ./config/pull, then read the
build-on-ubuntu run's setup-gradle Job Summary for cache entries restored/saved and compare
overall job wall-clock before vs after. This PR's own CI (config's detekt and
gradle-wrapper-validation) is the first real exercise of the setup-gradle + checkout@v6 changes.

Reviewer notes

  • The Windows --no-daemon removal is the one behavioral change with residual risk: if cache
    save/restore collides with a running daemon on Windows, revert the flag. To be confirmed in the
    Windows pilot.

🤖 Generated with Claude Code

alexander-yevsyukov and others added 9 commits June 8, 2026 19:23
Replace `actions/setup-java`'s `cache: gradle` with the `setup-gradle` action, which persists the Gradle User Home (dependencies, wrapper, and the local build cache) across CI runs and writes the cache only from the default branch.

Applies to the propagated templates in `.github-workflows/` and to config's own detekt workflow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Set `org.gradle.caching=true` so Gradle reuses task outputs keyed by their inputs. Combined with `setup-gradle` persisting `caches/build-cache-1`, cold CI builds skip work whose inputs are unchanged. `org.gradle.parallel=true` was already enabled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move `actions/checkout` to `v6` and `actions/setup-java` to `v5` across all CI workflows so the action pins stay consistent. This accompanies the `setup-gradle` switch in the Gradle-invoking workflows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`gradle/actions/setup-gradle` manages the daemon and cache lifecycle, so the `--no-daemon` workaround for the old `actions/cache` mechanism (actions/cache#454) is no longer needed. Allowing the daemon should speed up the slow Windows builds. Revisit if the Windows pilot surfaces cache-locking issues.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Complete the `coreJava`->`coreJvm` rename: update the stale comment and the commented-out example in `config-tester.gradle.kts`, and the snippet, dependant list, and link URL in `README.md`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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.

Pull request overview

Enables Gradle’s caching layers centrally in the config submodule so that consuming Spine repositories can benefit from faster CI without per-repo workflow edits, while also updating related docs/config-tester references for the core-javacore-jvm rename.

Changes:

  • Switched Gradle-invoking workflows to gradle/actions/setup-gradle@v6 and removed actions/setup-java’s cache: gradle to avoid cache-provider conflicts.
  • Enabled the local Gradle build cache via org.gradle.caching=true in gradle.properties.
  • Updated workflow action pins (actions/checkout@v6, actions/setup-java@v5) and aligned ConfigTester docs/scripts to core-jvm.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
README.md Updates ConfigTester usage examples and repo link from core-java to core-jvm.
gradle.properties Enables Gradle local build cache (org.gradle.caching=true) with CI-oriented commentary.
buildSrc/src/main/kotlin/io/spine/gradle/ConfigTester.kt Renames SpineRepos.coreJava to SpineRepos.coreJvm and adjusts KDoc formatting.
buildSrc/src/main/kotlin/config-tester.gradle.kts Updates ConfigTester “dependants” list to use core-jvm.
.github/workflows/gradle-wrapper-validation.yml Updates checkout action pin to actions/checkout@v6.
.github/workflows/detekt-code-analysis.yml Migrates to setup-java@v5 + setup-gradle@v6, removing setup-java Gradle caching.
.github/workflows/check-links.yml Updates checkout action pin to actions/checkout@v6.
.github-workflows/remove-obsolete-artifacts-from-packages.yaml Updates checkout action pin to actions/checkout@v6.
.github-workflows/publish.yml Migrates to setup-java@v5 + setup-gradle@v6, removing setup-java Gradle caching.
.github-workflows/increment-guard.yml Migrates to setup-java@v5 + setup-gradle@v6, removing setup-java Gradle caching.
.github-workflows/ensure-reports-updated.yml Updates checkout action pin to actions/checkout@v6.
.github-workflows/build-on-windows.yml Migrates to setup-java@v5 + setup-gradle@v6 and removes --no-daemon from the Windows build invocation.
.github-workflows/build-on-ubuntu.yml Migrates to setup-java@v5 + setup-gradle@v6, removing setup-java Gradle caching.
.agents/tasks/gradle-caching-plan.md Updates the rollout/verification plan text to match the new pilot-based validation approach and tooling rename.

@alexander-yevsyukov alexander-yevsyukov merged commit 93dcf21 into master Jun 9, 2026
4 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the advance-gradle-caching branch June 9, 2026 09:16
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in v2.0 Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants