Skip to content

Prune downloaded gems before saving the Bundler cache - #983

Open
businessdeveloper69 wants to merge 1 commit into
ruby:masterfrom
businessdeveloper69:fix/prune-bundler-cache
Open

businessdeveloper69 wants to merge 1 commit into
ruby:masterfrom
businessdeveloper69:fix/prune-bundler-cache

Conversation

@businessdeveloper69

Copy link
Copy Markdown

Fixes #645.

When bundler-cache saves a new archive, the installed gems and the downloaded .gem files can both be present in vendor/bundle. In a replay of Rack’s CI configuration, the downloads accounted for 3,262,976 bytes across ten files.

Use Bundler’s BUNDLE_PRUNE=cache setting for the install that precedes a cache save. An explicit environment, project or global setting takes precedence. Exact restores and merge-group jobs skip the settings probe. The added CI test exercises the packaged action with Bundler 4.1.

On Ruby head with Bundler 4.1.0, the compressed Rack cache fell from 11,342,609 to 8,138,092 bytes (28.25%). Upgrading an older cache removed only the ten downloads. All 1,254 other files matched by SHA-256. Rack’s 1,309 tests passed with two skips after a fresh restore. Bundler 2.7.2 on CRuby and 2.6.3 on JRuby installed and cached successfully. These checks used the packaged action, real tar/zstd archives and a local cache endpoint. The generated workflows, actionlint and an independent build of the distributed JavaScript also passed. The hosted multi-OS matrix remains to run.

AI assisted.

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.

Cleanup cache after bundle install

1 participant