Skip to content

Test against Rails main #99

Test against Rails main

Test against Rails main #99

name: Test against Rails main
on:
schedule:
- cron: "0 0 * * *" # Run every day at 00:00 UTC
workflow_dispatch:
jobs:
tests:
runs-on: ubuntu-latest
name: Test ${{ matrix.gemfile }} with Ruby ${{ matrix.ruby-version }}
services:
mysql:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
options: >-
--health-cmd "mysql -uroot -e 'show databases'"
--health-interval 2s
--health-timeout 1s
--health-retries 10
strategy:
fail-fast: false
matrix:
ruby-version:
- "3.2"
- "3.3"
gemfile:
- "rails_main_mysql2"
- "rails_main_trilogy"
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v4
- name: Install Ruby, Bundler and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Create user 'john-doe' in MySQL
run: mysql --host 127.0.0.1 --port 3306 -uroot -e "CREATE USER 'john-doe'; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX ON *.* TO 'john-doe'; FLUSH PRIVILEGES;"
- run: bundle exec rake test
tests_successful:
name: Tests passing?
needs: tests
if: always()
runs-on: ubuntu-latest
steps:
- run: |
if ${{ needs.tests.result == 'success' }}
then
echo "All tests passed"
else
echo "Some tests failed"
false
fi