Skip to content

test: fix system tests (#97) #187

test: fix system tests (#97)

test: fix system tests (#97) #187

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies, and run linters
name: App CI -- run linters and tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
run-lint:
name: Linters
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run linters
run: |
bin/rubocop --parallel
run-tests:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
env:
POSTGRES_PASSWORD: postgres
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10ms
--health-timeout 500ms
--health-retries 15
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "14"
cache: yarn
- name: Install node modules
run: yarn
- name: Cache sprockets assets
uses: actions/cache@v3
with:
path: |
public/assets
tmp/assets
key: ${{ runner.os }}-sprockets-${{ hashFiles('app/assets/**/*')}}
- name: Cache shakapacker assets
uses: actions/cache@v3
with:
path: |
public/packs-test
tmp/webpacker
key: ${{ runner.os }}-shakapacker-${{ hashFiles('app/javascript/**/*')}}
- name: Precompile assets
env:
RAILS_ENV: test
run: bin/rails assets:precompile
- name: Setup test database
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/waterflow_app_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: |
bundle exec rails db:setup
- name: Run tests
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/waterflow_app_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
SIMPLE_COV: true
CI: true
run: bundle exec rspec --tag ~skip_ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: success() || failure()
with:
token: ${{ secrets.CODECOV_TOKEN }}