forked from CircleCI-Public/circleci-step-by-step-ruby
-
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
Noboru Kurumai
committed
Apr 24, 2019
1 parent
8212560
commit 13ce72f
Showing
3 changed files
with
104 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,80 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
parallelism: 3 | ||
docker: | ||
- image: circleci/ruby:2.4.2-jessie-node | ||
environment: | ||
BUNDLE_JOBS: 3 | ||
BUNDLE_RETRY: 3 | ||
BUNDLE_PATH: vendor/bundle | ||
PGHOST: 127.0.0.1 | ||
PGUSER: circleci-demo-ruby | ||
RAILS_ENV: test | ||
- image: circleci/postgres:9.5-alpine | ||
environment: | ||
POSTGRES_USER: circleci-demo-ruby | ||
POSTGRES_DB: rails_blog | ||
POSTGRES_PASSWORD: "" | ||
steps: | ||
- checkout | ||
|
||
# Which version of bundler? | ||
- run: | ||
name: Which bundler? | ||
command: bundle -v | ||
|
||
# Restore bundle cache | ||
- restore_cache: | ||
keys: | ||
- rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} | ||
- rails-demo-bundle-v2- | ||
|
||
- run: | ||
name: Bundle Install | ||
command: bundle check || bundle install | ||
|
||
# Store bundle cache | ||
- save_cache: | ||
key: rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} | ||
paths: | ||
- vendor/bundle | ||
|
||
# Only necessary if app uses webpacker or yarn in some other way | ||
- restore_cache: | ||
keys: | ||
- rails-demo-yarn-{{ checksum "yarn.lock" }} | ||
- rails-demo-yarn- | ||
|
||
- run: | ||
name: Yarn Install | ||
command: yarn install --cache-folder ~/.cache/yarn | ||
|
||
# Store yarn / webpacker cache | ||
- save_cache: | ||
key: rails-demo-yarn-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
|
||
- run: | ||
name: Wait for DB | ||
command: dockerize -wait tcp://localhost:5432 -timeout 1m | ||
|
||
- run: | ||
name: Database setup | ||
command: bin/rails db:schema:load --trace | ||
|
||
# Run rspec in parallel | ||
- run: | ||
name: Run rspec in parallel | ||
command: | | ||
bundle exec rspec --profile 10 \ | ||
--format RspecJunitFormatter \ | ||
--out test_results/rspec.xml \ | ||
--format progress \ | ||
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) | ||
# Save test results for timing analysis | ||
- store_test_results: | ||
path: test_results |
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,23 @@ | ||
# See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile '~/.gitignore_global' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore the default SQLite database. | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-journal | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
/node_modules | ||
/yarn-error.log | ||
|
||
.byebug_history |
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 @@ | ||
--require spec_helper |