-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
version: 2 # use CircleCI 2.0 | ||
jobs: # a collection of steps | ||
build: # runs not using Workflows must have a `build` job as entry point | ||
parallelism: 3 # run three instances of this job in parallel | ||
docker: # run the steps with Docker | ||
- image: circleci/2.6.4-stretch-node-browsers-legacy # ...with this image as the primary container; this is where all `steps` will run | ||
environment: # environment variables for primary container | ||
BUNDLE_JOBS: 3 | ||
BUNDLE_RETRY: 3 | ||
BUNDLE_PATH: vendor/bundle | ||
PGHOST: 127.0.0.1 | ||
PGUSER: circleci-demo-ruby | ||
RAILS_ENV: test | ||
- image: circleci/mysql:latest # database image | ||
environment: # environment variables for database | ||
POSTGRES_USER: circleci-demo-ruby | ||
POSTGRES_DB: rails_blog | ||
POSTGRES_PASSWORD: "" | ||
steps: # a collection of executable commands | ||
- checkout # special step to check out source code to working directory | ||
|
||
# Which version of bundler? | ||
- run: | ||
name: Which bundler? | ||
command: bundle -v | ||
|
||
# Restore bundle cache | ||
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/ | ||
- restore_cache: | ||
keys: | ||
- rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} | ||
- rails-demo-bundle-v2- | ||
|
||
- run: # Install Ruby dependencies | ||
name: Bundle Install | ||
command: bundle check --path vendor/bundle || bundle install --deployment | ||
|
||
# Store bundle cache for Ruby dependencies | ||
- save_cache: | ||
key: rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} | ||
paths: | ||
- vendor/bundle | ||
|
||
- run: | ||
name: Wait for DB | ||
command: dockerize -wait tcp://localhost:5432 -timeout 1m | ||
|
||
- run: | ||
name: Database setup | ||
command: bin/rails db:create || bin/rails db:migrate RAILS_ENV=deployment || bin/rails db:seed RAILS_ENV=deployment | ||
|
||
- run: | ||
name: Run rspec in parallel | ||
command: bundle exec rspec | ||
|
||
# Save test results for timing analysis | ||
- store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ | ||
path: test_results | ||
# See https://circleci.com/docs/2.0/deployment-integrations/ for example deploy configs |