using a different version of ruby

I’m working on an action to run CI for our rails app. I was using actions/setup-ruby@v1 successfully, however our app won’t run using a ruby higher than 2.3.4. I’m trying to install ruby 2.3.x and running into various issues. Anyone have a recommendation on how to install ruby 2.3.4? I’m running my job on ubuntu-latest. 

I know this is probably not what you want to hear, but perhaps it is time to deal with the real issue at hand? 2.3 is EOL and things are only going to get harder for you the longer you wait.

Perhaps updating the app is a better way to invest your time, and eliminate technical debt rather than adding to it?

That said, it this is not an option, then perhaps you can simply follow the usual Ruby installation steps - maybe with RVM?

Indeed, upgrading ruby is important but not happening at the moment.

btw I’m using rbenv to install ruby. The Gemfile is bundled fine, but when I try to run a rake task, gems aren’t found. I’ve tried various things, like setting GEM_PATH, setting BUNDLE_PATH, etc. Haven’t found the solution yet. This is more of a ruby question at this point, but I was hoping somebody has run into this.

I tried installing ruby 2.3 inside the Actions runner, using snap, just to see if I can provide you with a solution. The installation succeeded, but running ruby --version still shows newer version.

Perhaps you can play with it further.

name: Test
on: [push]

jobs:
  main:
    name: Rush demo
    runs-on: ubuntu-latest

    steps:
    - name: Install Ruby
      run: |
        sudo snap install ruby --classic --channel=2.3/stable
        sudo snap refresh
        ruby --version
1 Like

Hi @tswetonic ,

For actions/setup-ruby, the required minimum version is 2.4. You can find it mentioned in action.yaml here.

You can use another action ‘ruby/setup-ruby@v1’  instead. Code as below, hope it helps.

- uses: ruby/setup-ruby@v1
      with:
        ruby-version: 2.3.4
    - run: ruby -v

1 Like

I tried that and it didn’t work. Will try again, thanks! I did have success with rvm too.

@weide-zhou did you use ubuntu-latest as your runner?

Thanks @weide-zhou this now works. Last time I tried it, it failed!

Not sure what changed. Maybe this was a one-off failure when I tried it.

نظر شما رو برسی میکنم با تشکر