Created
March 5, 2018 13:12
-
-
Save sean2121/8f2c6c134e615df8236bfe8202a3b98b to your computer and use it in GitHub Desktop.
This file contains hidden or 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: | |
checkout_code: | |
docker: | |
- image: circleci/ruby:2.4-node | |
- image: circleci/postgres:9.4.12-alpine | |
working_directory: ~/circleci-demo-workflows | |
steps: | |
- checkout | |
- save_cache: | |
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }} | |
paths: | |
- ~/circleci-demo-workflows | |
bundle_dependencies: | |
docker: | |
- image: circleci/ruby:2.4-node | |
- image: circleci/postgres:9.4.12-alpine | |
working_directory: ~/circleci-demo-workflows | |
steps: | |
- restore_cache: | |
keys: | |
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | |
- restore_cache: | |
keys: | |
- v1-bundle-{{ checksum "Gemfile.lock" }} | |
- run: bundle install --path vendor/bundle | |
- save_cache: | |
key: v1-bundle-{{ checksum "Gemfile.lock" }} | |
paths: | |
- ~/circleci-demo-workflows/vendor/bundle | |
rake_test: | |
docker: | |
- image: circleci/ruby:2.4-node | |
- image: circleci/postgres:9.4.12-alpine | |
working_directory: ~/circleci-demo-workflows | |
steps: | |
- restore_cache: | |
keys: | |
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | |
- restore_cache: | |
keys: | |
- v1-bundle-{{ checksum "Gemfile.lock" }} | |
- run: bundle --path vendor/bundle | |
- run: bundle exec rake db:create db:schema:load | |
- run: | |
name: Run tests | |
command: bundle exec rake | |
precompile_assets: | |
docker: | |
- image: circleci/ruby:2.4-node | |
- image: circleci/postgres:9.4.12-alpine | |
working_directory: ~/circleci-demo-workflows | |
steps: | |
- restore_cache: | |
keys: | |
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | |
- restore_cache: | |
keys: | |
- v1-bundle-{{ checksum "Gemfile.lock" }} | |
- run: bundle --path vendor/bundle | |
- run: | |
name: Precompile assets | |
command: bundle exec rake assets:precompile | |
- save_cache: | |
key: v1-assets-{{ .Environment.CIRCLE_SHA1 }} | |
paths: | |
- ~/circleci-demo-workflows/public/assets | |
deploy: | |
machine: | |
enabled: true | |
working_directory: ~/circleci-demo-workflows | |
environment: | |
- HEROKU_APP: still-shelf-38337 | |
steps: | |
- restore_cache: | |
keys: | |
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | |
- restore_cache: | |
keys: | |
- v1-bundle-{{ checksum "Gemfile.lock" }} | |
- restore_cache: | |
keys: | |
- v1-assets-{{ .Environment.CIRCLE_SHA1 }} | |
- run: | |
name: Setup Heroku | |
command: bash .circleci/setup-heroku.sh | |
- run: | |
command: | | |
git push heroku fan-in-fan-out:master | |
heroku run rake db:migrate | |
sleep 5 # sleep for 5 seconds to wait for dynos | |
heroku restart | |
workflows: | |
version: 2 | |
build-and-deploy: | |
jobs: | |
- checkout_code | |
- bundle_dependencies: | |
requires: | |
- checkout_code | |
- rake_test: | |
requires: | |
- bundle_dependencies | |
- precompile_assets: | |
requires: | |
- bundle_dependencies | |
- deploy: | |
requires: | |
- rake_test | |
- precompile_assets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment