Skip to content

Cache IntelliJ SDK in CI#125

Merged
halotukozak merged 2 commits into
masterfrom
cache-intellij-sdk
May 28, 2026
Merged

Cache IntelliJ SDK in CI#125
halotukozak merged 2 commits into
masterfrom
cache-intellij-sdk

Conversation

@ddworak

@ddworak ddworak commented May 27, 2026

Copy link
Copy Markdown
Member

Summary

The sbt-idea-plugin downloads the full IntelliJ SDK (~611MB IDE + ~221MB JBR) on build load, into ~/.intellij-hoconPluginIC. The default cache: sbt (coursier/ivy/sbt-boot) doesn't cover that directory, so every CI run re-downloaded ~800MB.

This adds an actions/cache@v4 step (first in the build job, before the scalafmt and build/test steps) so the SDK is restored once and reused.

  • Key: ${{ runner.os }}-intellij-sdk-${{ hashFiles('build.sbt') }}intellijBuild lives in build.sbt, so a version bump correctly invalidates the entry.
  • restore-keys: prefix fallback, so an unrelated build.sbt change still restores the same-version SDK fully (the plugin only tops up if needed).
  • Plays well with the existing autoRemoveOldCachedIntelliJSDK/autoRemoveOldCachedDownloads settings, which keep the cached dir lean (one SDK version, no leftover archives).

Wired via githubWorkflowBuildPreamble in build.sbt (CI is generated by sbt-github-actions); .github/workflows/ci.yml is regenerated, not hand-edited.

Why it's worth it

Version bumps on master are infrequent (~every 1-2 months), so most runs — code PRs, scala-steward dep bumps — hit a warm cache and skip the download. Version-bump PRs miss, which is unavoidable.

Test plan

  • sbt githubWorkflowGenerate + githubWorkflowCheck pass (workflow matches build config)
  • CI: first run populates the cache (miss); confirm subsequent runs report a cache hit and skip the SDK download

The sbt-idea-plugin downloads the full IntelliJ SDK (~800MB) on build
load, which the default sbt cache doesn't cover, so every CI run
re-downloaded it. Cache it via actions/cache keyed on build.sbt, so the
entry invalidates when intellijBuild bumps but is reused otherwise.
@ddworak ddworak requested a review from halotukozak May 27, 2026 16:57

@halotukozak halotukozak 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.

CI fails

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

Adds GitHub Actions caching for the IntelliJ SDK directory downloaded by sbt-idea-plugin, reducing repeated ~800MB downloads across CI runs by restoring the SDK cache before formatting/build steps.

Changes:

  • Add an actions/cache@v4 step via githubWorkflowBuildPreamble to cache ~/.intellij-hoconPluginIC.
  • Regenerate .github/workflows/ci.yml to include the new cache step in the build job.
  • Minor formatting change to the intellijPlugins setting.

Reviewed changes

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

File Description
build.sbt Adds workflow preamble step to cache the IntelliJ SDK directory before running sbt tasks.
.github/workflows/ci.yml Regenerated workflow including the IntelliJ SDK cache step.

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

@halotukozak halotukozak merged commit f3f8200 into master May 28, 2026
6 checks passed
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.

3 participants