Skip to content

Improve bundler caching in CI #2224

@alexeyr-ci2

Description

@alexeyr-ci2

Currently our CI caches gems manually, but https://github.com/ruby/setup-ruby/?tab=readme-ov-file#caching-bundle-install-manually says

It is also possible to cache gems manually, but this is not recommended because it is verbose and very difficult to do correctly. There are many concerns which means using actions/cache is never enough for caching gems (e.g., incomplete cache key, cleaning old gems when restoring from another key, correctly hashing the lockfile if not checked in, OS versions, ABI compatibility for ruby-head, etc). So, please use bundler-cache: true instead and report any issue.

The issue is that we have multiple Gemfiles (5 currently: root, react_on_rails, react_on_rails_pro, react_on_rails/spec/dummy, react_on_rails_pro/spec/dummy), but the recommended solution is ruby/setup-ruby#170 (comment):

Multiple uses: ruby/setup-ruby should work for that purpose, it's already used by some people.

An alternative is to make a single reusable action which can be passed the path to Gemfile.lock and takes care of caching internally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions