Skip to content

Cache sbt 2 build output in the coverage job - #21

Open
stasimus wants to merge 4 commits into
mainfrom
coverage-cache
Open

stasimus wants to merge 4 commits into
mainfrom
coverage-cache

Conversation

@stasimus

Copy link
Copy Markdown
Contributor

The coverage job rebuilt everything every run. cleanFull wiped sbt's action cache, and the cache alone isn't enough: it restores classes but not scoverage's scoverage-data, so a hit crashed the tests. ~/.cache/sbt and target/out now share one entry, stale measurements get dropped, cleanFull is off.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e19a59b5-5423-4a88-b90c-cc08eba3be92


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stasimus

stasimus commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Why this is worth doing: test-coverage was the one job guaranteed to do a cold, full, instrumented build on every run. disk-cache: false meant nothing was restored, and cleanFull cleared sbt's action cache anyway, so even a restored cache would have been thrown away before the first compile.

sbt elapsed recompiled
cold, no cache 13 s 45 + 33 + 6 sources
rerun, nothing changed 2 s none
one source file changed 5 s 1 source

@mr-git mr-git 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.

I read the description and comment, but I do not understand what this fixes

Comment thread .github/workflows/ci.yml Outdated
@stasimus

stasimus commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Not a bugfix. The intention is to include the coverage phase into the cache, so builds get faster.

@mr-git

mr-git commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

..include the coverage phase into the cache..

Is it wise? If SBT will recover cache for Release build, could it pack instrumented artifacts instead of freshly built ones?

@mr-git

mr-git commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Honestly, I do not understand why would we want to restore the coverage reports from previous run?

@stasimus

Copy link
Copy Markdown
Contributor Author

We don't, they just come along inside target/out and the "drop stale coverage data" step deletes them before the build. What we want back is the compiled classes plus scoverage.coverage, the instrumentation metadata the report is generated from.

@stasimus

Copy link
Copy Markdown
Contributor Author

because of coverage is kinda separate build step - caching ~/.cache/sbt and target/out (for zinc) saves a build time.

@mr-git

mr-git commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

@stasimus, have you tested this on any repo? probably we need an internal testing repo to clear my fear of releasing instrumented binaries.

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.

2 participants