name: stable

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        ruby: [2.7, '3.0', 3.1, ruby-head, jruby-9.3]

    env:
      BUNDLE_WITHOUT: "benchmark"
      JRUBY_OPTS: "--debug"

    steps:
      - uses: actions/checkout@v2

      - name: Get sqlite for Rails test projects
        run: sudo apt-get install libsqlite3-dev

      - name: Setup ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true # 'bundle install' and cache

      - name: Get the newest rubygems version to rid ourselves of warnings
        run: gem update --system --no-document

      - name: Install bundler
        run: gem i bundler --no-document

      - name: Install dependencies
        run: |
          bundle config set --local without benchmark
          bundle install --jobs=3

      - name: Run tests
        run: bundle exec rake
