Skip to content

Support Trilogy

Support Trilogy #36

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: test
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.value }}
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- id: generate-matrix
run: |
cat <<EOS ruby >> $GITHUB_OUTPUT
require 'json'
# In order to effectively specify Rails and Ruby versions simultaneously,
# we test only the oldest and latest Ruby versions for each Rails version.
rubies_by_gemfile = {
'gemfiles/rails_5.gemfile' => ['2.3', '2.6'],
'gemfiles/rails_6.0.gemfile' => ['2.5', '2.7'],
'gemfiles/rails_6.1.gemfile' => ['2.5', '3.2'],
'gemfiles/rails_7.0.gemfile' => ['2.7', '3.2'],
}
adapters = ['trilogy', 'mysql2']
matrix = JSON.generate(
adapters.flat_map do |adapter|
rubies_by_gemfile.flat_map do |gemfile, rubies|
rubies.map do |ruby|
{ ruby: ruby, gemfile: gemfile, adapter: adapter }
end
end
end
)
puts "value=#{matrix}"
EOS
test:
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: true
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
services:
mysql:
image: iwata/centos6-mysql56-q4m-hs
ports:
- 3306:3306
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: bundle install
- name: Run tests
env:
SHINQ_TEST_ADAPTER: ${{ matrix.adapter }}
run: bundle exec rspec