Skip to content

Instantly share code, notes, and snippets.

@ismailmechbal
Created January 5, 2018 16:53
Show Gist options
  • Save ismailmechbal/cc84f0ec8a41866a3ab0d4cd8d777a9a to your computer and use it in GitHub Desktop.
Save ismailmechbal/cc84f0ec8a41866a3ab0d4cd8d777a9a to your computer and use it in GitHub Desktop.
---
version: 2
jobs:
build:
working_directory: ~/your-app-name
docker:
- image: circleci/ruby:2.4.1
environment:
PGHOST: localhost
PGUSER: your-app-name
RAILS_ENV: test
- image: postgres:9.5
environment:
POSTGRES_USER: your-app-name
POSTGRES_DB: your-app-name_test
POSTGRES_PASSWORD: ""
steps:
- checkout
# Restore Cached Dependencies
- type: cache-restore
name: Restore bundle cache
key: your-app-name-{{ checksum "Gemfile.lock" }}
# Bundle install dependencies
- run: bundle install --path vendor/bundle
# Cache Dependencies
- type: cache-save
name: Store bundle cache
key: your-app-name-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
# Wait for DB
- run: dockerize -wait tcp://localhost:5432 -timeout 1m
# Setup the environment
- run: cp .sample.env .env
# Setup the database
- run: bundle exec rake db:setup
# Run the tests
- run: bundle exec rake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment