Allow running with Rack 3. (#1811)

* Allow running with Rack 3.

* Pull in `rack-session` gem if needed.

* Try again.

* Use separate gemfiles for testing.

* Better test titles.

* Fix dependency on rack-test.

* Add rackup gem.

* Fix server registration.

* Update rack version constraints

Co-authored-by: Jordan Owens <jkowens@gmail.com>
This commit is contained in:
Samuel Williams 2022-12-23 11:58:28 -08:00 committed by GitHub
parent a81af47ec1
commit 2ccd0dc29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 15 deletions

View File

@ -11,29 +11,30 @@ permissions:
jobs:
test:
name: ${{ matrix.ruby }} (Rack ${{ matrix.rack }}, Puma ${{ matrix.puma }})
permissions:
contents: read # to fetch code (actions/checkout)
actions: read # to list jobs for workflow run (8398a7/action-slack)
name: ${{ matrix.ruby }} (Rack ${{ matrix.rack }}, Puma ${{ matrix.puma }})
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
puma:
- '~> 5' # Due to https://github.com/puma/puma/issues/3000
rack:
- stable
rack:
- '~> 2'
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: [2.6, 2.7, '3.0', 3.1, 'jruby-9.3', truffleruby, truffleruby-head]
include:
- { ruby: 3.1, rack: stable, puma: latest, allow-failure: true }
- { ruby: 3.1, rack: latest, allow-failure: true }
- { ruby: jruby-head, rack: stable, allow-failure: true }
- { ruby: 3.1, rack: stable, puma: stable, gemfile: gems/rack-v3.rb, allow-failure: true }
- { ruby: 3.1, rack: latest, puma: latest, gemfile: gems/rack-v3.rb, allow-failure: true }
- { ruby: jruby-head, rack: stable, puma: stable, gemfile: gems/rack-v3.rb, allow-failure: true }
env:
rack: ${{ matrix.rack }}
puma: ${{ matrix.puma }}
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- name: Install dependencies
run: |

View File

@ -24,7 +24,6 @@ puma_version = { github: 'puma/puma' } if puma_version == 'latest'
gem 'puma', puma_version
gem 'minitest', '~> 5.0'
gem 'rack-test', github: 'rack/rack-test'
gem 'rubocop', '~> 1.32.0', require: false
gem 'yard'

4
gems/rack-v3.rb Normal file
View File

@ -0,0 +1,4 @@
eval_gemfile("../Gemfile")
gem "rackup"
gem "rack-session"

View File

@ -13,5 +13,3 @@ gem 'rack', rack_version
gem 'sinatra', path: '..'
gemspec
gem 'rack-test', github: 'rack/rack-test'

View File

@ -6,8 +6,6 @@ gemspec
gem 'rack-protection', path: '../rack-protection'
gem 'sinatra', path: '..'
gem 'rack-test', github: 'rack/rack-test'
group :development, :test do
platform :jruby do
gem 'json'
@ -38,6 +36,6 @@ repos = { 'tilt' => 'rtomayko/tilt', 'rack' => 'rack/rack' }
%w[tilt rack].each do |lib|
dep = (ENV[lib] || 'stable').sub "#{lib}-", ''
dep = nil if dep == 'stable'
dep = { github: repos[lib], branch: dep } if dep && dep !~ (/(\d+\.)+\d+/)
dep = { github: repos[lib], branch: dep } if dep && dep !~ (/(\d+\.?)+(\d+)?/)
gem lib, dep if dep
end

View File

@ -46,7 +46,7 @@ RubyGems 2.0 or newer is required to protect against public gem pushes. You can
s.required_ruby_version = '>= 2.6.0'
s.add_dependency 'mustermann', '~> 3.0'
s.add_dependency 'rack', '~> 2.2', '>= 2.2.4'
s.add_dependency 'rack', '>= 2.2.4', '< 4'
s.add_dependency 'rack-protection', version
s.add_dependency 'tilt', '~> 2.0'

View File

@ -24,7 +24,7 @@ module Rack::Handler
end
end
register 'mock', 'Rack::Handler::Mock'
register :mock, Mock
end
class ServerTest < Minitest::Test