Skip to content

Instantly share code, notes, and snippets.

@RishikeshDarandale
Forked from mxygem/circle.yml
Created March 8, 2019 13:46
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 RishikeshDarandale/7af242bfe241853576454bb02d456eca to your computer and use it in GitHub Desktop.
Save RishikeshDarandale/7af242bfe241853576454bb02d456eca to your computer and use it in GitHub Desktop.
Refactored circle.yaml
aliases:
- &restore_gem_cache
keys:
- v1-gemfile-{{ checksum "Gemfile.lock" }}
- &save_gem_cache
name: Saving gem cache
key: v1-gemfile-{{ checksum "Gemfile.lock" }}
paths:
- ~/data/vendor/bundle
- &bundle_install
name: Install Gems
command: bundle install --path=vendor/bundle --jobs=4 --retry=3
- &attach_workspace
attach_workspace:
at: ~/data
- &dependencies
- checkout
- *attach_workspace
- restore_cache: *restore_gem_cache
- run: *bundle_install
- save_cache: *save_gem_cache
- persist_to_workspace:
root: .
paths:
- vendor/bundle
- &db_setup
name: Setup DB
command: |
bundle exec rake simulated_db_create
bundle exec rake simulated_db_load
- &database
- checkout
- *attach_workspace
- run: *bundle_install
- run: *db_setup
- &run_rspec
name: RSpec
command: bundle exec rake simulated_rspec
- &rspec_steps
- checkout
- *attach_workspace
- run: *bundle_install
- run: *run_rspec
- &cucumber
name: Cucumber
command: |
echo "cucumber feature - ${FEATURE}"
bundle exec cucumber ${FEATURE}
- &selenium
name: Selenium
command: bundle exec rake simulated_selenium
- &selenium_steps
- checkout
- *attach_workspace
- run: *bundle_install
- run: *selenium
- &cucumber_steps
- checkout
- *attach_workspace
- run: *bundle_install
- run: *cucumber
- &stage_deploy
name: Stage Deploy
command: make build_stage
- &deploy_stage
- checkout
- run: apk add --update make
- run: *stage_deploy
- &prod_deploy
name: Prod Deploy
command: make build_prod
- &deploy_prod
- checkout
- *attach_workspace
- run: *bundle_install
- run: *prod_deploy
# Requirement groups
- &deps
- "Dependencies"
- &deps_and_deploy
- "Dependencies"
- "Stage Deploy"
- &deps_and_db
- "Dependencies"
- "Database"
- &all_test
- "RSpec"
- "Cucumber Number Addition"
- "Cucumber Number Subtraction"
- "Cucumber Alphas"
- "Selenium Firefox"
- "Selenium Chrome"
- "Selenium Safari"
- "Selenium iPhone"
- "Selenium iPad"
- "Selenium Pixel 3"
# Build environments
- &deploy_environment
working_directory: ~/data
docker:
- image: alpine:latest
- &test_environment
working_directory: ~/data
docker:
- image: ruby:2.4
version: 2
workflows:
version: 2
master:
jobs:
- "Stage Deploy"
- "Dependencies"
- "Database":
requires: *deps
- "RSpec":
requires: *deps_and_db
- "Cucumber Number Addition":
requires: *deps_and_db
- "Cucumber Number Subtraction":
requires: *deps_and_db
- "Cucumber Alphas":
requires: *deps_and_db
- "Selenium Firefox":
requires: *deps_and_deploy
- "Selenium Chrome":
requires: *deps_and_deploy
- "Selenium Safari":
requires: *deps_and_deploy
- "Selenium iPhone":
requires: *deps_and_deploy
- "Selenium iPad":
requires: *deps_and_deploy
- "Selenium Pixel 3":
requires: *deps_and_deploy
- "Deploy Prod":
requires: *all_test
jobs:
"Stage Deploy":
<<: *deploy_environment
steps: *deploy_stage
"Dependencies":
<<: *test_environment
steps: *dependencies
"Database":
<<: *test_environment
steps: *database
"RSpec":
<<: *test_environment
steps: *rspec_steps
"Cucumber Number Addition":
<<: *test_environment
environment:
FEATURE: features/number_addition.feature
steps: *cucumber_steps
"Cucumber Number Subtraction":
<<: *test_environment
environment:
FEATURE: features/number_subtraction.feature
steps: *cucumber_steps
"Cucumber Alphas":
<<: *test_environment
environment:
FEATURE: features/alphabet.feature
steps: *cucumber_steps
"Selenium Firefox":
<<: *test_environment
environment:
platform: firefox
version: latest
steps: *selenium_steps
"Selenium Chrome":
<<: *test_environment
environment:
platform: chrome
version: latest
steps: *selenium_steps
"Selenium Safari":
<<: *test_environment
environment:
platform: safari
version: latest
steps: *selenium_steps
"Selenium iPhone":
<<: *test_environment
environment:
platform: iphone_xs
version: '12'
steps: *selenium_steps
"Selenium Pixel 3":
<<: *test_environment
environment:
platform: pixel3
version: '9'
steps: *selenium_steps
"Selenium iPad":
<<: *test_environment
environment:
platform: ipad
version: '12'
steps: *selenium_steps
"Deploy Prod":
<<: *test_environment
steps: *deploy_prod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment