Render comments markdown #958
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
# Based on; | |
# https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml | |
# https://docs.publishing.service.gov.uk/manual/test-and-build-a-project-with-github-actions.html | |
# https://andycroll.com/ruby/github-actions-ci-for-rails-with-postgresql/ | |
# https://docs.github.com/en/actions/guides/creating-postgresql-service-containers | |
name: Test | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
RAILS_ENV: test | |
REDIS_URL: redis://localhost:6379 | |
services: | |
postgres: | |
# Docker Hub image | |
image: postgres:latest | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ruby/setup-ruby@v1 | |
with: # uses version defined in `.ruby-version` file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Create database | |
# Environment variable used to create a new PostgreSQL client. | |
env: | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
POSTGRES_PASSWORD: postgres | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432 | |
run: | | |
bundler exec rails db:setup | |
- name: Run Rspec | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432 | |
run: bin/rspec |