Skip to content

Workflow file for this run

# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "Ruby on Rails CI"
on:
push:
branches: [ "gha" ]
pull_request:
branches: [ "gha" ]
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
# Set health checks to wait until mysql has started
options: >-
--health-cmd "mysqladmin ping -h localhost -u root -p$$MYSQL_ROOT_PASSWORD"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout
- name: Install Ruby and gems
uses: ruby/setup-ruby
with:
bundler-cache: true
- name: Run tests
env:
RAILS_ENV: test
DATABASE_URL: mysql2://test:[email protected]:3306/test
run: |
bundle install
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails test