Skip to content

Commit

Permalink
ci: fix cucumber tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisen-san committed Nov 18, 2024
1 parent 16ee170 commit 2aefaa3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ jobs:
ruby-version: [2.6, 2.7, 3.0]
services:
postgres:
image: postgres:12.1-alpine
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout Project
uses: actions/checkout@v3
Expand All @@ -41,15 +45,25 @@ jobs:
- name: Setup Database
run: |
cp config/database.yml.github-actions config/database.yml
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Test with RSpec
# - name: Test with RSpec
# env:
# RAILS_ENV: "test"
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# run: |
# bundle exec rspec

- name: Test with Cucumber
env:
RAILS_ENV: "test"
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: |
bundle exec rspec
until psql --user=postgres --dbname=postgres --command "\q" >/dev/null 2>&1 || [ "$RETRIES" -eq "$MAX_RETRIES" ]; do
echo >&2 "Waiting $((RETRIES += 1))s for the \"$PGHOST\" PostgreSQL server to start. $((MAX_RETRIES - RETRIES)) remaining attempts..."
sleep "$RETRIES"
false
done || exit 1
echo "> Postgres is ready!"
bundle exec cucumber
1 change: 1 addition & 0 deletions config/database.yml.github-actions
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test:
adapter: postgresql
host: localhost
port: 5432
encoding: unicode
database: github-actions
pool: 20
Expand Down

0 comments on commit 2aefaa3

Please sign in to comment.