-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
Allow use in other actions #33
Conversation
via downloading and then require https://raw.githubusercontent.com/ruby/setup-ruby/v1/dist/index.js
What other action would need to use like this and not simply as a separate step? |
setup-ruby-pkgs Maybe code to create pre-compiled binaries, where (ideally) one job needs several Ruby installs? |
Could you describe a bit how you would use it and what it would enable for Just finding the Ruby prefix should be easy by shelling out to |
First of all, I hate repetitive or unneeded things. Extra complexity is bad. And, yes, I don't always write code that way, although I try... So, my thought was if you just need plain Ruby, one uses Obviously, As to how I'd use it, I've already done so with my |
Agreed. But I think the repetition is very reasonable here.
I don't think So if I understand it's to allow this: - uses: MSP-Greg/setup-ruby-pkgs@v1
with:
ruby-version: 2.6
apt:
brew:
mingw:
msys2: instead of - uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- uses: MSP-Greg/setup-ruby-pkgs@v1
with:
apt:
brew:
mingw:
msys2: I don't think that's much repetition, and that hides which action does the setup for Ruby (I definitely don't wish for a third setup-ruby action, and so I think it should be clear which So at this time I'm not convinced of the value of this. |
Another way to see it is it's basically "composition" by using 2 separate steps vs "inheritance" and mixing everything together, almost guaranteeing there will be some naming conflict or input/output/behavior mismatch if e.g. an input/output is added here. |
Sorry. I guess you like it or you don't. IMHO, trying to compare a yaml API to other API's/structures is a stretch.
Clear to me. Prior knowledge? Or, doesn't hide anything unless you're looking for 'setup-ruby'...
'almost guaranteeing'? Doubt it. These aren't complicated. |
I meant all
Of course, but not so clear to others whether it's actions/setup-ruby, ruby/setup-ruby, or something else. I don't see the need for this, can you do without? If there is a lot of feedback that users want that then let's reconsider. |
Unlikely. For things like this, users take what you give them, they don't ask for API topology changes. After all, no one asked for this action ( In general, the top level task is performing CI, and configuring the system is one of the early tasks. Allowing a package install action to also install Ruby just eliminates an extra workflow step. If one wants to properly handle windows build tools, one still has to spin up the Ruby instance. So, the package action doesn't benefit from importing setup-ruby. |
As said earlier, that can be easily solved by setting an env var from this action e.g. RUBY_PREFIX and/or e.g. RUBY_NAME (the validated string given as the ruby-version input). |
Re Windows, at present, most repos have been using the most recent patch/teeny releases of Rubies. Those releases were all compiled with the most recent MSYS2 gcc release. As one moves to older ones, there may be gcc issues. Rather than embed the data for that in the action, I'd rather query the Ruby version in use, and decide what to do based on the gcc info embedded in RbConfig. Same may also be easiest for OpenSSL. I think... Re spinning up Ruby in general, when that was included in the PR, the MRI builds did not seem to take appreciably longer for the action run step, so I'm not to concerned about the time. Finally, I added code to download dist/index, and the required it. It runs fine, so export really isn't needed. |
Trying to format for the UI here, the code to use 'setup-ruby' is essentially:
|
I agree that not enabling this does not prevent it. If action authors want to spare their users the extra step(s), they will. So why not give them a properly versioned (and potentially cached?) NPM package to work with? |
@reitzig The I have no plans to maintain an extra npm package, this is an action and only makes sense in the context of running in GitHub Actions. And it doesn't seem needed for other actions to use it. |
👍
A long time ago, I thought an 'actions' recommendation was to have a Interesting question. You have options as to how you handle action inputs. You can add all of the inputs for this action to your own, as I've done in set-ruby-pkgs, or you can hard code values in your js code. If you look at actions/core code, I believe the runner code uses the input name, parses it, and that string is used to set an ENV variable with the input's value. Note that if an input is added to setup-ruby, your action will need to handle that. The runner code handles the default values from action.yml. It probably would have been better if a pattern was suggested where the action js code handled the defaults (which would require reading the yml file). |
To clarify, if an npm package would help I might consider it, but I'd like to hear why it's better and how can it be automated so it's no extra effort compared to currently (just creating a release in GitHub UI, v1 is bumped automatically). Regarding inputs, I could probably move the defaults inside the I think right now it's best if actions reusing this action transparently pass all possible inputs, so the end user can configure as needed. |
I don't know how the JS ecosphere usually works, but I would expect
Only if you never change that tag. I'm new to writing Github Actions, but I get the impression that people use Git tags more like Docker tags here, that is re-set
I won't be of much help here myself (see above), but I imagine that once there's agreement on what to package/publish, doing so as part of CI/CD is the least worry. Pushing it to the GitHub Packages registry of this repo would be the natural choice, I think, which would also avoid the impression of a "general purpose" library.
That's fair, I think. Make all parameters mandatory, implicitly. A separate entry function that takes some form of parameter object (I'd say "data class", but Javascript...) as opposed to calling
As long as the calling action doesn't update their dependency, they don't have to change anything. I acknowledge that this request does add the perspective of "library maintainer" to a project that, on first glance, doesn't need that. I would argue it's worth it for the ecosystem at large, though. Seems the Python folks have a similar discussion going on, with a workaround that involves use of NPM at the consumer action: actions/setup-python#38 |
Already handled as it's a self-contained .js script with https://raw.githubusercontent.com/ruby/setup-ruby/v1/dist/index.js
This will automatically work with the link. With a npm package, you would always have to update manually which seems cumbersome. If an update is missed, then your action might expose bugs that are already fixed upstream, which seems very suboptimal.
Yeah, I think that's simple enough, I'll do that.
I don't know much about the process for that, and given I have rather little time for this action, I'd rather focus on the core action and what's strictly needed to use it in other actions. |
I added a |
via downloading and then require
https://raw.githubusercontent.com/ruby/setup-ruby/v1/dist/index.js