---
name: CI

on:
  - push
  - pull_request

jobs:
  rspec:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - 2.7.x
          - 2.6.x
          - 2.5.x
        rails:
          - rails_5.2.4
          - rails_6.0.3
          - rails_6.1.0
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Ruby
        uses: actions/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}

      - name: Setup Ruby cache
        uses: actions/cache@v2
        with:
          path: "${GITHUB_WORKSPACE}/vendor/bundle"
          key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-

      - name: Bundle
        env:
          RAILS_VERSION: ${{ matrix.rails }}
        run: |
          export BUNDLE_GEMFILE="${GITHUB_WORKSPACE}/gemfiles/${RAILS_VERSION}.gemfile"
          gem install bundler -v 2.1.4
          bundle config path "${GITHUB_WORKSPACE}/vendor/bundle"
          bundle install --jobs 4 --retry 3

      - name: RSpec
        env:
          RAILS_VERSION: ${{ matrix.rails }}
        run: |
          export BUNDLE_GEMFILE="${GITHUB_WORKSPACE}/gemfiles/${RAILS_VERSION}.gemfile"
          bundle exec rake

---
name: CI

on:
  - push
  - pull_request

jobs:
  rspec:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - 2.7.x
          - 2.6.x
          - 2.5.x
        rails:
          - rails_5.2.4
          - rails_6.0.3
          - rails_6.1.0
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Ruby
        uses: actions/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}

      - name: Setup Ruby cache
        uses: actions/cache@v2
        with:
          path: "${GITHUB_WORKSPACE}/vendor/bundle"
          key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-

      - name: Bundle
        env:
          RAILS_VERSION: ${{ matrix.rails }}
        run: |
          export BUNDLE_GEMFILE="${GITHUB_WORKSPACE}/gemfiles/${RAILS_VERSION}.gemfile"
          gem install bundler
          bundle config path "${GITHUB_WORKSPACE}/vendor/bundle"
          bundle install --jobs 4 --retry 3

      - name: RSpec
        env:
          RAILS_VERSION: ${{ matrix.rails }}
        run: |
          export BUNDLE_GEMFILE="${GITHUB_WORKSPACE}/gemfiles/${RAILS_VERSION}.gemfile"
          bundle exec rake

Use latest bundler version in CI
Use latest bundler version in CI
