-
Notifications
You must be signed in to change notification settings - Fork 69
Downloading pre-built Ruby Versions at runtime #44
Comments
Ping @ioquatix @eregon @tenderlove Sorry for the ping... |
A Ruby build zip is +/- 10 MB. One thought is to have the Ruby community build Rubies and host them as packages in some repo, then provide an action that downloads and installs them... |
I was thinking something along the same line. |
cc @clupprich this might interest you too (as the author of https://github.com/clupprich/ruby-build-action). |
Yes, avoiding having consumers build it every time would be great. Hosted machines are a fresh VM every job. Building ruby, making it globally available and then having the setup-ruby pull the binaries just in time would offer the ability to pin to any version flexibly. Things to note:
That would mean you have to create, manage a CDN. That is unless you can lean on another packaging service like GPR etc. for a universal type package of bits. One other option would be to use releases in the ruby repo and attach binaries (see actions/runner where we do that with most recent release). The binary packages in a release are backed by CDN. Hopefully, all that makes sense. Let me know how I can help. |
Thanks for the response. I've assumed that binaries/builds would be stored in a repo's releases. I've maintained a Ruby master MinGW for a few years for CI use. I've had it running as a cron job, three times a day. One question about using GH repo releases for storage. The current actions/upload-release-asset isn't really clear about how to update an item to an existing release. Will there be issues with a repo's Actions job trying to download the binary when the cron job is updating the release build binary? Maybe I should ask the question there... |
I made a quick prototype (just a proof of concept at this point) to build Ruby versions for each GitHub virtual environment: https://github.com/eregon/ruby-install-builder/releases/tag/builds Then I think downloading that and unpacking that for the same virtual environment should just work. One potential issue is virtual environments/images do change over time, so that might break things if e.g., a new libssl version is used. It's really easy for Linux and macOS, but probably quite a bit different for Windows, where I think we should likely use MSP-Greg's Windows Ruby builds. |
I worked a bit more on this idea, and https://github.com/eregon/use-ruby-action now works with MRI, JRuby and TruffleRuby, with exact versions, on Ubuntu and macOS. Would an approach like that make sense for actions/setup-ruby? |
@eregon - thanks, I'll have a look today. |
I reviewed The only thing I'd suggest is perhaps supporting more Ruby versions (trivial) and perhaps having a suggested template for users to follow, not sure if this exists or not. Ideally, the default template should be super simple - I wish users don't need to specify Ruby versions, but instead could write something like: all supported releases which right now would be MRI 2.4 - 2.7, JRuby and TruffleRuby, rather than mucking around with environments. Because most gems should just use this by default. |
Sorry, my bad,I just saw https://github.com/eregon/use-ruby-action#usage which shows the usage - so my only point is perhaps just some way to make it easier for users to have a default build matrix which includes all current released versions of Ruby across all latest supported OS distributions. |
The matrix needs to list all combinations explicitly for the workflow to understand it AFAIK, so I think it can't really be much better than: matrix:
os: [ 'ubuntu-16.04', 'ubuntu-18.04', 'macos-latest' ]
ruby: [ 'ruby-2.4.9', 'ruby-2.5.7', 'ruby-2.6.5', 'ruby-2.7.0', 'truffleruby-19.3.0', 'jruby-9.2.9.0' ]
# This also works and is a fair bit shorter:
ruby: [ '2.4.9', '2.5.7', '2.6.5', '2.7.0', 'truffleruby', 'jruby' ] We could accept |
What about adding -head variants? |
What follows is just my quick opinion. In practice it's probably not too hard since I think |
JFYI, re ruby master, ruby-loco is set up that only the most recent passing build is used when downloading. All test suites are run from the install folder, and I also check that bin files are working correctly, or at least reporting a version (rake, gem, bundler, etc). Granted, API changes are a different matter... |
@MSP-Greg Indeed, if we want to support MRI head, we'd need something like that on all platforms. I think in TravisCI they had a hook triggering only if ruby's own CI passed, we could have something like that. |
ruby-loco is currently built on AppVeyor, but I expect to move it to Actions. I started with the ruby/ruby MinGW build and it's passing. Note that it's running spec tests from the install folder. Working on mswin now. Can't get test-all to pass. Once I get ruby-loco moved, I'll try using similar code for Ubuntu & MacOS. Might have some questions though... |
Assuming you're not often coding in Ruby, maybe you can direct me in the correct direction. Ubuntu and macOS have compile tools as part of the OS. Ruby on Windows is built with gcc, and uses the MSYS2 system. Also, any Ruby extension gems (gems that have c or c++ code) require the MSYS2 system for compiling on CI. Currently, the Windows images have three copies of MSYS2, all of which are embedded in the installed Ruby versions. And, yes, three versions is a waste. Anyway, the question is whether GitHub will reconsider this decision and add an independent MSYS2 install in future image updates. AppVeyor has an extensive set of installed MSYS2 packages (see https://ci.appveyor.com/project/MSP-Greg/appveyor-ruby). I'm not looking for all of that, but the base system and gcc would certainly be a good start. For other disucssions, see: Anyway, MSYS2 is also used by langauges/applications other than Ruby. So, where do we inquire about this? |
For questions / issues on what's on the VM images (msys2 etc.), you're best to drive issues here: https://github.com/actions/virtual-environments There's multiple issues covering the what versions of ruby are available so I think the discussion should probably be centralized there for ruby versions: https://github.com/actions/virtual-environments/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+ruby |
Ok, the below is a response to something you've remove from the above post, but it may be helpful for some...
First of all, Standard Windows Rubies (SWR's) are stand-alone, they do not need MSYS2 to run the code that they contain. All required non-Windows dlls are packaged in bin/ruby_builtin_dlls. SWR's have OS specific code to locate the MSYS2 install, and they will find it if it's installed at C:\msys64. I can explain more, but I've worked with a lot of repos/gems on Windows, with multiple Ruby versions, and I only have one MSYS2 install. The one issue is that if one is compiling extension gems, one needs to be aware of library package versions. This issue is common to all OS's, an example would be OpenSSL. Older versions of Ruby use OpenSSL 1.0.2 (or earlier), newer versions use 1.1.1. If one is compiling an extension gem using OpenSSL (common with socket/web server gems), one should use the same version of OpenSSL that the host language version (Ruby) uses. Lastly, AppVeyor has used an stand-alone MSYS2 install for a long time, and everyone seems able to work with it... |
Thanks. Yeah, I removed because I realized it wasn't a runtime thing. If the user / workflow is also compiling extension gems then they are bringing the need for msys2 so for self-hosted where they bring their own machine it would be on them to install it like any other software on a self hosted machine. Regarding the hosted images, yes, I believe it makes sense for those to have a stand alone install since it's a clean machine every time and you wouldn't want to have to pull that JIT. And for that, the virtual-environments repo is the best place to drive that. Hope that makes sense ... |
Thank you. I've worked with MSYS2 for a while, and there is no way to install it from scratch without taking quite a while, at least in terms of CI time frames. Ruby is one thing, as they're between 10 & 30 MB compressed, MSYS2 is an order or two in magnitude larger. EDIT: See actions/runner-images#229 |
@bryanmacfarlane wrote:
Did you have a chance to take a look at https://github.com/eregon/use-ruby-action? I think one of the major advantages is it can make new releases of Ruby available within hours. How do you see the future of this action? Using only the toolcache, or prebuilt rubies like I think in the short time it would be nice to merge #27. And then I think we should add a section in the README about alternatives and the status of this action. |
I ran a quick 'info' workflow (see the Ruby Info step) from https://github.com/eregon/use-ruby-action, and speed is quick enough to not generate complaints. See: https://github.com/MSP-Greg/use-ruby-action-info/runs/374992625 |
Thanks. In general, getting tools JIT (as well as caching) is a good direction for this action to move. I think this is a product question beyond just this action since our current approach is tool cache on the virtual environments and we're working with that team as well. Adding @chrispat and @ethomson for product feedback. FYI @alepauly from VMs. My thoughts:
|
I have no fundamental issue with having the setup tasks handle more environment configuration which can include downloading a runtime. One of the issues we have seen in the past with Ruby and Python is making sure things work consistently across Windows, MacOS and Linux with respect to the abiliy to download the runtime on demand. Becuase of this we have chosen to cache Ruby and Python only and not offer the download model. However, if there is a way to maintain the action in such a way that it can download Ruby on the fly for Windows, MacOS and Linux I am happy to discuss taking that PR. As far as caching is concerned, we do have plans to break the cache module out as part of the toolkit so it can be used by other actions to add that feature automatically. |
Thank you. Can't speak for the others, but I'm very happy with what you've said. Throughout the beta until now, discussions have sometimes gotten messy, as many actions are so tightly bound to the images that there wasn't one place to discuss changes. Moving to an 'install on demand' model works for Ruby, as the binaries/builds are small enough to not hinder 'quick' CI. I hate to ask, but what about MSYS2? It's needed to build Windows Ruby itself, and it's needed to build Windows extension gems. At present, users and some custom actions link to one of the embedded installs, but that's rather brittle. As mentioned, a current 'base', 'base-devel', and gcc would allow people to avoid the time it takes for a fresh install, and updating with specific packages doesn't take too long. Ruby builds generally use the current packages/tools. |
If this were a perfect world, what would you want us to do here? msys2 preinstalled on the Windows runners in a predictable place? My fuzzy recollection -- and it's been a long time since I've wrangled with native extensions on Windows -- is that there's a particular msys2 version that we should be using? Is that right, or could we just get away with always installing the latest version of msys2? If not, does every Ruby version use a different msys2 version? |
Stock. Lots of it. Sorry. As to location, C:\msys64 would be the preferred location. Windows Ruby builds 2.4 and later have OS specific code to search for it there.
Depends on how log ago. Ruby 2.3 and earlier used a custom package of MSYS. Ruby 2.4 and later are using standard MSYS2. A big difference.
I've got a custom action that updates all the MSYS2 gcc tools, and everything is building & testing fine. So, preference would be the current MSYS2 with base, base-devel, and mingw-w64-x86_64-gcc installed, then As to anything beyond that, libyaml, zlib, openssl, ragel, etc. But, anything much more than a base install might encourage a lot of requests for package X, Y or Z. A list of what packages AppVeyor has installed is here: I'm going to stay away from whether 32 bit should be installed. I rarely use it or test on it, but there are some people using 32 bit Ruby with old legacy apps/dlls/ActiveX/OLE things on Windows. ping @larskanis |
@ethomson wrote:
That's great to hear. Would this repo both builds Rubies and sets them up then? https://github.com/eregon/ruby-install-builder/releases now has all Ruby 2.3.0-2.7.0 releases, it was fairly easy to add them incrementally to a single GitHub release. |
It would complicate things, but we could leave |
@MSP-Greg I think that would cause confusion. My comment was about building Rubies and using them is a fairly different thing, which is why I split it in two repositories for my account. But it doesn't matter, we can use the same repository and two different branches or so. |
It would be awesome if I could also point it at a specific ruby version, e.g |
That's a different feature (and it would be hard to make it efficient). The pre-built Rubies mentioned here are only for official releases. If you really want this, I think that repo should build its own releases and then maybe we could have a way to specify a release URL to download some Ruby from. |
I created #48 with the details about how to get started building Rubies in this repository (since I guess not everyone here wants all the details). |
* Many Ruby users will want something like that as the issues on this repository make very clear. * Once actions#44 is addressed we can remove this.
Re MSYS2, see actions/runner-images#30. I posted a sample script for installation of MSYS2. Installs it, updates it, installs a few compile tools, both 64 & 32. Installs to what I believe is considered the normal location, It doesn't have all the packages needed to build Ruby, but it has all the compile tools. I can certainly add more packages, I'm not sure what opinion is on that. Having a more complete version in one location would be much better than the current out-of-date versions in four locations. Off-topic, but Ruby compiles fine with VS2019. Obviously there's issues with things like fork, signals, UNIXSockets, some thread issues, etc. A few years ago, ruby/ruby ran almost no tests on Windows builds. Now, MinGW & mswin (msvc) are fully tested. Thanks, Greg |
* Many Ruby users will want something like that as the issues on this repository make very clear. * Once actions#44 is addressed we can remove this.
* Many Ruby users will want something like that as the issues on this repository make very clear. * Once actions#44 is addressed we can remove this.
I updated the ADR with another option that would work across self hosted and other platforms and only cost more on first cache miss. It also aligns with the only officially supported distribution mechanism |
FYI, eregon/use-ruby-action has moved to ruby/setup-ruby. |
@eregon - Awesome. I'll follow up soon |
I'm ok to close... |
@bryanmacfarlane
With #42 closed, I thought I'd continue here.
If one views this repo's purpose as accessing pre-built Rubies located in 'hostedtoolcache', then it is functioning as expected.
For quite a while, issues have been posted that imply that what's contained in 'hostedtoolcache' is not meeting users needs.
Given that, and given that GitHub employs several people active in the Ruby community, are there any plans for changing the current setup?
The Ruby community can certainly come up with solutions, but some at point, we/they will have some needs from Actions to make it function reasonably well. An example would be MSYS2 for Windows extension gem CI, and also building Ruby itself. Installing MSYS2 from scratch is time consuming.
If this isn't the palace to discuss this, please suggest where...
The text was updated successfully, but these errors were encountered: