Skip to content

Instantly share code, notes, and snippets.

@bschaeffer
Created November 13, 2017 17:54
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 bschaeffer/10fc7329e57b6ef2d0149d29d6dda69f to your computer and use it in GitHub Desktop.
Save bschaeffer/10fc7329e57b6ef2d0149d29d6dda69f to your computer and use it in GitHub Desktop.
CircleCI Rails
version: 2.0
jobs:
build:
working_directory: ~/prism
docker:
- image: ruby:2.2.4-alpine
- image: percona:5.6.35
environment:
- MYSQL_ROOT_PASSWORD=
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
environment:
- RAILS_ENV=test
- DATABASE_HOST=localhost
- DATABASE_HOST=3306
steps:
- checkout
# Restore bundle cache
- restore_cache:
name: Restore bundle cache
keys:
- rails-demo-bundle-{{ checksum "Gemfile.lock" }} # Try cache for these specific gems
- rails-demo-bundle- # Fallback to most recent bundle cache
- run: bundle install --path vendor/bundle
# Store bundle cache
- save_cache:
name: Saving bundle cache
key: rails-demo-bundle-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run:
name: Waiting for percona to start
command: dockerize -wait tcp://localhost:3306 -timeout 1m
- run:
name: Loading database schema
command: bundle exec rake db:create db:schema:load --trace
# Run rspec in parallel
- type: shell
command: |
bundle exec rspec --profile 10 \
--format progress \
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment