Code quality tools (#147)
This commit is contained in:
parent
5966bd69ec
commit
d83c20c524
|
@ -6,7 +6,7 @@ version: 2
|
|||
jobs:
|
||||
"ruby-2.3":
|
||||
docker:
|
||||
- image: circleci/ruby:2.3.7
|
||||
- image: hanami/ruby-2.3
|
||||
working_directory: ~/hanami-utils
|
||||
steps:
|
||||
- checkout
|
||||
|
@ -31,7 +31,7 @@ jobs:
|
|||
./script/ci
|
||||
"ruby-2.4":
|
||||
docker:
|
||||
- image: circleci/ruby:2.4.4
|
||||
- image: hanami/ruby-2.4
|
||||
working_directory: ~/hanami-utils
|
||||
steps:
|
||||
- checkout
|
||||
|
@ -56,7 +56,7 @@ jobs:
|
|||
./script/ci
|
||||
"ruby-2.5":
|
||||
docker:
|
||||
- image: circleci/ruby:2.5.1
|
||||
- image: hanami/ruby-2.5
|
||||
working_directory: ~/hanami-utils
|
||||
steps:
|
||||
- checkout
|
||||
|
@ -81,7 +81,7 @@ jobs:
|
|||
./script/ci
|
||||
"jruby-9.1":
|
||||
docker:
|
||||
- image: circleci/jruby:9.1-jdk
|
||||
- image: hanami/jruby-9.1
|
||||
working_directory: ~/hanami-utils
|
||||
steps:
|
||||
- checkout
|
||||
|
@ -106,7 +106,7 @@ jobs:
|
|||
./script/ci
|
||||
"jruby-9.2":
|
||||
docker:
|
||||
- image: circleci/jruby:9.2.0.0
|
||||
- image: hanami/jruby-9.2
|
||||
working_directory: ~/hanami-utils
|
||||
steps:
|
||||
- checkout
|
||||
|
|
3
Gemfile
3
Gemfile
|
@ -1,7 +1,7 @@
|
|||
source 'http://rubygems.org'
|
||||
gemspec
|
||||
|
||||
unless ENV['TRAVIS']
|
||||
unless ENV['CI']
|
||||
gem 'byebug', require: false, platforms: :mri
|
||||
gem 'yard', require: false
|
||||
end
|
||||
|
@ -10,4 +10,3 @@ gem 'hanami-utils', '~> 1.2', require: false, git: 'https://github.com/hanami/ut
|
|||
|
||||
gem 'hanami-devtools', require: false, git: 'https://github.com/hanami/devtools.git'
|
||||
gem 'i18n', '~> 0.7', require: false
|
||||
gem 'coveralls', require: false
|
||||
|
|
10
README.md
10
README.md
|
@ -4,11 +4,11 @@ Validations mixin for Ruby objects
|
|||
|
||||
## Status
|
||||
|
||||
[![Gem Version](http://img.shields.io/gem/v/hanami-validations.svg)](https://badge.fury.io/rb/hanami-validations)
|
||||
[![Build Status](http://img.shields.io/travis/hanami/validations/master.svg)](https://travis-ci.org/hanami/validations?branch=master)
|
||||
[![Coverage](http://img.shields.io/coveralls/hanami/validations/master.svg)](https://coveralls.io/r/hanami/validations)
|
||||
[![Code Climate](http://img.shields.io/codeclimate/github/hanami/validations.svg)](https://codeclimate.com/github/hanami/validations)
|
||||
[![Dependencies](http://img.shields.io/gemnasium/hanami/validations.svg)](https://gemnasium.com/hanami/validations)
|
||||
[![Gem Version](https://badge.fury.io/rb/hanami-validations.svg)](https://badge.fury.io/rb/hanami-validations)
|
||||
[![TravisCI](https://travis-ci.org/hanami/validations.svg?branch=master)](https://travis-ci.org/hanami/validations)
|
||||
[![CircleCI](https://circleci.com/gh/hanami/validations/tree/master.svg?style=svg)](https://circleci.com/gh/hanami/validations/tree/master)
|
||||
[![Test Coverage](https://codecov.io/gh/hanami/validations/branch/master/graph/badge.svg)](https://codecov.io/gh/hanami/validations)
|
||||
[![Depfu](https://badges.depfu.com/badges/a8545fb67cf32a2c75b6227bc0821027/overview.svg)](https://depfu.com/github/hanami/validations?project=Bundler)
|
||||
[![Inline Docs](http://inch-ci.org/github/hanami/validations.svg)](http://inch-ci.org/github/hanami/validations)
|
||||
|
||||
## Contact
|
||||
|
|
6
Rakefile
6
Rakefile
|
@ -1,6 +1,7 @@
|
|||
require 'rake'
|
||||
require 'bundler/gem_tasks'
|
||||
require 'rspec/core/rake_task'
|
||||
require 'hanami/devtools/rake_tasks'
|
||||
|
||||
require 'rake/testtask'
|
||||
Rake::TestTask.new do |t|
|
||||
|
@ -15,11 +16,6 @@ namespace :spec do
|
|||
|
||||
task.pattern = file_list
|
||||
end
|
||||
|
||||
task :coverage do
|
||||
ENV['COVERAGE'] = 'true'
|
||||
Rake::Task['spec:unit'].invoke
|
||||
end
|
||||
end
|
||||
|
||||
task default: 'spec:unit'
|
||||
|
|
24
script/ci
24
script/ci
|
@ -2,12 +2,23 @@
|
|||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
prepare_build() {
|
||||
if [ -d coverage ]; then
|
||||
rm -rf coverage
|
||||
fi
|
||||
}
|
||||
|
||||
print_ruby_version() {
|
||||
echo "Using $(ruby -v)"
|
||||
echo
|
||||
}
|
||||
|
||||
run_code_quality_checks() {
|
||||
bundle exec rubocop .
|
||||
}
|
||||
|
||||
run_unit_tests() {
|
||||
bundle exec rake spec:coverage
|
||||
bundle exec rake spec:unit
|
||||
}
|
||||
|
||||
run_isolation_tests() {
|
||||
|
@ -42,10 +53,17 @@ run_test() {
|
|||
COVERAGE=true bundle exec rspec $test
|
||||
}
|
||||
|
||||
upload_code_coverage() {
|
||||
bundle exec rake codecov:upload
|
||||
}
|
||||
|
||||
main() {
|
||||
run_code_quality_checks &&
|
||||
prepare_build &&
|
||||
print_ruby_version &&
|
||||
run_code_quality_checks &&
|
||||
run_unit_tests &&
|
||||
run_isolation_tests
|
||||
run_isolation_tests &&
|
||||
upload_code_coverage
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
@ -1,36 +1,8 @@
|
|||
if ENV['COVERALL']
|
||||
require 'coveralls'
|
||||
Coveralls.wear!
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.expect_with :rspec do |expectations|
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
end
|
||||
|
||||
config.mock_with :rspec do |mocks|
|
||||
mocks.verify_partial_doubles = true
|
||||
end
|
||||
|
||||
config.shared_context_metadata_behavior = :apply_to_host_groups
|
||||
|
||||
config.filter_run_when_matching :focus
|
||||
config.disable_monkey_patching!
|
||||
|
||||
config.warnings = true
|
||||
|
||||
config.default_formatter = 'doc' if config.files_to_run.one?
|
||||
|
||||
config.profile_examples = 10
|
||||
|
||||
config.order = :random
|
||||
Kernel.srand config.seed
|
||||
end
|
||||
|
||||
$LOAD_PATH.unshift 'lib'
|
||||
require 'hanami/utils'
|
||||
require 'hanami/validations'
|
||||
require 'hanami/validations/form'
|
||||
$LOAD_PATH.unshift "lib"
|
||||
require "hanami/utils"
|
||||
require "hanami/devtools/unit"
|
||||
require "hanami/validations"
|
||||
require "hanami/validations/form"
|
||||
|
||||
Hanami::Utils.require!("spec/support")
|
||||
Hanami::Utils.require!("spec/shared")
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
RSpec.configure do |config|
|
||||
config.expect_with :rspec do |expectations|
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
end
|
||||
|
||||
config.mock_with :rspec do |mocks|
|
||||
mocks.verify_partial_doubles = true
|
||||
end
|
||||
|
||||
config.shared_context_metadata_behavior = :apply_to_host_groups
|
||||
|
||||
config.filter_run_when_matching :focus
|
||||
config.disable_monkey_patching!
|
||||
|
||||
config.warnings = true
|
||||
|
||||
config.default_formatter = "doc" if config.files_to_run.one?
|
||||
|
||||
config.profile_examples = 10
|
||||
|
||||
config.order = :random
|
||||
Kernel.srand config.seed
|
||||
end
|
Loading…
Reference in New Issue