name: Ruby

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ruby-version: ['3.4', '4.0']
        gemfiles:
          - gemfiles/active_record_7.2.gemfile
          - gemfiles/active_record_8.0.gemfile
          - gemfiles/active_record_8.1.gemfile
    env:
      BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfiles }}
    steps:
    - uses: actions/checkout@v4
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true
    - name: Run tests
      run: bundle exec rake
