Skip to content

Commit

Permalink
Merge pull request #227 from ioquatix/add-development-workflow
Browse files Browse the repository at this point in the history
CI: Add development Workflow for testing using GitHub Actions
  • Loading branch information
olleolleolle authored Oct 5, 2021
2 parents 497a304 + a8a8b33 commit 91f5898
Show file tree
Hide file tree
Showing 20 changed files with 120 additions and 76 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Development

on: [push, pull_request]

jobs:
test:
name: ${{matrix.ruby}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
continue-on-error: ${{matrix.experimental}}

strategy:
matrix:
os:
- ubuntu

ruby:
- "2.6"
- "2.7"
- "3.0"

experimental: [false]
env: [""]

include:
- os: ubuntu
ruby: truffleruby
experimental: true
- os: ubuntu
ruby: jruby
experimental: true
- os: ubuntu
ruby: head
experimental: true

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt-get install libcurl4-openssl-dev

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true

- name: Run tests
timeout-minutes: 5
run: ${{matrix.env}} bundle exec rspec
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

14 changes: 8 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ gemspec

gem 'jruby-openssl', :platforms => :jruby

# compatibility restrictions for http clients under existing travis test environments
gem 'public_suffix', '~> 2.0' # or remove rubies < 2.1 from travis.yml
gem 'public_suffix', '~> 4.0'

# http clients
gem 'httpclient', '~> 2.3', :require => false
gem 'curb', '~> 0.8', :require => false, :platforms => :ruby
gem 'em-http-request', :require => false, :platforms => [:ruby, :jruby]
gem 'curb', '~> 0.8', :require => false, :platforms => [:ruby]
gem 'em-http-request', :require => false, :platforms => [:ruby]
gem 'em-synchrony', :require => false, :platforms => [:ruby, :jruby]
gem 'excon', '~> 0.21', :require => false, :platforms => [:ruby, :jruby]
gem 'net-http-persistent', '~> 2.8', :require => false
gem 'net-http-persistent', '~> 4.0', :require => false
gem 'http', :require => false

# adapter extensions
gem 'rack'
gem 'socksify'

# coverage
gem 'simplecov', :require => false
gem 'coveralls_reborn', :require => false
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ A common interface for Ruby's HTTP libraries.
[Documentation](https://www.rubydoc.info/gems/httpi) |
[Mailing list](https://groups.google.com/forum/#!forum/httpirb)

[![Build Status](https://secure.travis-ci.org/savonrb/httpi.svg?branch=master)](http://travis-ci.org/savonrb/httpi)
[![Gem Version](https://badge.fury.io/rb/httpi.svg)](http://badge.fury.io/rb/httpi)
[![Code Climate](https://codeclimate.com/github/savonrb/httpi.svg)](https://codeclimate.com/github/savonrb/httpi)
[![Coverage Status](https://coveralls.io/repos/savonrb/httpi/badge.svg?branch=master)](https://coveralls.io/r/savonrb/httpi)

[![Development Status](https://github.com/savon/httpi/workflows/Development/badge.svg)](https://github.com/savon/httpi/actions?workflow=Development)

## Installation

Expand All @@ -28,7 +24,6 @@ gem 'httpi', '~> 2.1.0'

## Usage example


``` ruby
require "httpi"

Expand Down
7 changes: 4 additions & 3 deletions httpi.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ Gem::Specification.new do |s|
s.homepage = "http://github.com/savonrb/#{s.name}"
s.summary = "Common interface for Ruby's HTTP libraries"
s.description = s.summary
s.required_ruby_version = '>= 1.9.2'

s.required_ruby_version = '>= 2.3'

s.license = 'MIT'

s.add_dependency 'rack'
s.add_dependency 'socksify'

s.add_development_dependency 'rubyntlm', '~> 0.3.2'
s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'rspec', '~> 3.5'
s.add_development_dependency 'mocha', '~> 0.13'
s.add_development_dependency 'puma', '~> 2.3.2'
s.add_development_dependency 'puma', '~> 5.0'
s.add_development_dependency 'webmock'

s.files = `git ls-files`.split("\n")
Expand Down
32 changes: 18 additions & 14 deletions spec/fixtures/client_cert.pem
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
-----BEGIN CERTIFICATE-----
MIICbTCCAdYCCQDC4v8d04615DANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJE
RTEQMA4GA1UECBMHSGFtYnVyZzEQMA4GA1UEBxMHSGFtYnVyZzEOMAwGA1UEChMF
aHR0cGkxFDASBgNVBAMTC2V4YW1wbGUuY29tMSIwIAYJKoZIhvcNAQkBFhNleGFt
cGxlQGV4YW1wbGUuY29tMB4XDTEwMTAxNTE4NTg0N1oXDTExMTAxNTE4NTg0N1ow
ezELMAkGA1UEBhMCREUxEDAOBgNVBAgTB0hhbWJ1cmcxEDAOBgNVBAcTB0hhbWJ1
cmcxDjAMBgNVBAoTBWh0dHBpMRQwEgYDVQQDEwtleGFtcGxlLmNvbTEiMCAGCSqG
SIb3DQEJARYTZXhhbXBsZUBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOB
jQAwgYkCgYEAvJiaojIFQAbFczXkBmjxpxra9LbQm0VIESFSl8uBSjmG/gmCBwKg
8O94P3tAjDNClC+fEqBLE37KH4qe76yw7upgRruP5jQzUEL1yCaVtA/DoqgaCxZy
7VhB2A3f71Zw6kQPt3BOME68fnGsTX65x9XAawCGzGmJSk/Z6wvml1MCAwEAATAN
BgkqhkiG9w0BAQUFAAOBgQCxOyni9LOKf17vUKVG8Y4TBzRYwm8/hlEdVEU3JKG0
/aCCwIJLHl+z+3L4r81IN3+YKrHilqx9K0emboJbBRQklYsv/AE+J44Bq3llRiro
0e5zwH61jb1j+kxhcxoGiiy8R7hYho24ljuMgFGqtK3kZSP/t9tBLLVp+ItWQ6xX
5g==
MIIDVTCCAj2gAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQKDBhEZXZl
bG9wbWVudC9DTj1sb2NhbGhvc3QwHhcNMTgwODEwMDAzMTQzWhcNMjgwODA3MD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pem
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQC8mJqiMgVABsVzNeQGaPGnGtr0ttCbRUgRIVKXy4FKOYb+CYIH
AqDw73g/e0CMM0KUL58SoEsTfsofip7vrLDu6mBGu4/mNDNQQvXIJpW0D8OiqBoL
FnLtWEHYDd/vVnDqRA+3cE4wTrx+caxNfrnH1cBrAIbMaYlKT9nrC+aXUwIDAQAB
AoGBAKjrGh1KJg+pwPInA5yGJGMil5h1obRgwmKtcPeKi7u6eOFSDMdQoGwMYKyj
LTYlt21Yleat8XB9sHW9yAstpq5dU8Id2A4wfbJeaBYpek7u5+QwBENO4UrnulTk
W0d+jECBVYECn8wCStxfoFcQQRhlGrsOn05379cD8e1odMOJAkEA3o/7CsgXqahG
7L1HaWYtKnpFfTS+EQgdGvSahOolByAKTtMA2TUBU1FdlCk+ggWBGorqmWON5Qnm
7UDHjOasZQJBANjuPOqa9ubqHccGwHec+72pQz6q5e8f1gf1XPn7EEuXsBzYiMMH
qEa8zpfF0TmhQ0oWN75Cq709gfVVBfx/bVcCQHan1HN/Ef6FlKqKjxQGQXYwEfQa
tmpmJP5GAktyeaM+1cAIhp9GvxooeveOtaCkRpxcC48ToIbHrLI4oyrfoHECQQC6
bAHtmz6TMp5ka2j7Yez1EIC5WiQ/WxyTukgsi5V1YOX35B2jfPEf2SGxTE6BOBSb
lnxRBPqRpkoIiwiZ9OgBAkBOWKBuHXmXM6wr+0p4KQ/DOeStZiBxUT8rYbX/i1BI
/9Xo48KNerTx7qoDK+jIslDrilahvcwUz0fuVV7rHy/X
MIIEpAIBAAKCAQEA21N74n1PaJk8eU+hArmJ768q+IljzwOLF4XbjvGg9yHQPMx5
T7WZ5odJYhN9JwGNNMSmuBIrMbPf1IFKB5RG+ZwrWLOjnfaY4rsq8thuZQRyIS5V
TU20XkSn44a93sFMXJ0DdMYsp437FDG86FSNWbBg1mfYBeAx4NwHHHnt/vwTQQ01
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CgYAmC2pGJciup46CjIrraAsKqJJsbbC8XETsvXNf
RTisYaQWC4DH1lDxQ7LpNhOjWL46Oqh+KlK+HJ956PJlltI0s7UDdOQkWrj4YpC7
xAT/DuY0T9YPuc7gPr+O1qIlj3ZH1smMxh6SChzfYJZ3BcsZ7CWCPWvZbQOmjHg2
cagKDQKBgQCjuICU3aElEXyGwPCEazVakgcuAuiAAjECQrHrbSVPaTDu6Cumupkw
50ypk/qJ3DegEumpufwLg37A9yFogkkHBI9Sw0PVjzXM0iWJsHceLTHWUgJBWcl3
5Sl/AacXbUHz4NMqARNVrfR3DP33Z/YXJ4bpsVswEjD51jPwwluwyA==
-----END RSA PRIVATE KEY-----
8 changes: 1 addition & 7 deletions spec/httpi/adapter/em_http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "httpi/adapter/em_http"
require "httpi/request"

begin
unless RUBY_PLATFORM =~ /java/
HTTPI::Adapter.load_adapter(:em_http)

describe HTTPI::Adapter::EmHttpRequest do
Expand Down Expand Up @@ -177,10 +177,4 @@ def http_message(body = Fixture.xml)
end

end
rescue LoadError => e
if e.message =~ /fiber/
warn "LoadError: #{e.message} (EventMachine requires fibers)"
else
raise e
end
end
2 changes: 1 addition & 1 deletion spec/httpi/adapter/httpclient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
end

it 'should set the ciphers if specified' do
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
ssl_config.expects(:ciphers=).with(request.auth.ssl.ciphers)

adapter.request(:get)
Expand Down
2 changes: 1 addition & 1 deletion spec/httpi/auth/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
end

context 'with ciphers' do
before { ssl.ciphers = OpenSSL::Cipher.ciphers }
before { ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers }

it { is_expected.to be_any.and(all(be_an_instance_of(String))) }
end
Expand Down
6 changes: 2 additions & 4 deletions spec/httpi/httpi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
require "net/http/persistent"
require "http"

unless RUBY_VERSION < "1.9"
unless RUBY_PLATFORM =~ /java/
require "em-synchrony"
require "em-http-request"
end
unless RUBY_PLATFORM =~ /java/
require "curb"
end

Expand Down Expand Up @@ -294,7 +292,7 @@
end

HTTPI::Adapter::ADAPTERS.each do |adapter, opts|
unless (adapter == :em_http && RUBY_VERSION =~ /1\.8/) || (adapter == :curb && RUBY_PLATFORM =~ /java/)
unless (adapter == :em_http || adapter == :curb) && RUBY_PLATFORM =~ /java/
client_class = {
:httpclient => lambda { HTTPClient },
:curb => lambda { Curl::Easy },
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/curb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/em_http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

describe HTTPI::Adapter::EmHttpRequest do

# em_http is not supported on ruby 1.8
unless RUBY_VERSION =~ /1\.8/
# em_http is not supported on java
unless RUBY_PLATFORM =~ /java/
require "em-synchrony"

subject(:adapter) { :em_http }
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/excon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/httpclient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
Expand Down
7 changes: 3 additions & 4 deletions spec/integration/net_http_persistent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

expect do
HTTPI.get(request, adapter)
end.to raise_exception(Net::HTTP::Persistent::Error, /Net::ReadTimeout/)
end.to raise_exception(Net::ReadTimeout)
end

it "executes GET requests" do
Expand Down Expand Up @@ -111,6 +111,7 @@
before :all do
@server = IntegrationServer.run(:ssl => true)
end

after :all do
@server.stop
end
Expand All @@ -125,11 +126,9 @@
end

it "works with ciphers" do
skip("Requires net-http-persistent 3.x") unless Net::HTTP::Persistent::VERSION.start_with? "3."

request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/net_http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
Expand Down
3 changes: 1 addition & 2 deletions spec/integration/support/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require "integration/support/application"

class IntegrationServer

def self.run(options = {})
server = new(options)
server.run
Expand Down Expand Up @@ -76,7 +75,7 @@ def ssl_context

context.key = IntegrationServer.ssl_key_file
context.cert = IntegrationServer.ssl_cert_file
context.verify_mode = Puma::MiniSSL::VERIFY_PEER
context.verify_mode = Puma::MiniSSL::VERIFY_NONE

context
end
Expand Down
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

unless RUBY_PLATFORM =~ /java/
require 'simplecov'
require 'coveralls'

SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start do
add_filter 'spec'
end
Expand Down

0 comments on commit 91f5898

Please sign in to comment.