Skip to content

Commit

Permalink
Add MySQL service as service
Browse files Browse the repository at this point in the history
This adds MySQL into the CI pipeline, as Github Actions appears to have
removed it from the base image.
  • Loading branch information
mamhoff committed Mar 18, 2020
1 parent 9f6f61c commit 01c1caa
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 01c1caa

Please sign in to comment.