name: build

on: [push, pull_request]

jobs:
  ruby-versions:
    uses: ruby/actions/.github/workflows/ruby_versions.yml@master
    with:
      min_version: 2.5

  build:
    needs: ruby-versions
    name: build (${{ matrix.ruby }} / ${{ matrix.os }})
    strategy:
      fail-fast: false
      matrix:
        ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
        os: [ ubuntu-latest, macos-latest, windows-latest ]
        exclude:
          - { os: macos-latest, ruby: '2.5' }
          - { os: windows-latest, ruby: 'truffleruby' }
          - { os: windows-latest, ruby: 'truffleruby-head' }
        include:
          - { os: macos-15-intel, ruby: '2.5' }
          - { os: macos-15-intel, ruby: '3.4' }
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - name: Set up Ruby
      uses: ruby/setup-ruby@90be1154f987f4dc0fe0dd0feedac9e473aa4ba8 # v1.286.0
      with:
        ruby-version: ${{ matrix.ruby }}
    - name: Install dependencies
      run: bundle install
    - name: Run test
      run: rake compile test
