Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test against multiple PostgreSQL versions #291

Merged
merged 1 commit into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,43 @@ jobs:
name: Ruby specs
runs-on: ubuntu-latest

services:
db:
image: postgres:12
ports: ['5432:5432']
env:
POSTGRES_HOST_AUTH_METHOD: trust

options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2', '3.3']
gemfile: [rails_7.0, rails_7.1]
postgres-version: ['16']
channel: ['stable']

include:
# Test minimum required Ruby and Rails against PostgreSQL 12
- ruby-version: '3.0'
gemfile: rails_7.0
postgres-version: '12'
channel: 'stable'

- ruby-version: '3.1'
gemfile: rails_edge
postgres-version: '16'
channel: 'experimental'
- ruby-version: '3.2'
gemfile: rails_edge
postgres-version: '16'
channel: 'experimental'
- ruby-version: '3.3'
gemfile: rails_edge
postgres-version: '16'
channel: 'experimental'
- ruby-version: 'head'
gemfile: rails_7.0
postgres-version: '16'
channel: 'experimental'
- ruby-version: 'head'
gemfile: rails_7.1
postgres-version: '16'
channel: 'experimental'
- ruby-version: 'head'
gemfile: rails_edge
postgres-version: '16'
channel: 'experimental'

env:
Expand All @@ -61,11 +61,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Database
- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ matrix.postgres-version }}
database: chronomodel
- name: Create Rails app database # FIXME: refactor when ankane/setup-postgres#9 will be merged
run: |
psql -c "CREATE ROLE runner SUPERUSER LOGIN CREATEDB;" -U postgres -h localhost
psql -c "CREATE DATABASE chronomodel;" -U postgres -h localhost
psql -c "CREATE DATABASE chronomodel_railsapp;" -U postgres -h localhost
createdb chronomodel_railsapp
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
7 changes: 7 additions & 0 deletions spec/aruba/rake_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
contents.sub('username: postgres', "username: #{Etc.getlogin}")
end
end

# Hande GitHub Actions
if ENV['CI']
file_mangle!('config/database.yml') do |contents|
contents.sub('username: postgres', 'username: runner')
end
end
end

it { expect(last_command).to be_successfully_executed }
Expand Down
2 changes: 1 addition & 1 deletion spec/config.github.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
host: localhost
username: postgres
username: runner
password: ""
database: chronomodel
pool: 11
Loading