on:
  push:
    branches: [master]

  pull_request:

jobs:
  ci:
    runs-on: ubuntu-latest
    continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.gemfile == 'gemfiles/rails_edge.gemfile' }}

    strategy:
      matrix:
        ruby:
          # MRI
          - head
          - "3.1.0-preview1"
          - "3.0"
          - "2.7"
          - "2.6"

          # JRuby
          - jruby-head
          - jruby-9.3
          - jruby-9.2

          # TruffleRuby
          - truffleruby-head
          - truffleruby-21.3

        gemfile:
          - Gemfile
          - gemfiles/rails_edge.gemfile
          - gemfiles/rails_6.0.gemfile
          - gemfiles/rails_5.2.gemfile

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

    steps:
      - uses: actions/checkout@v2

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

      - run: bundle exec rake

on:
  push:
    branches: [master]

  pull_request:

jobs:
  ci:
    runs-on: ubuntu-latest
    continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.gemfile == 'gemfiles/rails_edge.gemfile' }}

    strategy:
      matrix:
        ruby:
          # MRI
          - head
          - "3.1.0-preview1"
          - "3.0"
          - "2.7"

          # JRuby
          - jruby-head
          - jruby-9.3
          - jruby-9.2

          # TruffleRuby
          - truffleruby-head
          - truffleruby-21.3

        gemfile:
          - Gemfile
          - gemfiles/rails_edge.gemfile
          - gemfiles/rails_6.0.gemfile
          - gemfiles/rails_5.2.gemfile

        # Include additional ruby/gemfile combinations:
        include:
          # NOTE(ivy): Rails 7 requires Ruby version >= 2.7
          - ruby: "2.6"
            gemfile: Gemfile
          - ruby: "2.6"
            gemfile: gemfiles/rails_6.0.gemfile
          - ruby: "2.6"
            gemfile: gemfiles/rails_5.2.gemfile

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

    steps:
      - uses: actions/checkout@v2

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

      - run: bundle exec rake

Exclude MRI 2.6 from testing against Rails Edge
Exclude MRI 2.6 from testing against Rails Edge
