name: CI

on: [push, pull_request]

jobs:
  build:
    name: >-
      ${{ matrix.os }} ${{ matrix.ruby }}

    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ ubuntu-22.04, macos-12, windows-2022 ]
        ruby: [ 2.7, "3.0", 3.1, 3.2, head ]
        include:
          - { os: windows-2022, ruby: ucrt  }
          - { os: windows-2022, ruby: mswin }
        exclude:
          - { os: windows-2022, ruby: head }

    steps:
      - name: repo checkout
        uses: actions/checkout@v4

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

      - name: compile
        timeout-minutes: 5
        run: bundle exec rake compile

      - name: test
        timeout-minutes: 5
        run: bundle exec rake test
