.circleci/config.yml in qiita_trend-0.4.4 vs .circleci/config.yml in qiita_trend-0.4.5
- old
+ new
@@ -1,51 +1,25 @@
version: 2.1
orbs:
+ ruby: circleci/ruby@1.1.2
slack: circleci/slack@3.4.2
executors:
base:
docker:
- - image: circleci/ruby:2.6.0
+ - image: cimg/ruby:2.6.6
+ auth:
+ username: dodonki1223
+ password: $DOCKERHUB_PASSWORD
environment:
# Bundlerのパス設定が書き換えられ`vendor/bundle`ではなくて`/usr/local/bundle`を参照してしまい`bundle exec`でエラーになる
# Bundlerのconfigファイル(pathの設定がされたもの)をworkspaceで永続化し`vendor/bundle`を参照するようにするための設定
BUNDLE_APP_CONFIG: .bundle
# ref: https://circleci.com/docs/2.0/faq/#how-can-i-set-the-timezone-in-docker-images
TZ: "Asia/Tokyo"
working_directory: ~/dodonki1223/qiita_trend
commands:
- install-bundler:
- steps:
- - run:
- name: Install bundler(2.1.0)
- command: gem install bundler:2.1.0
-
- # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
- restore-gem-cache:
- steps:
- - restore_cache:
- keys:
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
- # fallback to using the latest cache if no exact match is found
- - v1-dependencies-
-
- install-gem:
- steps:
- - run:
- name: Install gem
- command: |
- # jobs=4は並列処理をして高速化するための設定(4つのjobで実行するって意味)
- bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
-
- save-gem-cache:
- steps:
- - save_cache:
- paths:
- - ./vendor/bundle
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
-
save-workspace:
steps:
- persist_to_workspace:
# working_directory からの相対パスか絶対パスを指定します
root: .
@@ -55,40 +29,13 @@
steps:
- attach_workspace:
# working_directory からの相対パスか絶対パスを指定します
at: .
- run-rubocop:
- steps:
- - run:
- name: Run RuboCop
- command: |
- bundle exec rubocop
-
- run-tests:
- steps:
- - run:
- name: Run tests
- command: |
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
- bundle exec rspec \
- --format progress \
- --format RspecJunitFormatter \
- --out test_results/rspec/rspec.xml \
- --format progress \
- $TEST_FILES
-
collect-reports:
steps:
- # ref:https://circleci.com/docs/ja/2.0/configuration-reference/#store_test_results
- - store_test_results:
- path: test_results
- store_artifacts:
- # テスト結果をtest-resultsディレクトリに吐き出す
- path: test_results
- destination: test-results
- - store_artifacts:
# カバレッジの結果をcoverage-resultsディレクトリに吐き出す
path: coverage
destination: coverage-results
create-document:
@@ -138,42 +85,40 @@
jobs:
setup:
executor: base
steps:
- checkout
- - install-bundler
- - restore-gem-cache
- - install-gem
- - save-gem-cache
+ - ruby/install-deps
- save-workspace
lint:
executor: base
steps:
- using-workspace
- - install-bundler
- - run-rubocop
+ - ruby/install-deps
+ - ruby/rubocop-check
test:
executor: base
steps:
- using-workspace
- - install-bundler
- - run-tests
+ - ruby/install-deps
+ - ruby/rspec-test:
+ out-path: 'test_results/rspec/'
- collect-reports
document:
executor: base
steps:
- using-workspace
- - install-bundler
+ - ruby/install-deps
- create-document
deploy:
executor: base
steps:
- using-workspace
- - install-bundler
+ - ruby/install-deps
- deploy-rubygems
- deploy-notification
workflows:
version: 2.1