name: CI
on: [push, pull_request]
jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ruby: [ 2.5, 2.6, 2.7 ]
        rails: [ '5.0', '5.1', '5.2', '6.0', '6.1' ]
        include:
          - ruby: '3.0'
            rails: '6.0'
          - ruby: '3.0'
            rails: '6.1'
          - ruby: head
            rails: '6.0'
          - ruby: head
            rails: '6.1'
          - ruby: truffleruby
            rails: '6.0'
          - ruby: truffleruby
            rails: '6.1'

    env:
      BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails }}.gemfile

    steps:
      - uses: actions/checkout@v2

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true

      - name: Run tests
        run: bundle exec rake test
        continue-on-error: ${{ matrix.ruby == 'head' || matrix.ruby == 'truffleruby' }}
        timeout-minutes: 3
