Skip to content

Implement rails/rails#48068 #118

Implement rails/rails#48068

Implement rails/rails#48068 #118

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
rails_version:
- "~>6.0.0"
- "~>6.1.0"
- "~>7.0.0"
ruby_version:
- '3.0'
- '3.1'
- '3.2'
fail-fast: false
runs-on: ubuntu-latest
name: Test on Rails ${{ matrix.rails_version }} with Ruby ${{ matrix.ruby_version }}
env:
RAILS_VERSION: ${{ matrix.rails_version }}
DB_HOST: 127.0.0.1
DB_PORT: 3306
steps:
- uses: actions/checkout@v3
- name: Cache .gem files
uses: actions/cache@v3
with:
key: gems-${{ matrix.rails_version }}-${{ hashFiles('Gemfile', '*.gemspec') }}
path: vendor/cache
- name: Start mysql
run: docker run -d --rm --name=mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -p 3306:3306 --health-interval=1s --health-timeout=5s --health-retries=5 --volume="$(pwd)"/script/setup.sql:/docker-entrypoint-initdb.d/setup.sql --health-cmd='mysql trilogy_test -e "select * from posts"' mysql:5.7 --sql_mode=NO_ENGINE_SUBSTITUTION --log-bin --server-id=1 --gtid-mode=ON --enforce-gtid-consistency=ON
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Wait for mysql
run: timeout -v '1m' bash -c 'until [ "`docker inspect -f {{.State.Health.Status}} mysql `" == "healthy" ]; do sleep 0.5; done'
- name: Run tests
run: bundle exec rake