Skip to content

Commit

Permalink
chore(ci): Configure postgresql service for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cassiosantana committed Aug 29, 2023
1 parent b57bfc3 commit 79887bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ jobs:

runs-on: ubuntu-latest

services:
db:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports: ['5432:5432']

env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 3.2.2
Expand All @@ -20,10 +33,9 @@ jobs:
bundle install --jobs 4 --retry 3
- name: Setup test database
env:
RAILS_ENV: test
run: |
bundle exec rake db:migrate
bundle exec rails db:create
bundle exec rails db:schema:load
- name: Run tests
env:
Expand Down
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
default: &default
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
url: <%= ENV['DATABASE_URL'] %>

development:
<<: *default
Expand Down

0 comments on commit 79887bf

Please sign in to comment.