.github/workflows/tests.yml
name: Tests
on:
- pull_request
- push
- workflow_dispatch
jobs:
test:
# Ruby; Gemfile; Without
name: |
${{ matrix.ruby }};
${{ matrix.gemfile }};
${{ matrix.without && format('w/o {0}', matrix.without) || 'all' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
ruby:
- "3.0"
- "2.7"
- "2.6"
- "2.5"
- "2.4"
gemfile:
- Rails-6.1
- Rails-6.0
- Rails-5.2
- Rails-5.1
- Rails-5.0
- Rails-4.2
without:
- ~
- activerecord
- mongoid
include:
# Rails 4.2 requires Bundler 1.x.
- gemfile: Rails-4.2
bundler_version: "1.17"
exclude:
# Rails 4.2 refuses to install on Ruby 2.7 and newer.
- gemfile: Rails-4.2
ruby: "3.0"
- gemfile: Rails-4.2
ruby: "2.7"
# Rails 5.x won't work with Ruby 3.0 and newer. See:
# - https://github.com/rails/rails/issues/40938#issuecomment-751569171
# - https://weblog.rubyonrails.org/2020/5/6/Rails-6-0-3-has-been-released/
- gemfile: Rails-5.2
ruby: "3.0"
- gemfile: Rails-5.1
ruby: "3.0"
- gemfile: Rails-5.0
ruby: "3.0"
# Rails 6 requires Ruby 2.5 or above
- gemfile: Rails-6.1
ruby: "2.4"
- gemfile: Rails-6.0
ruby: "2.4"
env:
# For Bundler control variables, refer to:
# https://bundler.io/v1.17/bundle_config.html
BUNDLE_GEMFILE: ${{ format('gemfiles/{0}.gemfile', matrix.gemfile) }}
steps:
- uses: actions/checkout@v2
- name: Install required software
run: |
sudo apt-get update
sudo apt-get purge mongo-tools*
sudo apt-get purge mongodb-mongosh*
sudo apt-get purge mongodb-database-tools
sudo apt-get install -yq libsqlite3-dev mongodb
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ matrix.bundler_version || '2' }}
bundler-cache: true
- name: Run tests
run: bundle exec rspec
env:
WITHOUT: ${{ matrix.without }}