Do not require unnecessary components #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ruby | |
on: | |
push: | |
branches: | |
- main | |
- 'releases/*' | |
pull_request: | |
branches: | |
- main | |
- 'releases/*' | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
HOST: localhost | |
REDIS_HOST: localhost:6379 | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/rails_bump_test | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd="pg_isready -U postgres" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install PostgreSQL client | |
run: | | |
sudo apt-get -yqq install libpq-dev | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
- name: Install dependencies | |
run: bundle install | |
- name: Wait for PostgreSQL | |
run: | | |
echo "Waiting for PostgreSQL to be ready..." | |
while ! pg_isready -h localhost -p 5432 -U postgres; do | |
sleep 1 | |
done | |
- name: Set up the database | |
run: | | |
cp config/database.yml.sample config/database.yml | |
bin/rails db:create | |
bin/rails db:schema:load | |
bin/rails db:test:prepare | |
- name: Run tests | |
run: bundle exec rspec spec |