Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and update 5-6-stable CI, two backports #3167

Merged
merged 4 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
82 changes: 58 additions & 24 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,22 @@ jobs:
- name: rubocop
run: bundle exec rake rubocop

# macOS MRI jobs
# 11 12 13
# 2.2 x
# 2.3 x
# 2.4 x x
# 2.5 x x
# 2.6 x x
# 2.7 x x
# 3.0 x
# 3.1 x
# 3.2 x x
# head x x

test_mri:
name: >-
MRI: ${{ matrix.os }} ${{ matrix.ruby }}${{ matrix.no-ssl }}${{ matrix.yjit }}
MRI: ${{ matrix.os }} ${{ matrix.ruby }}${{ matrix.no-ssl }}${{ matrix.yjit }}${{ matrix.rack-v }}
needs: rubocop
env:
CI: true
Expand All @@ -38,35 +51,47 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-18.04, macos-10.15, macos-11, windows-2022 ]
ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, head ]
os: [ ubuntu-20.04, macos-11, macos-12, macos-13, windows-2022 ]
ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, head ]
no-ssl: ['']
yjit: ['']
rack-v: ['']
include:
- { os: windows-2022 , ruby: ucrt }
- { os: windows-2022 , ruby: mswin }
- { os: windows-2022 , ruby: 2.7 , no-ssl: ' no SSL' }
- { os: ubuntu-20.04 , ruby: head , yjit: ' yjit' }
- { os: ubuntu-20.04 , ruby: 2.4 , rack-v: ' rack1' }
- { os: ubuntu-20.04 , ruby: 2.7 , no-ssl: ' no SSL' }
- { os: ubuntu-22.04 , ruby: 3.1 }
- { os: ubuntu-22.04 , ruby: 3.2 }
- { os: ubuntu-22.04 , ruby: head }
- { os: ubuntu-22.04 , ruby: head , yjit: ' yjit' }
- { os: windows-2022 , ruby: ucrt }
- { os: windows-2022 , ruby: mswin }
- { os: windows-2022 , ruby: 2.7 , no-ssl: ' no SSL' }

exclude:
- { os: ubuntu-20.04 , ruby: 2.2 }
- { os: ubuntu-20.04 , ruby: 2.3 }
- { os: macos-11 , ruby: 3.0 }
- { os: macos-11 , ruby: 3.1 }
- { os: macos-11 , ruby: head }
- { os: macos-12 , ruby: 2.2 }
- { os: macos-12 , ruby: 2.3 }
- { os: macos-12 , ruby: 2.6 }
- { os: macos-12 , ruby: 2.7 }
- { os: macos-12 , ruby: 3.0 }
- { os: macos-12 , ruby: 3.1 }
- { os: macos-12 , ruby: 3.2 }
- { os: macos-13 , ruby: 2.2 }
- { os: macos-13 , ruby: 2.3 }
- { os: macos-13 , ruby: 2.4 }
- { os: macos-13 , ruby: 2.5 }
- { os: windows-2022 , ruby: head }
- { os: macos-10.15 , ruby: 2.6 }
- { os: macos-10.15 , ruby: 2.7 }
- { os: macos-10.15 , ruby: '3.0'}
- { os: macos-10.15 , ruby: 3.1 }
- { os: macos-11 , ruby: 2.2 }
- { os: macos-11 , ruby: 2.3 }
- { os: macos-11 , ruby: 2.4 }

steps:
- name: repo checkout
uses: actions/checkout@v3

- name: Set Rack version, see Gemfile
shell: bash
run: echo 'PUMA_CI_RACK=${{ matrix.rack-v }}' >> $GITHUB_ENV

- name: load ruby
uses: ruby/setup-ruby-pkgs@v1
with:
Expand All @@ -80,18 +105,27 @@ jobs:

# Windows error thrown, doesn't affect CI
- name: update rubygems for Ruby 2.2
if: matrix.ruby < '2.3'
if: matrix.ruby == '2.2'
run: gem update --system 2.7.11 --no-document
continue-on-error: true
timeout-minutes: 5

# fixes 'has a bug that prevents `required_ruby_version`'
- name: update rubygems for Ruby 2.3 - 2.5
if: contains('2.3 2.4 2.5', matrix.ruby)
- name: update rubygems for Ruby 2.3
if: matrix.ruby == '2.3'
run: gem update --system 3.3.14 --no-document
continue-on-error: true
timeout-minutes: 5

# fixes 'has a bug that prevents `required_ruby_version`'
- name: update rubygems for Ruby 2.4 - 2.6
if: |
contains('2.4 2.5 2.6', matrix.ruby) &&
(needs.skip_duplicate_runs.outputs.should_skip != 'true')
run: gem update --system 3.3.26 --no-document
continue-on-error: true
timeout-minutes: 5

- name: Compile Puma without SSL support
if: matrix.no-ssl == ' no SSL'
shell: bash
Expand Down Expand Up @@ -132,12 +166,12 @@ jobs:
- { os: ubuntu-20.04 , ruby: jruby }
- { os: ubuntu-20.04 , ruby: jruby, no-ssl: ' no SSL' }
- { os: ubuntu-20.04 , ruby: jruby-head, allow-failure: true }
- { os: ubuntu-20.04 , ruby: truffleruby }
- { os: ubuntu-20.04 , ruby: truffleruby, allow-failure: true }
- { os: ubuntu-20.04 , ruby: truffleruby-head, allow-failure: true }
- { os: macos-10.15 , ruby: jruby }
- { os: macos-10.15 , ruby: truffleruby }
- { os: macos-11 , ruby: jruby }
- { os: macos-11 , ruby: truffleruby }
- { os: macos-11 , ruby: jruby }
- { os: macos-11 , ruby: truffleruby, allow-failure: true }
- { os: macos-12 , ruby: jruby }
- { os: macos-12 , ruby: truffleruby, allow-failure: true }

steps:
- name: repo checkout
Expand Down
17 changes: 15 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ gem "rake-compiler", "~> 1.1.1"

gem "json", "~> 2.3"
gem "nio4r", "~> 2.0"
gem "rack", ">= 1.6.13"

rack_vers =
case ENV.key?('PUMA_CI_RACK') && ENV['PUMA_CI_RACK'].strip
when 'rack1'
'~> 1.6'
else
'>= 2.1'
end

gem "rack", rack_vers, "< 3.0.0"

gem "minitest", "~> 5.11"
gem "minitest-retry"
gem "minitest-proveit"
Expand All @@ -16,7 +26,10 @@ gem "sd_notify"

gem "jruby-openssl", :platform => "jruby"

gem "rubocop", "~> 0.64.0"
unless ENV['PUMA_NO_RUBOCOP'] || RUBY_PLATFORM.include?('mswin')
gem "rubocop", "~> 0.64.0"
gem 'rubocop-performance', require: false
end

if %w(2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1).include? RUBY_VERSION
gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"]
Expand Down
17 changes: 10 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
require "bundler/setup"
require "rake/testtask"
require "rake/extensiontask"
require "rake/javaextensiontask"
require "rubocop/rake_task"
require 'bundler/setup'
require 'rake/testtask'
require 'rake/extensiontask'
require 'rake/javaextensiontask'
require_relative 'lib/puma/detect'
require 'rubygems/package_task'
require 'bundler/gem_tasks'

gemspec = Gem::Specification.load("puma.gemspec")
Gem::PackageTask.new(gemspec).define

# Add rubocop task
RuboCop::RakeTask.new
begin
# Add rubocop task
require "rubocop/rake_task"
RuboCop::RakeTask.new
rescue LoadError
end

# generate extension code using Ragel (C and Java)
desc "Generate extension code (C and Java) using Ragel"
Expand Down
2 changes: 1 addition & 1 deletion lib/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Puma
# not in minissl.rb
HAS_SSL = const_defined?(:MiniSSL, false) && MiniSSL.const_defined?(:Engine, false)

HAS_UNIX_SOCKET = Object.const_defined? :UNIXSocket
HAS_UNIX_SOCKET = Object.const_defined?(:UNIXSocket) && !IS_WINDOWS

if HAS_SSL
require 'puma/minissl'
Expand Down
2 changes: 1 addition & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def run
module TestSkips

HAS_FORK = ::Process.respond_to? :fork
UNIX_SKT_EXIST = Object.const_defined? :UNIXSocket
UNIX_SKT_EXIST = Object.const_defined?(:UNIXSocket) && !Puma::IS_WINDOWS

MSG_FORK = "Kernel.fork isn't available on #{RUBY_ENGINE} on #{RUBY_PLATFORM}"
MSG_UNIX = "UNIXSockets aren't available on the #{RUBY_PLATFORM} platform"
Expand Down
2 changes: 1 addition & 1 deletion test/test_integration_single.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_term_not_accepts_new_connections
rejected_curl_wait_thread.join

assert_match(/Slept 10/, curl_stdout.read)
assert_match(/Connection refused/, rejected_curl_stderr.read)
assert_match(/Connection refused|Couldn't connect to server/, rejected_curl_stderr.read)

Process.wait(@server.pid)
@server.close unless @server.closed?
Expand Down