Merge pull request #13 from taka0125/feature/Rbs #37
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: Ruby | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
RAILS_ENV: test | |
DB_HOST: 127.0.0.1 | |
DB_PORT: 3306 | |
DB_USER: root | |
DB_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }} | |
DB_NAME: gizzard_test | |
MYSQL_PWD: ${{ secrets.MYSQL_ROOT_PASSWORD }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby: | |
- '3.0' | |
- '3.1' | |
activerecord: | |
- '6.0' | |
- '6.1' | |
- '7.0' | |
- '7.1' | |
services: | |
mysql: | |
image: mysql:8 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }} | |
MYSQL_DATABASE: ${{ env.DB_NAME }} | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
BUNDLE_GEMFILE: gemfiles/activerecord${{ matrix.activerecord }}.gemfile | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
cache-version: 1 | |
- name: set MySQL sql_mode | |
run: | | |
mysql --ssl-mode=DISABLE --get-server-public-key --protocol=tcp --host=${{ env.DB_HOST }} --user=${{ env.DB_USER }} mysql <<SQL | |
SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION'; | |
SET GLOBAL character_set_server = 'utf8mb4'; | |
SET GLOBAL innodb_file_per_table = ON; | |
SQL | |
- name: Setup DB | |
run: | | |
mysql -u ${DB_USER} -h ${DB_HOST} -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME}" | |
./scripts/migrate.sh | |
continue-on-error: ${{ matrix.allow_failures == 'true' }} | |
- name: Run tests | |
run: bundle exec rspec | |
continue-on-error: ${{ matrix.allow_failures == 'true' }} |