name: Test
on:
  - push
  - pull_request
jobs:
  ruby-versions:
    uses: ruby/actions/.github/workflows/ruby_versions.yml@master
    with:
      min_version: 2.7
  run:
    needs: ruby-versions
    strategy:
      fail-fast: false
      matrix:
        ruby-version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
        runs-on:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        exclude:
          - { ruby-version: truffleruby, runs-on: windows-latest }
          - { ruby-version: truffleruby-head, runs-on: windows-latest }
    name: ${{ matrix.ruby-version}} on ${{ matrix.runs-on }}
    runs-on: ${{ matrix.runs-on }}
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true
      - name: Test
        run: |
          bundle exec rake
