Official support for Ruby 2.7 (#153)

This commit is contained in:
Luca Guidi 2020-02-02 17:28:58 +01:00 committed by GitHub
parent 931133fafa
commit 84d7ce653a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 281 additions and 37 deletions

View File

@ -7,7 +7,7 @@ jobs:
"ruby-2.3":
docker:
- image: hanami/ruby-2.3
working_directory: ~/hanami-utils
working_directory: ~/hanami-helpers
steps:
- checkout
# Download and cache dependencies
@ -32,7 +32,7 @@ jobs:
"ruby-2.4":
docker:
- image: hanami/ruby-2.4
working_directory: ~/hanami-utils
working_directory: ~/hanami-helpers
steps:
- checkout
# Download and cache dependencies
@ -57,7 +57,7 @@ jobs:
"ruby-2.5":
docker:
- image: hanami/ruby-2.5
working_directory: ~/hanami-utils
working_directory: ~/hanami-helpers
steps:
- checkout
# Download and cache dependencies
@ -82,7 +82,32 @@ jobs:
"ruby-2.6":
docker:
- image: hanami/ruby-2.6
working_directory: ~/hanami-utils
working_directory: ~/hanami-helpers
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.7":
docker:
- image: hanami/ruby-2.7
working_directory: ~/hanami-helpers
steps:
- checkout
# Download and cache dependencies
@ -107,7 +132,7 @@ jobs:
"jruby-9.1":
docker:
- image: hanami/jruby-9.1
working_directory: ~/hanami-utils
working_directory: ~/hanami-helpers
steps:
- checkout
# Download and cache dependencies
@ -132,7 +157,7 @@ jobs:
"jruby-9.2":
docker:
- image: hanami/jruby-9.2
working_directory: ~/hanami-utils
working_directory: ~/hanami-helpers
steps:
- checkout
# Download and cache dependencies
@ -163,5 +188,6 @@ workflows:
- "ruby-2.4"
- "ruby-2.5"
- "ruby-2.6"
- "ruby-2.7"
- "jruby-9.1"
- "jruby-9.2"

209
.drone.yml Normal file
View File

@ -0,0 +1,209 @@
kind: pipeline
name: ruby-2-7
group: build
steps:
- name: install
image: ruby:2.7
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: ruby:2.7
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: integration
image: ruby:2.7
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: ruby:2.7
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: ruby-2-6
group: build
steps:
- name: install
image: ruby:2.6
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: ruby:2.6
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: integration
image: ruby:2.6
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: ruby:2.6
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: ruby-2-5
group: build
steps:
- name: install
image: ruby:2.5
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: ruby:2.5
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: integration
image: ruby:2.5
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: ruby:2.5
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: jruby-9-2
group: build
steps:
- name: install
image: hanami/jruby-9.2
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: hanami/jruby-9.2
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: integration
image: hanami/jruby-9.2
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: hanami/jruby-9.2
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: slack
group: build
clone:
disable: true
depends_on:
- jruby-9-2
steps:
- name: slack
image: plugins/slack
settings:
link_names: true
webhook:
from_secret: slack
channel: dev
when:
event:
- push

View File

@ -1,28 +0,0 @@
language: ruby
sudo: false
cache: bundler
before_script:
- gem update --system
script: ./script/ci
rvm:
- 2.3.8
- 2.4.5
- 2.5.3
- 2.6.0
- jruby-9.1.9.0
- ruby-head
- jruby-head
matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: jruby-9.1.9.0
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/fde2367248d53de4fe70
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always

View File

@ -6,6 +6,7 @@ View helpers for Ruby applications
[![Gem Version](https://badge.fury.io/rb/hanami-helpers.svg)](https://badge.fury.io/rb/hanami-helpers)
[![TravisCI](https://travis-ci.org/hanami/helpers.svg?branch=master)](https://travis-ci.org/hanami/helpers)
[![Build Status](https://ci.hanamirb.org/api/badges/hanami/helpers/status.svg)](https://ci.hanamirb.org/hanami/helpers)
[![CircleCI](https://circleci.com/gh/hanami/helpers/tree/master.svg?style=svg)](https://circleci.com/gh/hanami/helpers/tree/master)
[![Test Coverage](https://codecov.io/gh/hanami/helpers/branch/master/graph/badge.svg)](https://codecov.io/gh/hanami/helpers)
[![Depfu](https://badges.depfu.com/badges/7b30c5d2a2a78954e2ad86e5c7230c23/overview.svg)](https://depfu.com/github/hanami/helpers?project=Bundler)

36
script/test Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
run_tests() {
local type=$1
local pwd=$PWD
local root="$pwd/spec/$type"
for test in $(find $root -name '*_spec.rb')
do
run_test $root $test
if [ $? -ne 0 ]; then
local exit_code=$?
echo "Failing test: $test"
exit $exit_code
fi
done
}
run_test() {
local root=$1
local test=$2
local hash="$(shasum "$test" | cut -b 1-40)"
printf "\n\n\nRunning: $test\n"
SIMPLECOV_COMMAND_NAME=$hash bundle exec rspec $test
}
main() {
local type=$1
run_tests $type
}
main $1

View File

@ -109,7 +109,7 @@ RSpec.describe 'Form helper' do
@params = BillParams.new({})
@session = Session.new(_csrf_token: 's14')
@actual = FullStack::Views::Bills::Edit.render(format: :html, bill: @bill, params: @params, session: @session)
@actual = FullStack::Views::Bills::Edit.render(format: :html, bill: @bill, params: @params, session: @session)
end
it 'renders the form' do
@ -125,7 +125,7 @@ RSpec.describe 'Form helper' do
@params = BillParams.new(bill: { addresses: [{ street: 'Mulholland Drive' }, { street: 'Quaint Edge' }] })
@session = Session.new(_csrf_token: 's14')
@actual = FullStack::Views::Bills::Edit.render(format: :html, bill: @bill, params: @params, session: @session)
@actual = FullStack::Views::Bills::Edit.render(format: :html, bill: @bill, params: @params, session: @session)
end
it 'renders the form' do
@ -141,7 +141,7 @@ RSpec.describe 'Form helper' do
@params = BillParams.new({})
@session = Session.new(_csrf_token: 's14')
@actual = FullStack::Views::Bills::Edit2.render(format: :html, bill: @bill, params: @params, session: @session)
@actual = FullStack::Views::Bills::Edit2.render(format: :html, bill: @bill, params: @params, session: @session)
end
it 'renders the form' do