Skip to content

Instantly share code, notes, and snippets.

@searls
Created April 8, 2021 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searls/98260ce09bc4efeaabffd968f93ddef2 to your computer and use it in GitHub Desktop.
Save searls/98260ce09bc4efeaabffd968f93ddef2 to your computer and use it in GitHub Desktop.
version: 2
jobs:
build:
docker:
- image: cimg/ruby:3.0.1-browsers
environment:
PAGER: cat # https://stackoverflow.com/questions/53055044/rails-rake-dbstructureload-times-out-on-circleci-2-0
SKIP_SCHEMA_DUMP: true # pg_dump: error: server version: 13.2; pg_dump version: 12.6
CYPRESS_RAILS_CYPRESS_OPTS: "--record --key ace11e57-d9d5-443d-8882-b2ecf0488a6d"
- image: circleci/postgres:13.2
environment:
POSTGRES_USER: circleci
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- checkout
- run: sudo apt-get update -qq && sudo apt-get install -y postgresql
# Bundle install dependencies
- restore_cache:
keys:
- v1-bundler-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-bundler-
- run: bundle install --path vendor/bundle
- save_cache:
paths:
- vendor/bundle
key: v1-bundler-{{ checksum "Gemfile.lock" }}
# Yarn dependencies
- restore_cache:
keys:
- v1-yarn-{{ checksum "yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-yarn-
- run: yarn install
- save_cache:
paths:
- node_modules
- ~/.cache
key: v1-yarn-{{ checksum "yarn.lock" }}
- run:
name: Create .env
command: cp .env.example .env
- run:
name: Install Ruby deps
command: bin/bundle install --deployment --jobs=4 --without=production:development
- run:
name: Install node deps
command: yarn install
- run:
name: Set up database and run migrations
command: bin/rake db:create db:migrate db:test:prepare
- run:
name: Run tests
command: ./script/test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment