Refactor tests. (#1953)
This commit is contained in:
parent
293b8e7c3e
commit
1a37044281
|
@ -1,8 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem "webrick"
|
||||
gem "minitest", "~> 5.0"
|
||||
gem "minitest-global_expectations"
|
||||
gem "rake"
|
|
@ -1,62 +0,0 @@
|
|||
name: Development
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1, jruby, truffleruby-head]
|
||||
runs-on: ${{matrix.os}}
|
||||
env:
|
||||
BUNDLE_GEMFILE: .ci.gemfile
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{matrix.ruby}}
|
||||
bundler-cache: true
|
||||
|
||||
- name: Installing packages (ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: sudo apt-get install libfcgi-dev libmemcached-dev
|
||||
|
||||
- name: Installing packages (macos)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: brew install fcgi libmemcached
|
||||
|
||||
- run: bundle exec rake
|
||||
|
||||
external:
|
||||
needs: test
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
ruby: [2.6, 2.7]
|
||||
runs-on: ${{matrix.os}}
|
||||
env:
|
||||
BUNDLE_GEMFILE: .ci.gemfile
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{matrix.ruby}}
|
||||
bundler-cache: true
|
||||
|
||||
- name: Installing packages (ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: sudo apt-get install libmemcached-dev
|
||||
|
||||
- name: Installing packages (macos)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: brew install libmemcached
|
||||
|
||||
- run: bundle exec rake external
|
|
@ -0,0 +1,34 @@
|
|||
name: Test External
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
ruby: ['2.7', '3.0', '3.1']
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{matrix.ruby}}
|
||||
bundler-cache: true
|
||||
|
||||
- name: Installing packages (ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: sudo apt-get install libfcgi-dev libmemcached-dev
|
||||
|
||||
- name: Installing packages (macos)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: brew install fcgi libmemcached
|
||||
|
||||
- run: bundle exec bake test:external
|
|
@ -0,0 +1,37 @@
|
|||
name: Test
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
ruby:
|
||||
- '2.4'
|
||||
- '2.5'
|
||||
- '2.6'
|
||||
- '2.7'
|
||||
- '3.0'
|
||||
- '3.1'
|
||||
- jruby
|
||||
- truffleruby-head
|
||||
include:
|
||||
- os: macos-latest
|
||||
ruby: '3.1'
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{matrix.ruby}}
|
||||
bundler-cache: true
|
||||
|
||||
- run: bundle exec rake
|
5
Gemfile
5
Gemfile
|
@ -14,3 +14,8 @@ end
|
|||
group :doc do
|
||||
gem 'rdoc'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'minitest'
|
||||
gem 'bake-test-external'
|
||||
end
|
||||
|
|
27
Rakefile
27
Rakefile
|
@ -134,30 +134,3 @@ task rdoc: %w[changelog spec] do
|
|||
`git ls-files lib/\*\*/\*.rb`.strip.split)
|
||||
cp "contrib/rdoc.css", "doc/rdoc.css"
|
||||
end
|
||||
|
||||
def clone_and_test(url, name, command)
|
||||
path = "external/#{name}"
|
||||
FileUtils.rm_rf path
|
||||
FileUtils.mkdir_p path
|
||||
|
||||
sh("git clone #{url} #{path}")
|
||||
|
||||
# I tried using `bundle config --local local.async ../` but it simply doesn't work.
|
||||
File.open("#{path}/Gemfile", "a") do |file|
|
||||
file.puts("gem 'rack', path: '../../'")
|
||||
file.puts("gem 'rack-session', github: 'rack/rack-session'") if name == 'rack-attack'
|
||||
end
|
||||
|
||||
sh("cd #{path} && bundle install && #{command}")
|
||||
end
|
||||
|
||||
task :external do
|
||||
# In order not to interfere with external tests: rename our config file
|
||||
FileUtils.mv ".rubocop.yml", ".rack.rubocop.yml.disabled"
|
||||
|
||||
Bundler.with_clean_env do
|
||||
clone_and_test("https://github.com/rack/rack-attack", "rack-attack", "bundle exec rake test")
|
||||
clone_and_test("https://github.com/rack/rack-cache", "rack-cache", "bundle exec rake")
|
||||
clone_and_test("https://github.com/socketry/falcon", "falcon", "bundle exec rspec")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
protocol-rack:
|
||||
url: https://github.com/socketry/protocol-rack
|
||||
command: bundle exec bake test
|
Loading…
Reference in New Issue