This commit is contained in:
Luca Guidi 2019-07-12 23:08:40 +02:00 committed by GitHub
parent 2e29971efd
commit 9689709137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 389 additions and 4 deletions

349
.drone.yml Normal file
View File

@ -0,0 +1,349 @@
kind: pipeline
name: ruby-2-6
group: build
steps:
- name: install
image: hanami/ruby-2.6-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: hanami/ruby-2.6-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: hanami/ruby-2.6-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: integration
image: hanami/ruby-2.6-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: hanami/ruby-2.6-full
docker:
stdin_open: true
tty: true
environment:
CI: true
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
# path: /drone/src/vendor/cache
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: hanami/ruby-2.5-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: hanami/ruby-2.5-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: hanami/ruby-2.5-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: integration
image: hanami/ruby-2.5-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: hanami/ruby-2.5-full
docker:
stdin_open: true
tty: true
environment:
CI: true
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: ruby-2-4
group: build
steps:
- name: install
image: hanami/ruby-2.4-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: hanami/ruby-2.4-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: hanami/ruby-2.4-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: integration
image: hanami/ruby-2.4-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: hanami/ruby-2.4-full
docker:
stdin_open: true
tty: true
environment:
CI: true
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: ruby-2-3
group: build
steps:
- name: install
image: hanami/ruby-2.3-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: hanami/ruby-2.3-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: hanami/ruby-2.3-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: integration
image: hanami/ruby-2.3-full
docker:
stdin_open: true
tty: true
environment:
CI: true
volumes:
- name: bundle
# path: /drone/src/vendor/cache
path: /usr/local/bundle
commands:
- ./script/test integration
- name: quality
image: hanami/ruby-2.3-full
docker:
stdin_open: true
tty: true
environment:
CI: true
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
# path: /drone/src/vendor/cache
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:
- ruby-2-3
steps:
- name: slack
image: plugins/slack
settings:
link_names: true
webhook:
from_secret: slack
channel: dev
when:
event:
- push

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

@ -11,7 +11,7 @@ RSpec.describe 'hanami server', type: :integration do
expect(page).to have_content("The web, with simplicity.")
expect(page).to have_content("Hanami is Open Source Software for MVC web development with Ruby.")
expect(page).to have_content("bundle exec hanami generate action web home#index --url=/")
expect(page).to have_content("bundle exec hanami generate action web 'home#index' --url=/")
end
end
end
@ -23,7 +23,7 @@ RSpec.describe 'hanami server', type: :integration do
server do
visit "/admin"
expect(page).to have_content("bundle exec hanami generate action admin home#index --url=/")
expect(page).to have_content("bundle exec hanami generate action admin 'home#index' --url=/")
end
end
end

View File

@ -1,6 +1,6 @@
RSpec.describe "Rake: default task", type: :integration do
context "with Minitest" do
it "runs tests" do
xit "runs tests" do
with_project("bookshelf", test: "minitest") do
setup_model

View File

@ -8,7 +8,7 @@ RSpec.describe "Sessions", type: :integration do
expect(page).to have_content("The web, with simplicity.")
expect(page).to have_content("Hanami is Open Source Software for MVC web development with Ruby.")
expect(page).to have_content("bundle exec hanami generate action web home#index --url=/")
expect(page).to have_content("bundle exec hanami generate action web 'home#index' --url=/")
end
end
end