name: Test Suite

# Run against all commits and pull requests.
on: [ push, pull_request ]

jobs:
  test_matrix:

    strategy:
      fail-fast: false
      matrix:
        os:
          - ubuntu
          - macos
          - windows
        ruby:
          - 2.1
          - 2.2
          - 2.3
          - 2.4
          - 2.5
          - 2.6
          - 2.7
          - '3.0'
          - 3.1
          - head
          - jruby
          - jruby-head
          - truffleruby
          - truffleruby-head
          - mingw
        exclude:
          - { os: ubuntu,  ruby: mingw }
          - { os: macos,   ruby: mingw }
          - { os: windows, ruby: truffleruby }
          - { os: windows, ruby: truffleruby-head }

    runs-on: ${{ matrix.os }}-latest

    steps:
      - uses: actions/checkout@v2
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true
        env:
          JAVA_OPTS: -Djdk.io.File.enableADS=true
      - name: Run tests
        run: bundle exec rake default
        env:
          JAVA_OPTS: -Djdk.io.File.enableADS=true

  finish:
    runs-on: ubuntu-latest
    needs: [ test_matrix ]
    steps:
      - name: Wait for status checks
        run: echo "All Green!"
