Created
November 13, 2017 17:54
-
-
Save bschaeffer/10fc7329e57b6ef2d0149d29d6dda69f to your computer and use it in GitHub Desktop.
CircleCI Rails
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
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