-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds rubocop with a basic ruleset that can be run in the following ways: * `rubocop` - will run checks against codebase * `rubocop -a` - will run checks and fix what it can * `rake` - will run autocorrect (`rubocop -a`) and specs CI now runs rubocop and specs as two separate (and parallel) tasks, so we can see discrete passes and failures on PRs. Also fixes existing rubocop failures.
- Loading branch information
Showing
34 changed files
with
1,084 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,75 @@ | ||
--- | ||
# Ruby CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-ruby/ for more details | ||
# | ||
|
||
defaults: &defaults | ||
working_directory: ~/repo | ||
docker: | ||
- image: circleci/ruby:2.5.3-node-browsers | ||
|
||
version: 2 | ||
jobs: | ||
build: | ||
parallelism: 3 | ||
working_directory: ~/repo | ||
install_dependencies: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
- v1-dependencies- | ||
- run: bundle install --jobs=4 --retry=3 --path vendor/bundle | ||
- save_cache: | ||
paths: | ||
- ./vendor/bundle | ||
key: v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
|
||
run_checks: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
- v1-dependencies- | ||
- run: bundle --path vendor/bundle | ||
- run: bundle exec rubocop | ||
|
||
run_tests: | ||
<<: *defaults | ||
docker: | ||
- image: circleci/ruby:2.5.1-node-browsers | ||
- image: circleci/ruby:2.5.3-node-browsers | ||
steps: | ||
- checkout | ||
# Restore Cached Dependencies | ||
- restore_cache: | ||
name: Restore bundle cache | ||
key: v1-cfa_styleguide-{{ checksum "Gemfile.lock" }} | ||
# Bundle install dependencies | ||
- run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 --full-index | ||
# Cache Dependencies | ||
- save_cache: | ||
name: Store bundle cache | ||
key: v1-cfa_styleguide-{{ checksum "Gemfile.lock" }} | ||
paths: | ||
- vendor/bundle | ||
# Create place to store test results | ||
- run: mkdir /tmp/test-results | ||
# Run the tests | ||
- type: shell | ||
command: | | ||
gem install rspec && \ | ||
bundle exec rspec --profile 10 \ | ||
--require ./spec/support/pre_documentation_formatter.rb \ | ||
--format RspecJunitFormatter \ | ||
--out /tmp/test-results/rspec.xml \ | ||
--format PreDocumentationFormatter \ | ||
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) | ||
- store_test_results: | ||
path: /tmp/test-results | ||
- store_artifacts: | ||
path: spec/test_app/tmp/screenshots | ||
destination: screenshots | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "Gemfile.lock" }} | ||
- v1-dependencies- | ||
- run: bundle --path vendor/bundle | ||
- run: mkdir /tmp/test-results | ||
- type: shell | ||
command: | | ||
bundle exec rspec --profile 10 \ | ||
--require ./spec/support/pre_documentation_formatter.rb \ | ||
--format RspecJunitFormatter \ | ||
--out /tmp/test-results/rspec.xml \ | ||
--format PreDocumentationFormatter \ | ||
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) | ||
# collect reports | ||
- store_test_results: | ||
path: /tmp/test-results | ||
- store_artifacts: | ||
path: spec/test_app/tmp/screenshots | ||
destination: screenshots | ||
|
||
workflows: | ||
version: 2 | ||
build: | ||
jobs: | ||
- install_dependencies | ||
- run_checks: | ||
requires: | ||
- install_dependencies | ||
- run_tests: | ||
requires: | ||
- install_dependencies |
Oops, something went wrong.