Skip to content

Fix Postgres image

Fix Postgres image #11

Workflow file for this run

name: Test
on: [push]
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: opencourts_api_test
RAILS_ENV: test
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: opencourts_api_test
RAILS_ENV: test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- name: "Read Ruby Version"
run: echo "##[set-output name=RUBY_VERSION;]$(cat .ruby-version)"
id: read-ruby-version
- uses: actions/setup-ruby@v1
with:
ruby-version: "${{ steps.read-ruby-version.outputs.RUBY_VERSION }}"
- uses: actions/setup-node@v1
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Install Required Packages
run: sudo apt-get install libpq-dev libcurl4-openssl-dev
- name: Install Bundle
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Install Yarn
run: npm install -g yarn
- name: Get Yarn Cache Dir
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Set-up Yarn Cache
id: cache-yarn
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn
run: yarn install
- name: Setup Database
run: |
cp config/database.yml.github-actions config/database.yml
bin/rails db:create db:schema:load
bin/rails db:test:load_schema
- name: Run RSpec
run: bin/rspec