Skip to content

Commit

Permalink
Test with multiple databases on github actions ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Oct 22, 2019
1 parent 08212c7 commit 5e5ffca
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
51 changes: 33 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,37 @@ jobs:
ruby:
- '2.5.x'
- '2.6.x'
database:
- mysql
- postgresql
env:
DB: ${{ matrix.database }}
MYSQL_PASSWORD: root
PGHOST: 127.0.0.1
PGUSER: postgres
RAILS_ENV: test
services:
postgres:
image: postgres:10
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- name: Setup SQlite3
run: |
sudo apt-get install -y libsqlite3-dev
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install bundle
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Prepare database
run: |
bundle exec rake alchemy:spec:prepare
- name: Test with RSpec
run: |
bundle exec rspec
- uses: actions/checkout@v1
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install Postgres headers
if: matrix.database == 'postgresql'
run: |
sudo apt install -yqq libpq-dev
- name: Install bundle
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Prepare database
run: |
bundle exec rake alchemy:spec:prepare
- name: Test with RSpec
run: |
bundle exec rspec
2 changes: 1 addition & 1 deletion spec/dummy/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mysql: &mysql
adapter: mysql2
encoding: utf8mb4
username: root
password:
password: <%= ENV['MYSQL_PASSWORD'] %>
database: alchemy_cms_dummy_<%= Rails.env %>

postgresql: &postgresql
Expand Down

0 comments on commit 5e5ffca

Please sign in to comment.