This commit is contained in:
Luca Guidi 2019-06-21 17:38:00 +02:00 committed by GitHub
parent 9239c25b28
commit f3118d66a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 342 additions and 12 deletions

View File

@ -1,9 +1,301 @@
kind: pipeline
name: default
name: ruby-2-6
group: build
steps:
- name: test
image: ruby
- 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
- bundle exec rake
- name: unit
image: ruby:2.6
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: ruby:2.6
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: quality
image: ruby:2.6
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- 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: isolation
image: ruby:2.5
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: quality
image: ruby:2.5
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: ruby-2-4
group: build
steps:
- name: install
image: ruby:2.4
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: ruby:2.4
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: ruby:2.4
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: quality
image: ruby:2.4
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: ruby-2-3
group: build
steps:
- name: install
image: ruby:2.3
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: ruby:2.3
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: ruby:2.3
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: quality
image: ruby:2.3
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: jruby-9-2
group: build
steps:
- name: install
image: 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: jruby:9.2
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: quality
image: jruby:9.2
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: jruby-9-1
group: build
steps:
- name: install
image: jruby:9.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: jruby:9.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: jruby:9.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: quality
image: jruby:9.1
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: slack
group: build
clone:
disable: true
depends_on:
- jruby-9-1
steps:
- name: slack
image: plugins/slack
settings:
link_names: true
webhook:
from_secret: slack
channel: dev
when:
event:
- push

35
script/test Executable file
View File

@ -0,0 +1,35 @@
#!/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
printf "\n\n\nRunning: $test\n"
COVERAGE=true ruby $test --options $root/.rspec
}
main() {
local type=$1
run_tests $type
}
main $1

View File

@ -516,6 +516,8 @@ RSpec.describe Hanami::Logger do
it 'colorizes when for tty by default (i.e. when colorizer: nil)' do
stdout = IO.new($stdout.fileno)
skip unless stdout.tty?
expect(stdout).to receive(:write).with(
"[\e[34mhanami\e[0m] [\e[35mINFO\e[0m] [\e[36m2017-01-15 16:00:23 +0100\e[0m] foo\n"
)
@ -525,6 +527,8 @@ RSpec.describe Hanami::Logger do
it 'colorizes for tty when colorizer: nil' do
stdout = IO.new($stdout.fileno)
skip unless stdout.tty?
expect(stdout).to receive(:write).with(
"[\e[34mhanami\e[0m] [\e[35mINFO\e[0m] [\e[36m2017-01-15 16:00:23 +0100\e[0m] foo\n"
)

View File

@ -22,14 +22,8 @@ end
RSpec.describe Hanami::Utils::Deprecation do
it 'prints a deprecation warning for direct call' do
stack = if Hanami::Utils.jruby?
"#{__FILE__}:31:in `block in (root)'"
else
"#{__FILE__}:31:in `block (3 levels) in <top (required)>'"
end
expect { DeprecationTest.new.old_method }
.to output(include("old_method is deprecated, please use new_method - called from: #{stack}.")).to_stderr
.to output(include("old_method is deprecated, please use new_method - called from: #{__FILE__}:25")).to_stderr
end
it 'prints a deprecation warning for nested call' do

View File

@ -363,7 +363,12 @@ RSpec.describe Hanami::Utils::Escape do
end
it 'escapes a Time' do
time_string = Hanami::Utils.jruby? ? '2016-01-27 12:00:00 UTC' : '2016-01-27 12:00:00 +0000'
time_string = if Hanami::Utils.jruby? && JRUBY_VERSION.match(/\A9\.1/)
'2016-01-27 12:00:00 UTC'
else
'2016-01-27 12:00:00 +0000'
end
result = mod.html(Time.new(2016, 0o1, 27, 12, 0, 0, 0))
expect(result).to eq time_string
end