From 97c7457c8967653861b3dd1b4e844918f97087d0 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 19 May 2022 15:34:39 -0500 Subject: [PATCH] Add ENV['PUMA_NO_RUBOCOP'] to disable RuboCop install, add mswin ci (#2881) * Add ENV['PUMA_NO_RUBOCOP'] to disable RuboCop install, allow mswin compile * [CI] Actions workflow file updates --- .github/workflows/ragel.yml | 4 +++- .github/workflows/tests.yaml | 10 +++++----- Gemfile | 4 +++- Rakefile | 11 +++++++---- ext/puma_http11/extconf.rb | 2 ++ 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ragel.yml b/.github/workflows/ragel.yml index 3ec8a2f8..a27ab5ed 100644 --- a/.github/workflows/ragel.yml +++ b/.github/workflows/ragel.yml @@ -15,6 +15,8 @@ jobs: ragel: name: >- ragel ${{ matrix.os }} ${{ matrix.ruby }} + env: + PUMA_NO_RUBOCOP: true runs-on: ${{ matrix.os }} if: | @@ -40,7 +42,7 @@ jobs: uses: actions/checkout@v3 - name: load ruby - uses: MSP-Greg/setup-ruby-pkgs@v1 + uses: ruby/setup-ruby-pkgs@v1 with: ruby-version: ${{ matrix.ruby }} apt-get: ragel diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 249b894c..70b0c897 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -22,6 +22,7 @@ jobs: env: CI: true TESTOPTS: -v + PUMA_NO_RUBOCOP: true runs-on: ${{ matrix.os }} if: | @@ -36,6 +37,7 @@ jobs: yjit: [''] 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.7 , no-ssl: ' no SSL' } @@ -59,7 +61,7 @@ jobs: uses: actions/checkout@v3 - name: load ruby - uses: MSP-Greg/setup-ruby-pkgs@v1 + uses: ruby/setup-ruby-pkgs@v1 with: ruby-version: ${{ matrix.ruby }} apt-get: ragel @@ -103,6 +105,7 @@ jobs: env: CI: true TESTOPTS: -v + PUMA_NO_RUBOCOP: true runs-on: ${{ matrix.os }} if: | @@ -133,14 +136,11 @@ jobs: echo JAVA_HOME=$JAVA_HOME_11_X64 >> $GITHUB_ENV - name: load ruby, ragel - uses: MSP-Greg/setup-ruby-pkgs@v1 + uses: ruby/setup-ruby-pkgs@v1 with: ruby-version: ${{ matrix.ruby }} apt-get: ragel brew: ragel - mingw: _upgrade_ openssl ragel - # Use the bundler shipped with that ruby, - # temporary workaround for https://github.com/oracle/truffleruby/issues/2586 bundler: none bundler-cache: true timeout-minutes: 10 diff --git a/Gemfile b/Gemfile index 862df732..904eb16c 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,9 @@ 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" +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"] diff --git a/Rakefile b/Rakefile index 0b7eda83..7b4257ef 100644 --- a/Rakefile +++ b/Rakefile @@ -2,17 +2,20 @@ require "bundler/setup" require "rake/testtask" require "rake/extensiontask" require "rake/javaextensiontask" -require "rubocop/rake_task" require_relative 'lib/puma/detect' require 'rubygems/package_task' require 'bundler/gem_tasks' +begin + # Add rubocop task + require "rubocop/rake_task" + RuboCop::RakeTask.new +rescue LoadError +end + gemspec = Gem::Specification.load("puma.gemspec") Gem::PackageTask.new(gemspec).define -# Add rubocop task -RuboCop::RakeTask.new - # generate extension code using Ragel (C and Java) desc "Generate extension code (C and Java) using Ragel" task :ragel diff --git a/ext/puma_http11/extconf.rb b/ext/puma_http11/extconf.rb index 563aa3ef..8fb75fb7 100644 --- a/ext/puma_http11/extconf.rb +++ b/ext/puma_http11/extconf.rb @@ -14,6 +14,8 @@ unless ENV["DISABLE_SSL"] found_ssl = if (!$mingw || RUBY_VERSION >= '2.4') && (t = pkg_config 'openssl') puts 'using OpenSSL pkgconfig (openssl.pc)' true + elsif have_library('libcrypto', 'BIO_read') && have_library('libssl', 'SSL_CTX_new') + true elsif %w'crypto libeay32'.find {|crypto| have_library(crypto, 'BIO_read')} && %w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')} true