name: build

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby:
        # https://hub.docker.com/_/ruby
        - '2.5'
        - '2.6'
        - '2.7'
        - '3.0'
        - '3.1'
        - 'latest'
    container:
      image: ruby:${{ matrix.ruby }}

    steps:
    - uses: actions/checkout@v2
    - name: Build and test with Rake
      run: |
        gem install bundler
        bundle install --jobs 4 --retry 3
        bundle exec rake

name: build

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby:
        # https://hub.docker.com/_/ruby
        - '2.5'
        - '2.6'
        - '2.7'
        - '3.0'
        - '3.1'
        - 'latest'

    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
        bundler-cache: true
    - name: Install dependencies
      run: bundle install --jobs 4 --retry 3
    - name: Build and test with Rake
      run: bundle exec rake

Use `ruby/setup-ruby` to install Ruby
Use `ruby/setup-ruby` to install Ruby

This follows https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-ruby#testing-with-multiple-versions-of-ruby
This also install Bundler so we don't need it again.
We don't need `container` directive anymore.
