---
name: Continuous Integration
"on":
  - push
  - pull_request
jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - 2.6.8
          # TODO - 2.7
        gemfile:
          - gemfiles/rails4.2.gemfile
          - gemfiles/rails5.0.gemfile
          - gemfiles/rails5.1.gemfile
          - gemfiles/rails5.2.gemfile
          - gemfiles/rails6.0.gemfile
    env:
      BUNDLE_GEMFILE: ${{ matrix.gemfile }}
    steps:
      - uses: zendesk/checkout@v2
      - uses: zendesk/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true
      - name: test
        run: bundle exec rake test
    services:
      mysql:
        image: mysql:5.7
        ports:
          - 3306:3306
        env:
          MYSQL_ROOT_PASSWORD: ''
          MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
        options: >-
          --health-cmd="mysqladmin ping"
          --health-interval=2s
          --health-timeout=1s
          --health-retries=30
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: zendesk/checkout@v2
      - uses: zendesk/setup-ruby@v1
        with:
          ruby-version: 2.6.8
          bundler-cache: true
      - name: rubocop
        run: bundle exec rubocop

---
name: Continuous Integration
"on":
  - push
  - pull_request
jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - 2.6
          - 2.7
        gemfile:
          - gemfiles/rails4.2.gemfile
          - gemfiles/rails5.0.gemfile
          - gemfiles/rails5.1.gemfile
          - gemfiles/rails5.2.gemfile
          - gemfiles/rails6.0.gemfile
        exclude:
          - ruby: 2.7
            gemfile: gemfiles/rails4.2.gemfile
    env:
      BUNDLE_GEMFILE: ${{ matrix.gemfile }}
    steps:
      - uses: zendesk/checkout@v2
      - uses: zendesk/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true
      - name: test
        run: bundle exec rake test
    services:
      mysql:
        image: mysql:5.7
        ports:
          - 3306:3306
        env:
          MYSQL_ROOT_PASSWORD: ''
          MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
        options: >-
          --health-cmd="mysqladmin ping"
          --health-interval=2s
          --health-timeout=1s
          --health-retries=30
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: zendesk/checkout@v2
      - uses: zendesk/setup-ruby@v1
        with:
          ruby-version: 2.6
          bundler-cache: true
      - name: rubocop
        run: bundle exec rubocop

Add ruby 2.7, switch to 2.6 to pick up newer versions.
Add ruby 2.7, switch to 2.6 to pick up newer versions.
