Merge pull request #1048 from sharkipedia/dependabot/npm_and_yarn/tes… #62
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: CI | |
on: | |
pull_request: | |
branches: | |
- "master" | |
push: | |
branches: | |
- "master" | |
jobs: | |
linters: | |
name: Linters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Ruby linters | |
run: bin/standardrb | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: --entrypoint redis-server | |
postgres: | |
image: postgis/postgis:11-2.5 | |
env: | |
POSTGRES_PASSWORD: password | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: password | |
RAILS_ENV: test | |
SES_SMTP_EMAIL_ADDRESS: [email protected] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Install PostgreSQL 11 client | |
run: | | |
sudo apt-get -yqq install libpq-dev | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}- | |
- name: Run yarn install | |
run: | | |
yarn install --pure-lockfile | |
- name: Cache assets | |
uses: actions/cache@v2 | |
with: | |
path: | | |
tmp/cache/webpacker | |
public/packs | |
public/packs-test | |
key: assets-${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('app/assets/**') }} | |
restore-keys: | | |
assets-${{ runner.os }}-${{ hashFiles('yarn.lock') }}- | |
- name: Compile assets | |
run: | | |
bin/rails webpacker:compile | |
- name: Seed Database | |
run: | | |
bin/rails db:create db:schema:load | |
wget -q https://d3ci4pmn27yclp.cloudfront.net/eez.tgz | |
tar xvzf eez.tgz | |
cat eez_v11.sql | psql sharkipedia_test | |
- name: Run Tests | |
run: | | |
bundle exec rails spec | |
- name: Run FrontEnd Tests | |
run: | | |
yarn test --passWithNoTests |