From a31a62656d22aad96ad385467aaa755e2b44a455 Mon Sep 17 00:00:00 2001 From: Nikolay Vashchenko Date: Thu, 27 Jul 2017 21:18:58 +0300 Subject: [PATCH] Appveyor CI (#1374) * appveyour config * proper platforms for windows * disabling tests with ssl and interrupts * excessive ssl setup * fixed message * adding info in readme regarding stopgap_13632 * formatting * trailing spaces --- Gemfile | 2 +- README.md | 23 +++++++++++++++++++++++ appveyor.yml | 29 +++++++++++++++++++++++++++++ test/helper.rb | 4 ++++ test/test_binder.rb | 1 + test/test_integration.rb | 1 + test/test_rack_handler.rb | 1 + 7 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 appveyor.yml diff --git a/Gemfile b/Gemfile index 3ac4e742..d333d5e8 100644 --- a/Gemfile +++ b/Gemfile @@ -16,5 +16,5 @@ gem "jruby-openssl", :platform => "jruby" gem "rubocop", "~> 0.49.1" if %w(2.2.7 2.3.4 2.4.1).include? RUBY_VERSION - gem "stopgap_13632", "~> 1.0", :platform => "mri" + gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"] end diff --git a/README.md b/README.md index a52b7ae9..9270c7b3 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,29 @@ reliability in production environments: * [tools/jungle](https://github.com/puma/puma/tree/master/tools/jungle) for sysvinit (init.d) and upstart * [docs/systemd](https://github.com/puma/puma/blob/master/docs/systemd.md) +## Known bugs +For MRI versions 2.2.7, 2.3.4 and 2.4.1 you may start erratically get the following exception in places where it should not happen: +```ruby +stream closed in another thread (IOError) +``` +If that's the case then it might be caused by ruby bug https://bugs.ruby-lang.org/issues/13632 and it could be temporary fixed with the gem https://rubygems.org/gems/stopgap_13632. +Add to gemfile: +``` +if %w(2.2.7 2.3.4 2.4.1).include? RUBY_VERSION + gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"] +end +``` +Don't forget to require it: +``` +require 'stopgap_13632' +``` +And when an "IOError: stream closed" happens in a thread, accessing a busy IO, catch it and call the following method: +``` +rescue IOError + Thread.current.purge_interrupt_queue +end +``` + ## Capistrano deployment Puma has support for Capistrano3 with an [external gem](https://github.com/seuros/capistrano-puma), you just need require that in Gemfile: diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..0e06251b --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,29 @@ +install: + - set PATH=C:\MinGW\bin;C:\Ruby%ruby_version%\bin;%PATH% + - set RAKEOPT=-rdevkit + - set DISABLE_SSL=true + - set APPVEYOR=true + - ruby --version + - gem --version + - bundle --version + - bundle install + +test_script: + - bundle exec rake + +environment: + matrix: + - ruby_version: "24" + - ruby_version: "24-x64" + - ruby_version: "23" + - ruby_version: "23-x64" + - ruby_version: "22" + - ruby_version: "22-x64" + - ruby_version: "21" + - ruby_version: "21-x64" + +branches: + only: + - master + +build: off diff --git a/test/helper.rb b/test/helper.rb index 6f8d3be5..7576c9ee 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -57,6 +57,10 @@ module SkipTestsBasedOnRubyEngine def skip_on_jruby skip "Skipped on JRuby" if Puma.jruby? end + + def skip_on_appveyor + skip "Skipped on Appveyor" if ENV["APPVEYOR"] + end end Minitest::Test.include SkipTestsBasedOnRubyEngine diff --git a/test/test_binder.rb b/test/test_binder.rb index 246c9c4d..81b2f0cb 100644 --- a/test/test_binder.rb +++ b/test/test_binder.rb @@ -19,6 +19,7 @@ class TestBinder < Minitest::Test end def test_localhost_addresses_dont_alter_listeners_for_ssl_addresses + skip_on_appveyor skip_on_jruby key = File.expand_path "../../examples/puma/puma_keypair.pem", __FILE__ diff --git a/test/test_integration.rb b/test/test_integration.rb index e443366b..e431381e 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -54,6 +54,7 @@ class TestIntegration < Minitest::Test end def restart_server_and_listen(argv) + skip_on_appveyor server(argv) s = connect initial_reply = read_body(s) diff --git a/test/test_rack_handler.rb b/test/test_rack_handler.rb index 79a790cc..73809cb1 100644 --- a/test/test_rack_handler.rb +++ b/test/test_rack_handler.rb @@ -48,6 +48,7 @@ class TestPathHandler < Minitest::Test def test_handler_boots + skip_on_appveyor in_handler(app) do |launcher| hit(["http://0.0.0.0:#{ launcher.connected_port }/test"]) assert_equal("/test", @input["PATH_INFO"])