---
name: RSpec test

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  rspec_tests:
    name: ${{ matrix.cfg.os }}(ruby ${{ matrix.cfg.ruby }})
    strategy:
      matrix:
        cfg:
          - {os: ubuntu-22.04, ruby: '2.7'}
          - {os: ubuntu-22.04, ruby: '3.0'}
          - {os: ubuntu-22.04, ruby: '3.2'}
          - {os: ubuntu-22.04, ruby: '3.3'}
          - {os: ubuntu-22.04, ruby: 'jruby-9.4.2'}
          - {os: windows-2019, ruby: '2.7'}
          - {os: windows-2019, ruby: '3.0'}
          - {os: windows-2019, ruby: '3.2'}

    runs-on: ${{ matrix.cfg.os }}
    steps:
      - name: Checkout current PR
        uses: actions/checkout@v4

      - name: Install ruby version ${{ matrix.cfg.ruby }}
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.cfg.ruby }}
          bundler-cache: true
      - run: bundle exec rake spec
      - name: Verify gem builds
        run: gem build --verbose *.gemspec
