Skip to content

Pre-cache official Ruby binaries on GitHub Actions images instead of custom binaries #98

Closed
@AlenaSviridenko

Description

@AlenaSviridenko

We are the maintainers of actions/virtual-environments repo and owns the Hosted images for GitHub Actions and Azure DevOps. We are looking for some collaboration and improving UX of our customers in Ruby area.

Currently, we support two tasks related to Ruby: actions/setup-ruby (for GitHub Actions) and UseRuby (for Azure DevOps). Both tasks require pre-built binaries of Ruby for Linux and MacOS to be placed on images. We build them by ourselves from source code and then put to the images during image generation.

Although this approach works, we believe that a more proper way is to use official Ruby binaries through the https://github.com/ruby/setup-ruby task that is provided by you. You have more expertise in Ruby building and supporting. Actually, ruby/setup-ruby is already mentioned in starter workflow as a default way to use Ruby for GitHub Actions https://github.com/actions/starter-workflows/blob/main/ci/ruby.yml#L27.

The only benefit of actions/setup-ruby is that it understands when Ruby version is already pre-cached on image and doesn't download it again. Action ruby/setup-ruby always downloads specified version.

We think that it would be great if we can collaborate more and pre-cache binaries provided by ruby-builder to our images:

  1. You will be able to configure your task to switch Ruby immediately without latency and download in runtime only in case if it is not pre-cached
    • Currently, we pre-cache the latest patch version for every major-minor pair of Ruby on images. It would speed up the task in the most of the cases.
  2. We will be able to avoid maintenance of own ruby-builder from our side

We have done investigation in order to investigate differences between ruby-builder and how we build Ruby from our side.
The main difference is that you build with shared libs support that means that binaries are bound to location where they were built and can’t be run from different location.

  • You build your binaries under $HOME/.rubies/ruby-<version>.
  • We build our binaries under /opt/hostedtoolcache/Ruby/<version>.
    NOTE: hostedtoolcache is recommended approach to store cached tools on images. actions/toolkit works with it by default. Also both actions/setup-ruby (GitHub Actions) and UseRuby (Azure DevOps) tasks are expecting to consume binaries from hostedtoolcache.

Is it possible to change the ruby-builder directory and build binaries under hostedtoolcache? If so, we would be able to achieve better customers UX and get benefits that were mentioned above.

Thank you,
Alyona.

cc: @maxim-lobanov, @alepauly, @sergey-akhalkov

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions