Skip to content

db config and yml config #29

db config and yml config

db config and yml config #29

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.2', '3.3']
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: superfast_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: superfast
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Clear gem cache
run: rm -rf ~/.gem
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libvips postgresql-client
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Database configuration
run: cp config/database.yml config/database.yml.ci
- name: Ensure bin scripts are executable
run: chmod +x bin/*
- name: Prepare database
env:
RAILS_ENV: test
POSTGRES_HOST: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: superfast
POSTGRES_DB: superfast_test
run: |
bin/rails db:create
bin/rails db:schema:load
- name: Check PostgreSQL inside the container
run: docker exec -it $(docker ps -qf "name=postgres") psql -U postgres -d superfast_test
- name: Run tests
env:
RAILS_ENV: test
run: bin/rails test