Merge branch 'develop' into unstable

This commit is contained in:
Luca Guidi 2018-07-10 14:09:16 +02:00
commit c0200cfc28
No known key found for this signature in database
GPG Key ID: 9A263F549EE12064
9 changed files with 203 additions and 54 deletions

141
.circleci/config.yml Normal file
View File

@ -0,0 +1,141 @@
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
"ruby-2.3":
docker:
- image: hanami/ruby-2.3
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
"ruby-2.4":
docker:
- image: hanami/ruby-2.4
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
"ruby-2.5":
docker:
- image: hanami/ruby-2.5
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
"jruby-9.1":
docker:
- image: hanami/jruby-9.1
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
"jruby-9.2":
docker:
- image: hanami/jruby-9.2
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
workflows:
version: 2
build:
jobs:
- "ruby-2.3"
- "ruby-2.4"
- "ruby-2.5"
- "jruby-9.1"
- "jruby-9.2"

1
.jrubyrc Normal file
View File

@ -0,0 +1 @@
debug.fullTrace=true

View File

@ -1,19 +1,22 @@
language: ruby
sudo: false
cache: bundler
before_script:
- gem update --system
script: ./script/ci
rvm:
- 2.3.5
- 2.4.2
- 2.5.0
- 2.4.4
- 2.3.7
- 2.5.1
- jruby-9.1.9.0
- ruby-head
- jruby-9.1.13.0
- jruby-head
matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: jruby-9.1.9.0
notifications:
webhooks:

View File

@ -3,7 +3,7 @@
source "http://rubygems.org"
gemspec
unless ENV["TRAVIS"]
unless ENV["CI"]
gem "byebug", require: false, platforms: :mri
gem "yard", require: false
end
@ -12,4 +12,3 @@ gem "hanami-utils", "~> 2.0.alpha", require: false, git: "https://github.com/han
gem "hanami-devtools", require: false, git: "https://github.com/hanami/devtools.git"
gem "i18n", "~> 0.9", require: false
gem "coveralls", require: false

View File

@ -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

View File

@ -3,12 +3,7 @@
require "rake"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rake/testtask"
Rake::TestTask.new do |t|
t.pattern = "test/**/*_test.rb"
t.libs.push "test"
end
require "hanami/devtools/rake_tasks"
namespace :spec do
RSpec::Core::RakeTask.new(:unit) do |task|
@ -17,11 +12,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"

View File

@ -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

View File

@ -1,36 +1,8 @@
# frozen_string_literal: true
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/devtools/unit"
require "hanami/validations"
require "hanami/validations/form"

25
spec/support/rspec.rb Normal file
View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
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