Skip to content

Instantly share code, notes, and snippets.

@jonallured
Created December 20, 2017 19:27
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 jonallured/45032779506138186973af7cb94b5363 to your computer and use it in GitHub Desktop.
Save jonallured/45032779506138186973af7cb94b5363 to your computer and use it in GitHub Desktop.
Volt Circle 2.0 Config
version: 2
base: &base
working_directory: ~/volt
docker:
- image: artsy/volt-testing
environment:
RAILS_ENV: test
- image: redis:3.2.10-alpine
jobs:
build:
<<: *base
steps:
# cache source code for other jobs
- checkout
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- save_cache:
key: source-{{ checksum ".source-sha" }}
paths:
- ~/volt
# restore or cache gem bundle
- restore_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
- run: bundle install --path vendor/bundle --jobs=4
- save_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
danger:
<<: *base
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
# restore gem bundle from build
- restore_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
- run: bundle --path vendor/bundle
- run: bundle exec danger
yarn_test:
<<: *base
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
- run: yarn install
- run: yarn test
rubocop:
<<: *base
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
# restore gem bundle from build
- restore_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
- run: bundle --path vendor/bundle
- run: bundle exec rubocop
prettier:
<<: *base
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
- run: yarn install
- run: yarn prettier-diff
teaspoon:
<<: *base
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
# restore gem bundle from build
- restore_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
- run: bundle --path vendor/bundle
- run: yarn install
- run: bundle exec teaspoon
fast_specs:
<<: *base
parallelism: 6
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
# restore gem bundle from build
- restore_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
- run: bundle --path vendor/bundle
- run: yarn install
- run:
name: rspec
command: |
FASTFILES=$(circleci tests glob "spec/controllers/**/*_spec.rb" "spec/helpers/**/*_spec.rb" "spec/models/**/*_spec.rb" "spec/requests/**/*_spec.rb" "spec/services/**/*_spec.rb" | circleci tests split --split-by=timings)
bundle exec rspec -- ${FASTFILES}
view_specs:
<<: *base
parallelism: 6
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
# restore gem bundle from build
- restore_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
- run: bundle --path vendor/bundle
- run: yarn install
- run: mkdir ~/rspec
- run:
name: rspec
command: |
VIEWFILES=$(circleci tests glob "spec/features/**/*_spec.rb" "spec/views/**/*_spec.rb" | circleci tests split --split-by=timings)
set +e
bundle exec rspec --format RspecJunitFormatter -o ~/rspec/rspec.xml -- ${VIEWFILES}
exit 0
- run:
name: retry rspec
command: .circleci/retry_rspec
- store_artifacts:
path: ~/tmp/capybara
- store_artifacts:
path: ~/rspec
- store_test_results:
path: ~/rspec
deploy:
<<: *base
steps:
# restore source code from build
- run:
name: Save SHA
command: echo $CIRCLE_SHA1 > .source-sha
- restore_cache:
key: source-{{ checksum ".source-sha" }}
# restore gem bundle from build
- restore_cache:
key: bundler-{{ checksum "Gemfile.lock" }}
- run: bundle --path vendor/bundle
- run: bash .circleci/heroku_setup
- add_ssh_keys:
fingerprints:
- "1b:84:4f:fe:ad:ef:fc:d1:80:fb:be:ec:0c:03:36:73"
- deploy:
name: Deploy
command: .circleci/heroku_deploy
workflows:
version: 2
build_and_test:
jobs:
- build
- danger:
requires:
- build
filters:
branches:
ignore: release
- yarn_test:
requires:
- build
filters:
branches:
ignore: release
- rubocop:
requires:
- build
filters:
branches:
ignore: release
- prettier:
requires:
- build
filters:
branches:
ignore: release
- teaspoon:
requires:
- build
filters:
branches:
ignore: release
- fast_specs:
requires:
- build
filters:
branches:
ignore:
- release
- view_specs:
requires:
- danger
- yarn_test
- rubocop
- prettier
- teaspoon
- fast_specs
filters:
branches:
ignore: release
- deploy:
requires:
- view_specs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment