Bump actions/checkout from 3 to 4 (#62) #298
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 | |
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@v4 | |
- 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 |