forked from fixin.me/fixin.me
The repo's config/database.yml already handles both SQLite (default) and MySQL (DB_ADAPTER=mysql) via ERB. Remove the redundant steps that overwrote it with a hardcoded version, and pass DB_ADAPTER=mysql for the MySQL job. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
75 lines
1.5 KiB
YAML
75 lines
1.5 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
test-sqlite:
|
|
name: Tests (SQLite)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.3'
|
|
bundler-cache: true
|
|
env:
|
|
BUNDLE_WITH: "sqlite:development:test"
|
|
|
|
- name: Set up test database
|
|
run: bin/rails db:create db:schema:load
|
|
env:
|
|
RAILS_ENV: test
|
|
|
|
- name: Run tests
|
|
run: bin/rails test
|
|
env:
|
|
RAILS_ENV: test
|
|
CI: "true"
|
|
|
|
test-mysql:
|
|
name: Tests (MySQL)
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:8.0
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: ""
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
|
MYSQL_DATABASE: fixin_test
|
|
ports:
|
|
- 3306:3306
|
|
options: >-
|
|
--health-cmd="mysqladmin ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.3'
|
|
bundler-cache: true
|
|
env:
|
|
BUNDLE_WITH: "mysql:development:test"
|
|
|
|
- name: Set up test database
|
|
run: bin/rails db:schema:load
|
|
env:
|
|
RAILS_ENV: test
|
|
DB_ADAPTER: mysql
|
|
|
|
- name: Run tests
|
|
run: bin/rails test
|
|
env:
|
|
RAILS_ENV: test
|
|
CI: "true"
|
|
DB_ADAPTER: mysql
|