Introduce matrix for unit tests. #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI RSpec Test | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: >- | |
Mongoid Test with: - Ruby ${{ matrix.ruby }} - MongoDB ${{ matrix.mongodb }} - Gemfile ${{ matrix.gemfile }}) | |
env: | |
CI: true | |
TESTOPTS: "-v" | |
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
strategy: | |
max-parallel: 4 | |
matrix: | |
# ruby: ["2.6", "2.7", "3.0", "3.1"] | |
# gemfile: ["monogid_3", "mongoid_4", "mongoid_5", "mongoid_6", "mongoid_7", "mongoid_8", "mongoid_9"] | |
# mongodb: ["3.6", "4.0", "5.0", "6.0", "7.0"] | |
# exclude: | |
# # Exclude incompatible combinations | |
# - { ruby: "2.6", gemfile: "mongoid_9" } | |
# - { ruby: "2.6", gemfile: "mongoid_7", mongodb: "4.0" } | |
# - { ruby: "2.6", gemfile: "mongoid_7", mongodb: "5.0" } | |
# - { ruby: "2.6", gemfile: "mongoid_7", mongodb: "6.0" } | |
# - { ruby: "2.6", gemfile: "mongoid_7", mongodb: "7.0" } | |
# - { ruby: "2.6", gemfile: "mongoid_8", mongodb: "4.0" } | |
# - { ruby: "2.6", gemfile: "mongoid_8", mongodb: "5.0" } | |
# - { ruby: "2.6", gemfile: "mongoid_8", mongodb: "6.0" } | |
# - { ruby: "2.6", gemfile: "mongoid_8", mongodb: "7.0" } | |
# - { ruby: "3.1", gemfile: "mongoid_3" } | |
# - { ruby: "3.1", gemfile: "mongoid_4" } | |
# - { ruby: "3.1", gemfile: "mongoid_5" } | |
ruby: ["3.0", "3.1"] | |
gemfile: ["mongoid_8", "mongoid_9"] | |
mongodb: ["6.0", "7.0"] | |
steps: | |
- name: Cache Gems | |
uses: actions/cache@v3 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gem- | |
- name: Set up MongoDB ${{ matrix.mongodb }} | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: ${{ matrix.mongodb }} | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler: '2' | |
bundler-cache: true | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests | |
run: bundle exec rake |