Skip to content

Commit

Permalink
Merge pull request #1748 from mamhoff/add-mysql-service-to-ci
Browse files Browse the repository at this point in the history
Add MySQL service as CI service
  • Loading branch information
tvdeyen authored Mar 18, 2020
2 parents 9f6f61c + 01c1caa commit 61e47bb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,30 @@ jobs:
- postgresql
env:
DB: ${{ matrix.database }}
MYSQL_PASSWORD: root
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
DB_USER: alchemy_user
DB_PASSWORD: password
DB_HOST: '127.0.0.1'
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_USER: alchemy_user
POSTGRES_PASSWORD: password
POSTGRES_DB: alchemy_cms_dummy_test
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mysql:
image: mysql:latest
ports: ['3306:3306']
env:
MYSQL_USER: alchemy_user
MYSQL_PASSWORD: password
MYSQL_DATABASE: alchemy_cms_dummy_test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
Expand Down
12 changes: 6 additions & 6 deletions spec/dummy/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ sqlite: &sqlite
mysql: &mysql
adapter: mysql2
encoding: utf8mb4
username: root
password: <%= ENV['MYSQL_PASSWORD'] %>
username: <%= ENV['DB_USER'] %>
password: <%= ENV['DB_PASSWORD'] %>
database: alchemy_cms_dummy_<%= Rails.env %>

postgresql: &postgresql
adapter: postgresql
<% if ENV['POSTGRES_USER'] %>
username: <%= ENV['POSTGRES_USER'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
<% if ENV['DB_USER'] %>
username: <%= ENV['DB_USER'] %>
password: <%= ENV['DB_PASSWORD'] %>
<% end %>
database: alchemy_cms_dummy_<%= Rails.env %>
min_messages: ERROR

defaults: &defaults
pool: 5
timeout: 5000
host: localhost
host: <%= ENV['DB_HOST'] || "localhost" %>
<<: *<%= ENV['DB'] || "sqlite" %>

development:
Expand Down

0 comments on commit 61e47bb

Please sign in to comment.