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

Support .ruby_version #37

Closed

Conversation

masa-iwasaki
Copy link

This PR is an implementation for #31 by reading the target version from .ruby-version before using version parameter in workflows.

@InteNs
Copy link

InteNs commented Nov 21, 2019

we would love this feature as well

why has there been no activity on this PR yet?

@dmitry
Copy link

dmitry commented Dec 25, 2019

We have started to use RVM which takes .ruby-version using cat few weeks ago with caching:

      - name: Cache rvm and ruby
        uses: actions/cache@v1
        id: rvm-cache
        with:
          path: ~/.rvm
          key: ${{ runner.os }}-rvm-${{ hashFiles('**/.ruby-version') }}
          restore-keys: |
            ${{ runner.os }}-rvm-
      - name: Set up RVM and install Ruby
        if: steps.rvm-cache.outputs.cache-hit != 'true'
        run: |
          curl -sSL https://get.rvm.io | bash
          source $HOME/.rvm/scripts/rvm
          rvm install $(cat .ruby-version) --binary
          rvm --default use $(cat .ruby-version)

@masa-iwasaki
Copy link
Author

I think people who are interested in this PR will have another problem even if after this PR has merged because available versions of Ruby are very limited so far in current virtual environments.

AFAK Ruby versions has been maintained by virtual-environments. virtual-enviroments seems to keep only the latest versions of maintained ( non-EOL ) Ruby. For example, you can see which versions of Ruby has been installed in Ubuntu 18.04 virtual enviroment from the link below.

https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md

If the version of Ruby you specified in .ruby-version doesn't exist in the README above, you'll have to install Ruby by yourself or use another action anyway. So I recommend you to setup Ruby version managers on your platform. I think @dmitry 's comment is a comprehensive example with rvm and I also created an action to install Ruby with rbenv, another popular Ruby version manager.

https://github.com/marketplace/actions/setup-rbenv

@eregon
Copy link
Contributor

eregon commented Jan 7, 2020

FWIW, https://github.com/eregon/use-ruby-action supports recent Ruby versions and reading from .ruby-version.

@masa-iwasaki That sounds similar to https://github.com/clupprich/ruby-build-action, it might be worth to deduplicate.

@masa-iwasaki
Copy link
Author

@eregon That's great! But one thing I am concerning about is current eregon/use-ruby-action ( eregon/ruby-install-builder, essentially) seems to support only the latest patch level of each version.

https://github.com/eregon/ruby-install-builder/releases

AFAIK, .ruby-version requires an exact version of Ruby. For example, I have a private Rails project which uses 2.5.5 with .ruby-version. When I tried use-ruby-action, I got errors as I expcted.

Run eregon/use-ruby-action@master
  with:
    ruby-version: .ruby-version
  env:
    RBENV_ROOT: /home/runner/.rbenv
Using 2.5.5 as input from file .ruby-version
##[error]Unknown version 2.5.5 for ruby
        input: 2.5.5
        available versions for ruby: 2.3.8, 2.4.9, 2.5.7, 2.6.5, 2.7.0
        File an issue at https://github.com/eregon/ruby-install-builder/issues if would like support for a new version
##[error]Node run failed with exit code 1

I think most of Ruby applications ought to have time lags to catch up the latet patch level when new patch versions are released. Do you have a plan to support all patch levels of each maintained version of Rubies in eregon/use-ruby-action ?

@eregon
Copy link
Contributor

eregon commented Jan 8, 2020

I can add more versions in ruby-install-builder, yes.
I was thinking to add them incrementally based on what's needed.
For instance 2.6.4 has a major string bug, and 2.x.0 are usually buggy too so we can likely skip those.

But to some degree it's just more convenient if all MRI versions are available.
I'd like to encourage people to use the latest stable versions rather than some old ones, but don't want to prevent them using older versions either if they want to.

I'll take a look at adding 2.5.5 and more soon.

@masa-iwasaki
Copy link
Author

That's good to hear. I think there would be several reasons that developers can't upgrade to the latest patch soon (e.g. waiting production servers ready to be deployed, major features are exepected to going on public) .

I will update README of setup-rbenv to encourge users to use use-ruby-action when the patch levels are available 😀

And I have also started reading ruby-build-action. I suppose I will submit some PRs to solve duplications.

@eregon
Copy link
Contributor

eregon commented Jan 8, 2020

@masa-iwasaki All Ruby versions between 2.4.0 and 2.7.0 are now supported:
https://github.com/eregon/use-ruby-action#supported-versions
https://github.com/eregon/ruby-install-builder/blob/metadata/versions.json

@masa-iwasaki
Copy link
Author

@eregon Thanks for your actions !

I close this PR because what I wanted to implement was completely satisfiled by eregon/use-ruby-action and it seems to be that eregon/urse-ruby-action will become setup-ruby v2 based on the discussions at #44. Even if the future of setup-ruby changed, I beliveve that requests for supporting .ruby-version will not be forgotten by comitters because the original issue of this PR (#31) are still not closed.

Many thanks for the folks who supported this PR ❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants