Skip to content

Commit

Permalink
Merge pull request #29 from tknzk/circleci_2_0
Browse files Browse the repository at this point in the history
migrate circleci 2.0
  • Loading branch information
kakipo authored Oct 5, 2018
2 parents abc0404 + 007d244 commit d6cf901
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
47 changes: 47 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 2

jobs:
build:
parallelism: 3
docker:
- image: circleci/ruby:2.4.2-jessie-node
environment:
BUNDLE_JOBS: 3
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
RAILS_ENV: test
steps:
- checkout

# Which version of bundler?
- run:
name: Which bundler?
command: bundle -v

# Restore bundle cache
- restore_cache:
keys:
- kirico-bundle-v2-{{ checksum "Gemfile.lock" }}
- kirico-bundle-v2-

- run:
name: Bundle Install
command: bundle check || bundle install

# Store bundle cache
- save_cache:
key: kirico-bundle-v2-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle

- run:
name: Run Rubocop
command: ./script/circleci/run_rubocop.sh

- run:
name: Run rspec in parallel
command: ./script/circleci/run_rspec.sh

# Save test results for timing analysis
- store_test_results:
path: test_results
7 changes: 0 additions & 7 deletions circle.yml

This file was deleted.

7 changes: 7 additions & 0 deletions script/circleci/run_rspec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -e
test_reports_dir=$CIRCLE_TEST_REPORTS/rspec
mkdir -p $test_reports_dir

circleci tests glob "spec/**/*_spec.rb" | \
circleci tests split --split-by=timings --timings-type=filename | \
xargs bundle exec rspec --color --format RspecJunitFormatter --out $test_reports_dir/hanica.xml --format progress --require spec_helper --tag ~type:profiling --profile --
8 changes: 8 additions & 0 deletions script/circleci/run_rubocop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -e
test_reports_dir=$CIRCLE_TEST_REPORTS/rubocop
mkdir -p $test_reports_dir
junit_formatter_ruby=$(bundle show rubocop-junit-formatter 2>/dev/null)/lib/rubocop/formatter/junit_formatter.rb

bundle exec rubocop -L | \
circleci tests split --split-by=timings --timings-type=filename | \
xargs bundle exec rubocop -D -R -r $junit_formatter_ruby -c .rubocop.yml --format RuboCop::Formatter::JUnitFormatter --out $test_reports_dir/rubocop.xml

0 comments on commit d6cf901

Please sign in to comment.