Skip to content

Use cache in GitHub Actions#2146

Merged
Godin merged 2 commits into
jacoco:masterfrom
Godin:github-actions-cache
Jun 10, 2026
Merged

Use cache in GitHub Actions#2146
Godin merged 2 commits into
jacoco:masterfrom
Godin:github-actions-cache

Conversation

@Godin

@Godin Godin commented Jun 1, 2026

Copy link
Copy Markdown
Member

Execution of

mvn verify -Dmaven.repo.local=$PWD/maven-local
du -hs maven-local

provides rough estimation (due to some differences between builds - eg with/without ECJ)
that execution of each build downloads about 300M from Maven Central,
each GitHub Actions CI run contains 27 builds, so about 8G in total.

Better to cache this in GitHub Actions for the following reasons even if size of matrix might be reduced:

To reduce downloads from Maven Central - see https://central.sonatype.org/faq/429-error/

To be less affected by incidents with access of Maven Central (amount of which might increase due to previous point) - one known to me is quite recent https://github.com/orgs/community/discussions/183607

Also on Linux single job takes on average about 4.3 min,
out of which about 30 sec (13%) is downloading dependencies,
while cache restoration takes just 3-5 sec.
Time benefits seem even bigger on Windows.

Total duration of all jobs in GitHub Actions prior to this change is about 11.5 min and after this change is about 8.6 min (about 25% faster).

Possible future improvements

  • single cache entry for both Windows and Linux
  • reduce downloads even further - even in presence of cache populated by dependency:go-offline there are still few downloads due to slight differences in configurations between builds (eg with/without ECJ) and dynamic dependencies (such as providers downloaded by maven-surefire-plugin, formatter downloaded by spotless-maven-plugin, and scala compiler)
  • at first glance saving of cache for PR builds seems unnecessary
  • time based (always/weekly/monthly) cache invalidation for default branch to prevent infinite growth - update of dependency causes restore of previous and save of updated, currently size is 250 MB for Linux and 120 MB for Windows

@Godin Godin self-assigned this Jun 1, 2026
@Godin Godin force-pushed the github-actions-cache branch from f1521c9 to 7777cf4 Compare June 1, 2026 22:19
@Godin Godin force-pushed the github-actions-cache branch 6 times, most recently from bd4488e to f3d1711 Compare June 8, 2026 21:15
@Godin Godin force-pushed the github-actions-cache branch from f3d1711 to 86de351 Compare June 8, 2026 21:18
@Godin Godin requested a review from marchof June 8, 2026 21:19
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
@Godin Godin added this to the 0.8.16 milestone Jun 10, 2026
@Godin Godin marked this pull request as ready for review June 10, 2026 09:00
marchof

This comment was marked as resolved.

@Godin Godin enabled auto-merge (squash) June 10, 2026 18:37
@Godin Godin merged commit 1a6f7c9 into jacoco:master Jun 10, 2026
31 checks passed
@Godin Godin deleted the github-actions-cache branch June 10, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants