Skip to content

Instantly share code, notes, and snippets.

@cj
Created March 26, 2021 17:45
Show Gist options
  • Save cj/ba6aca746cbc84afba1a1b510979889d to your computer and use it in GitHub Desktop.
Save cj/ba6aca746cbc84afba1a1b510979889d to your computer and use it in GitHub Desktop.
---
name: Verify
on: [push]
jobs:
lint-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: circleci/postgres:12.5-postgis
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: snap_test
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- name: Pass all secrets to next steps
uses: cj/doppler-secrets-action@master
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN_TEST }}
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.5.0
registry-url: 'https://registry.npmjs.org'
- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: JS package cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages
run: |
yarn install --pure-lockfile
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Ruby gem cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle Install
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler
bundle install --jobs 4 --retry 3
bin/rails db:migrate
env:
BUNDLE_PATH: 'vendor/bundle'
- name: Run Linting
run: yarn lint
env:
BUNDLE_PATH: 'vendor/bundle'
- name: Run Tests
run: yarn test
env:
BUNDLE_PATH: 'vendor/bundle'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment