-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
when using bundler-cache: true, no gem versions in log #105
Comments
Aha, wait, I think I get everything I want if I include a I think I get:
So if I understand things right everything is good... but I wonder if the README instructions should be changed to not discourage a manual |
I think a good solution is to run the |
It uses |
Thanks for looking into it! Yeah, I guess bundle check is so quick exactly because it doesn't actually go to rubygems to resolve dependency tree based on latest releases! Hm, it does sound like different logic might be needed if no Gemfile.lock is checked into repo. If Gemfile.lock is checked into repo, it won't be a problem. With logic as it is, I think it's okay to add a I guess if no Gemfile.lock is in repo... you still need to create cache-key out of the generated Gemfile.lock somehow? Not sure if that's too late to create the cache key, but if you could do that, it'd work? |
Note that GHA caches are removed after 7 days if they are not accessed:
Yeah, I thought about that too, it seems This is actually very important because it's not possible to replace or remove a cache on GitHub Actions. I'll try that approach. |
I have a fix for this on branch |
Oh, I see. I think this makes
The use case I am concerned about is not a project that seldom runs tests. Rather, we can imagine a gem project -- with no Gemfile.lock in repo. We can imagine that it has PRs and commits made to it fairly often, at least once a week, so the 7 day freshness is maintained. However, changes to the This is I think a common development pattern for gems. I am used to expecting that every time CI is run, it re-resolves the dependency tree, and possibly gets more recent versions of dependencies than in previous run. In this way you can find build failures caused by new releases of dependencies. In fact, sometimes I schedule a build once every 7 days even if no changes have been made, exactly for the purpose of catching failures caused by updated dependencies. This would likely keep the cache from ever expiring -- but would be just running the same biuld over and over again because of the cache, it would not be getting newly released dependency versions. So that's a problem.
I was not previously familiar with bundle lock but looking at docs and experimenting with it, I'm not completely following. Ah, in case of no Gemfile.lock present, run I think the alternate approach that would be more like travis bundle cache is to always use |
(It also occurs to me that some of this logic, including perhaps current implementation may require bundler 2, and not work with bundler 1? I'm not sure, if some features only work with bundler 2 that should be doc'd though. I do still have some projects using bundler 1). |
In short: yes I understood your concern, and indeed it was not intended that the cache would not use the latest gem versions when there is no Gemfile.lock. Everything should work with Bundler 1 and 2, of course. |
Thanks! I'm also now really confused how |
Nice! For anyone curious, looks like this is the commit: bc0f274 I'm still trying to figure out the right way to get the Gemfile/Gemfile.lock used to be the right one when I am testing different gemfiles in a matrix (say to test with different Rails versions). Looking at the source... looks like I have to get |
Yes, if you want to use a Gemfile not at the root, there are 2 ways:
|
Thanks! I'm using appraisal, so my gemfiles are in I've been having trouble with BUNDLE_GEMFILE, with setting it from the matrix while making sure it stays set not just for I thought I was so clever using the newer I wonder if it would make sense to have a |
Yes, you need It might also be possible to set it from matrix values in the job An extra input wouldn't be convenient because the variable needs to be set for |
What if it picked it up from |
(I wonder if just put the |
Doesn't seem realistic, we would need to guess where the config file is and parse it, which is a non-starter.
Feel free to make a PR to improve the docs. Having a Gemfile not at the root is rather the exception, so I would show that in this section: |
Oh, I thought you could just execute It's definitely the exception for an app which may be the majority of use. For any gem that interacts with Rails, I find it pretty common to test under multiple versions of Rails, which generally requires multiple Gemfiles. Thanks for info. I'll see about a README PR. I'm wondering if maybe in the 'matrix' section, since the main use case I am aware of for non-standard Gemfiles is that one, a matrix of gemfiles. |
Should I use working-directory input even when I have set working-directory to the defaults? Ex:
I'm not quite understand what's really going on behind them. |
@khiav223577 https://github.community/c/code-to-cloud/github-actions/41 would be a better place to ask such questions. |
bundler-cache: true
is a great feature!But when I'm using it, the job logs seem to lack the list of gems that were actually installed, even if expanded.
This is for a project that is a gem so does not have Gemfile.lock checked into repo.
When using similar functionality on travis (which I'm moving from), even when caching the bundle, you could still expand the logs to see actual bundler install output with individual gems, that might just have "Using" lines since theywere all installed something like:
I have found this can be invaluable for debugging a build, or comparing why one build might be behaving differently to another -- you can look at the logs to see exactly which versions of all dependencies are installed. It's not common for me to expand logs of the build at all, but when I do this is the most common thing I'm looking at.
However, with
setup-ruby
withbundler-cache: true
, it looks like:I can't see the actual list of gems installed. I'm not sure if this was intentional or a side effect of how you're doing things, don't totally understand what's going on.
But I find it a loss!
I suppose a workaround could maybe be uploading the produced Gemfile.lock as an artifact, since this could also be used to see exactly what version of all dependencies is installed.
Actually... as I think about how this bundle cache appears to be working... if it's actually skipping the entire
bundle install
and just using cached install if cache key matches... now I realize without checking Gemfile.lock into repo, does that mean I will not get new versions of dependencies that have become available on rubygems unless my Gemfile/gemspec itself changes? Oh no, that may mean this feature is unsuitable for me entirely.The text was updated successfully, but these errors were encountered: