Skip to content
This repository was archived by the owner on Feb 9, 2021. It is now read-only.
This repository was archived by the owner on Feb 9, 2021. It is now read-only.

Downloading pre-built Ruby Versions at runtime #44

Description

@MSP-Greg

@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...

Activity

  1. MSP-Greg commented on Dec 30, 2019

    @MSP-Greg
    ContributorAuthor

    Ping @ioquatix @eregon @tenderlove

    Sorry for the ping...

  2. MSP-Greg commented on Dec 30, 2019

    @MSP-Greg
    ContributorAuthor

    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...

  3. eregon commented on Dec 30, 2019

    @eregon
    Contributor

    I was thinking something along the same line.
    We could have a separate GitHub action that just builds various Ruby versions for all virtual environments available in GitHub Action, for instance using ruby-build or ruby-install.
    Then this action could just download the result from that action's repository release downloads.

  4. eregon commented on Dec 31, 2019

    @eregon
    Contributor

    cc @clupprich this might interest you too (as the author of https://github.com/clupprich/ruby-build-action).
    I think a more convenient caching/building mechanism would be quite nice for actions, instead of a cache per repository.

  5. bryanmacfarlane commented on Dec 31, 2019

    @bryanmacfarlane
    Contributor

    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:

    • The actions/virtual-environments images effectively do this not as flexibly. I believe they only lay down a couple versions into the cache which is why I believe the defaults push a major version binding. They do it at factory disk creation (not users build time) which is an advantage but it can't possibly lay down all versions.
    • If you build and publish ruby binaries to a globally available location it would be nice to have a json file with all the metadata so the action can do semver and match versions. Nodejs does this and the setup-node action uses it.
    • self-hosted runners will benefit from job to job if downloaded into the tool cache by tool, version, platform
    • The recommended pattern in the tool actions is to match the semver supplied against the cache dir first and then against the cloud. This adds resiliency for availability / load. e.g. nodejs was having download issues and it affected all workflows since the factory disk tool cache didn't have enough versions (12 was published).
    • If you have a globally available set of bits, a CDN would be best. Nodejs didn't have a CDN as of the time 12 was released and the load caused issues.

    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.

  6. MSP-Greg commented on Dec 31, 2019

    @MSP-Greg
    ContributorAuthor

    @bryanmacfarlane

    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...

  7. eregon commented on Dec 31, 2019

    @eregon
    Contributor

    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.

  8. eregon commented on Jan 1, 2020

    @eregon
    Contributor

    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.
    It just downloads and extracts an archive, so it's just a couple seconds to set it up.

    Would an approach like that make sense for actions/setup-ruby?

  9. bryanmacfarlane commented on Jan 2, 2020

    @bryanmacfarlane
    Contributor

    @eregon - thanks, I'll have a look today.

  10. ioquatix commented on Jan 2, 2020

    @ioquatix

    I reviewed use-ruby-action and ruby-install-builder and I think we could adopt them. They seem well put together, have good separation of concerns, and should be reliable and "scalable" (i.e. support different versions of Ruby) into the future.

    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.

  11. ioquatix commented on Jan 2, 2020

    @ioquatix

    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.

  12. eregon commented on Jan 2, 2020

    @eregon
    Contributor

    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:
    https://github.com/eregon/ruby-install-builder/blob/f967c81fdf7097dc33fbf6ac5adeab551ae9edaa/.github/workflows/build.yml#L32-L34
    Copying here for convenience:

          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 ruby-2.4 and ruby-2.4.x (setup-ruby supports this) of course.

  13. ioquatix commented on Jan 2, 2020

    @ioquatix

    What about adding -head variants?

  14. eregon commented on Jan 2, 2020

    @eregon
    Contributor

    What follows is just my quick opinion.
    First, I think testing against MRI master is of little value, it regularly breaks and there is no CI before pushing. Also, features and changes on master are often reverted/tweaked/fixed, so it would cause a lot of failures for CI of gems.
    I think JRuby doesn't really recommend testing against master, the CI is not always green either.
    For TruffleRuby I think it could be useful because all tests must pass before merging to master, but we would first need nightly builds of TruffleRuby (truffleruby/truffleruby#1483, building TruffleRuby entirely from source is more challenging than downloading an existing release and just recompiling the openssl extension).

    In practice it's probably not too hard since I think ruby-install supports building ruby-head. Not sure about jruby-head, there is https://www.jruby.org/nightly but that doesn't give a single link.

  15. MSP-Greg commented on Jan 2, 2020

    @MSP-Greg
    ContributorAuthor

    @eregon

    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...

  16. 36 remaining items

  17. MSP-Greg commented on Jan 10, 2020

    @MSP-Greg
    ContributorAuthor

    It would complicate things, but we could leave actions/setup-ruby to specifically use only versions in the toolcache, and make eregon/ruby-install-builder something like actions/install-ruby. Just a thought, no strong opinion...

  18. eregon commented on Jan 10, 2020

    @eregon
    Contributor

    @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.

  19. ioquatix commented on Jan 11, 2020

    @ioquatix

    It would be awesome if I could also point it at a specific ruby version, e.g git@github.com:ioquatix/ruby#thread-selector. Is that going to be possible?

  20. eregon commented on Jan 11, 2020

    @eregon
    Contributor

    It would be awesome if I could also point it at a specific ruby version, e.g git@github.com:ioquatix/ruby#thread-selector. Is that going to be possible?

    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.
    Just like I think a builder for -head versions doesn't belong here.

    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.

  21. eregon commented on Jan 11, 2020

    @eregon
    Contributor

    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).

  22. bryanmacfarlane commented on Jan 13, 2020

    @bryanmacfarlane
    Contributor
  23. MSP-Greg commented on Jan 18, 2020

    @MSP-Greg
    ContributorAuthor

    @ethomson

    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, C:/msys64.

    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

  24. bryanmacfarlane commented on Jan 24, 2020

    @bryanmacfarlane
    Contributor

    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

    #49

  25. eregon commented on Feb 6, 2020

    @eregon
    Contributor

    FYI, eregon/use-ruby-action has moved to ruby/setup-ruby.
    Which means that action (and the builder repos) are now part of the official Ruby organization on GitHub.

  26. bryanmacfarlane commented on Feb 6, 2020

    @bryanmacfarlane
    Contributor

    @eregon - Awesome. I'll follow up soon

  27. bryanmacfarlane commented on Feb 6, 2020

    @bryanmacfarlane
    Contributor
  28. MSP-Greg commented on Feb 25, 2020

    @MSP-Greg
    ContributorAuthor

    I'm ok to close...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions