Skip to content

Commit

Permalink
Add trilogy and pg to test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
npezza93 committed Sep 12, 2024
1 parent 5791054 commit 27594ff
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 18 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,37 @@ on:

jobs:
build:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database: [mysql, postgres, sqlite]
services:
mysql:
image: mysql:8.0.31
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
ports:
- 33060:3306
options: --health-cmd "mysql -h localhost -e \"select now()\"" --health-interval 1s --health-timeout 5s --health-retries 30
postgres:
image: postgres:15.1
env:
POSTGRES_HOST_AUTH_METHOD: "trust"
ports:
- 55432:5432
env:
TARGET_DB: ${{ matrix.database }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: bundle install
- name: Run tests
run: bin/test
run: |
cd test/dummy
bin/rails db:setup
cd ../../
bin/test
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ gemspec

gem "puma"

gem "pg"
gem "sqlite3"
gem "trilogy"

gem "rubocop"
42 changes: 25 additions & 17 deletions test/dummy/config/database.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
# SQLite. Versions 3.8.0 and up are supported.
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem "sqlite3"
#
<% def database_name_from(name); ENV["TARGET_DB"]=="sqlite" ? "db/#{name}.sqlite3" : name; end %>

<% if ENV["TARGET_DB"] == "mysql" %>
default: &default
adapter: sqlite3
adapter: trilogy
username: root
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
host: "127.0.0.1"
port: 33060
<% elsif ENV["TARGET_DB"] == "postgres" %>
default: &default
adapter: postgresql
encoding: unicode
username: postgres
pool: 5
host: "127.0.0.1"
port: 55432
gssencmode: disable # https://github.com/ged/ruby-pg/issues/311
<% else %>
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 50 } %>
retries: 100
<% end %>

development:
<<: *default
database: storage/development.sqlite3
database: <%= database_name_from("solid_queue_development") %>

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: storage/test.sqlite3

production:
<<: *default
database: storage/production.sqlite3
pool: 20
database: <%= database_name_from("solid_queue_test") %>

0 comments on commit 27594ff

Please sign in to comment.