Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Refactor CI setting using commands (CircleCI 2.1) #184

Merged
merged 1 commit into from
Sep 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
version: 2.1

default: &default
docker:
Expand All @@ -18,15 +18,29 @@ default: &default
- image: memcached:1.5-alpine
working_directory: ~/app

save_bundle_cache_option: &save_bundle_cache_option
key: v2-bundle-{{ checksum "Gemfile.lock" }}
paths:
- ~/app/vendor/bundle
commands:
setup_bundle:
description: "Setup bundle with cache"
steps:
- restore_cache:
keys:
- v2-bundle-{{ checksum "Gemfile.lock" }}
- v2-bundle
- run:
name: Setup bundle
command: |
set -xe
bundle install --jobs=4 --retry=3 --path vendor/bundle
bundle clean

# Resolve bundler version difference between Gemfile.lock and pre-installed in CI
gem install restore_bundled_with --no-document
restore-bundled-with

restore_bundle_cache_option: &restore_bundle_cache_option
keys:
- v2-bundle-{{ checksum "Gemfile.lock" }}
- v2-bundle
- save_cache:
key: v2-bundle-{{ checksum "Gemfile.lock" }}
paths:
- ~/app/vendor/bundle

jobs:
rspec:
Expand All @@ -37,11 +51,7 @@ jobs:

steps:
- checkout
- restore_cache:
<<: *restore_bundle_cache_option
- run: ./.circleci/setup_bundle.sh
- save_cache:
<<: *save_bundle_cache_option
- setup_bundle
- run: ./.circleci/setup_database.sh

- run: bundle exec rspec
Expand All @@ -52,11 +62,7 @@ jobs:

steps:
- checkout
- restore_cache:
<<: *restore_bundle_cache_option
- run: ./.circleci/setup_bundle.sh
- save_cache:
<<: *save_bundle_cache_option
- setup_bundle
- run: ./.circleci/setup_database.sh

- run: ./bin/rails index_shotgun:fire
Expand All @@ -66,11 +72,7 @@ jobs:

steps:
- checkout
- restore_cache:
<<: *restore_bundle_cache_option
- run: ./.circleci/setup_bundle.sh
- save_cache:
<<: *save_bundle_cache_option
- setup_bundle

- run: bundle exec rubocop

Expand Down
8 changes: 0 additions & 8 deletions .circleci/setup_bundle.sh

This file was deleted.