Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Bundler caching #52

Closed
eregon opened this issue May 1, 2020 · 17 comments
Closed

Automated Bundler caching #52

eregon opened this issue May 1, 2020 · 17 comments
Assignees

Comments

@eregon
Copy link
Member

eregon commented May 1, 2020

I'd like to add automated Bundler caching in this action, since caching manually like https://github.com/ruby/setup-ruby/blob/master/README.md#caching-bundle-install is quite verbose and hard to get right (e.g., sass/sassc-ruby#183 (comment)).

It would be optional, not sure about the default yet.

For that to work, we need actions/cache to be a package, so this needs actions/cache#55 first.

@eregon
Copy link
Member Author

eregon commented May 16, 2020

WIP PR: #56

https://github.com/actions/toolkit/tree/master/packages/cache

@eregon
Copy link
Member Author

eregon commented Jun 14, 2020

#56 is merged, currently it's opt-in:

    - uses: ruby/setup-ruby@v1
      with:
        bundler-cache: true

@eregon eregon self-assigned this Jun 14, 2020
dentarg added a commit to Starkast/wikimum that referenced this issue Jun 14, 2020
@DannyBen
Copy link

Is this already deployed and should work?

With this step:

    - name: Setup Ruby
      uses: actions/setup-ruby@v1
      with: 
        ruby-version: '${{ matrix.ruby }}'
        bundler-cache: true

I am getting an error:

##[warning]Unexpected input(s) 'bundler-cache', valid inputs are ['ruby-version', 'version']

@eregon
Copy link
Member Author

eregon commented Aug 16, 2020

@DannyBen yes it's implemented and released. It's ruby/setup-ruby, not actions/setup-ruby.

@DannyBen
Copy link

Oh... I thought it was the official actions/setup-ruby.

Got a little confused there - and I see just as I am typing, that an issue "Should we deprecate this action" was linked from actions/setup-ruby...

@eregon
Copy link
Member Author

eregon commented Aug 16, 2020

@DannyBen To clarify, I'm proposing to deprecate actions/setup-ruby.
This action, ruby/setup-ruby has many advantages as you can see on that issue.
It's not official as in "made by GitHub" but it's "hosted in the official Ruby organization", and ruby/setup-ruby is the Ruby starter workflow (can be seen when creating a new action with the UI).

@DannyBen
Copy link

DannyBen commented Aug 16, 2020

To clarify, I'm proposing to deprecate actions/setup-ruby.

Yes, I totally understand it, and although the ruby/* action is not the "official by GitHub", it is still "official by Ruby" - which is good (similar to AWS actions that are developed by Amazon team).

I expressed my opinion in that other ticket as well, thank you for clarifying.

... and the automatic cache is SUPER nice, makes the workflow file resemble the short and sweet travis YAML files. Thanks for this implementaiton.

@scottjacobsen
Copy link
Contributor

The github provided https://github.com/actions/cache had performance problems until the more recent releases. Does bundler caching use the newest version of that action? I searched the code a bit but I can't really tell.

@dentarg
Copy link

dentarg commented Aug 21, 2020

@scottjacobsen I think we can understand what versions are used from yarn.lock:

"@actions/cache@^0.2.1":

"@actions/tool-cache@^1.3.1":

From https://www.npmjs.com/package/@actions/cache, 1.0.2 is the latest, and from https://www.npmjs.com/package/@actions/tool-cache, 1.6.0 is the latest right now.

So it does not look like setup-ruby is using the latest versions. If that should be acted on, should perhaps be discussed in a new issue/PR?

(EDIT: @actions/tool-cache is not related to the sort of caching discussed here, my bad)

@scottjacobsen
Copy link
Contributor

scottjacobsen commented Aug 21, 2020

I'm not sure how the node package versions tie in with the versions on the cache action. I'll just point out the issue here that was resolved with version 2.1.0 of the cache action: actions/cache#267

I've been doing custom caching to S3, but would try to use the built in ruby-setup caching if it doesn't have the same slow caching problem that the cache action prior to 2.1.0 had.

This appears to be the PR that fixed the cache issue in the node package: actions/toolkit#497 I believe it went out in V1.0 of @actions/cache

@dentarg
Copy link

dentarg commented Aug 21, 2020

@scottjacobsen My understanding is that the @actions/cache npm package is the way for other actions to re-use the actions/cache action. See actions/cache#55 (and actions/cache#313) for background on that.

Looks like the action actions/cache v2.1.1 (https://github.com/actions/cache/blob/v2.1.1/package.json#L29) is using @actions/cache 1.0.2. (The code for the npm package lives at https://github.com/actions/toolkit/tree/main/packages/cache)

@scottjacobsen
Copy link
Contributor

scottjacobsen commented Aug 21, 2020 via email

@eregon
Copy link
Member Author

eregon commented Aug 22, 2020

https://github.com/actions/toolkit/blob/main/packages/cache/RELEASES.md
The cache actions uses @actions/cache 1.0.2: https://github.com/actions/cache/blob/5ca27f25cb3a0babe750cad7e4fddd3e55f29e9a/package.json#L29

But this action still uses 0.2.1, I see, let's fix that.

@eregon
Copy link
Member Author

eregon commented Aug 22, 2020

EDIT above: I thought we already used @actions/cache 1.0.2 in this action but not yet before your PR.

@ioquatix
Copy link
Member

ioquatix commented Sep 2, 2020

No Gemfile, skipping "bundle install" and caching

This action is not detecting gems.rb which is the newer equivalent of Gemfile.

@ioquatix
Copy link
Member

ioquatix commented Sep 2, 2020

Okay, I implemented it, and it's now in master.

@eregon
Copy link
Member Author

eregon commented Sep 3, 2020

Automated Bundler caching has been implemented for a while now and seems to work well:
https://github.com/ruby/setup-ruby#caching-bundle-install-automatically

It's opt-in currently. I might try to enable it by default at some point, if I do so I'll create a new issue about that.
Closing this one.

@eregon eregon closed this as completed Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants