Manuel Bustillo eade9f0318
Some checks failed
Run unit tests / unit_tests (pull_request) Has been cancelled
Explicitly wait for Postgres to be ready to accept connections
2024-07-30 21:30:16 +02:00

42 lines
1.0 KiB
YAML

name: Run unit tests
on:
push:
branches:
- main
pull_request:
jobs:
unit_tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ruby/setup-ruby@v1
- run: bundle install
- name: Wait until Postgres is ready to accept connections
run: |
until pg_isready -h postgres -U postgres -d postgres
do
sleep 1
echo "Trying again"
done
- run: |
bundle exec rake db:create db:schema:load
bundle exec rspec
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres