name: CI
on:
  push:
    branches: [ '**' ]
    tags-ignore: [ '**' ]
  pull_request:
jobs:
  rubocop:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.3'
          bundler-cache: true
      - name: Rubocop
        run: bundle exec rubocop
  build:
    strategy:
      matrix:
        ruby: [ 'jruby-9.3', 'jruby-9.4', '2.6', '3.3' ]
        python: [ '3.8', '3.12' ]
        platform: [ ubuntu-22.04, macos-12, windows-2019 ]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true
      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python }}
      - name: Run Tests
        run: bundle exec rake test
    env:
      # Workaround JVM bug that causes JRuby to fail: https://bugs.openjdk.org/browse/JDK-8285445
      # See https://github.com/ruby/setup-ruby/issues/339
      # See https://github.com/jruby/jruby/issues/7182#issuecomment-1111610677
      JAVA_OPTS: -Djdk.io.File.enableADS=true
