Merge pull request #86 from boblail/lail/fix-rachels-recipe #81
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: Rails Tests | |
on: | |
pull_request: | |
branches: | |
- 'master' | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11.5 | |
ports: ["5432:5432"] | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/cache@v1 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gem- | |
- name: Set up Ruby 3.1.3 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1.3 | |
- name: Install PostgreSQL 11 client | |
run: | | |
sudo apt update | |
sudo bash -c "echo deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main >> /etc/apt/sources.list.d/pgdg.list" | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get -yqq install libpq-dev postgresql-client-11 | |
- name: Bundle gems | |
run: | | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Yarn install | |
run: | | |
yarn install --cache-folder ~/.cache/yarn | |
- name: Setup database | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
RAILS_ENV: test | |
run: | | |
bin/rails db:create db:schema:load | |
- name: Run Tests | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
RAILS_ENV: test | |
run: | | |
bundle exec rake test |