From a94d6ed25596b35520f3f962dac6f2e39cec81cf Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Wed, 3 Jan 2024 19:11:37 -0800 Subject: [PATCH] Fix failing specs and replace TravisCI with GitHub Actions (#357) * Fix failing specs * Add GitHub Actions CI workflow * Remove TravisCI * Replace TravisCI badge with GitHub Actions * An older Ubuntu is needed for Ruby 2.2 * Adopt fix proposed by #356 --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++ .travis.yml | 7 ------ README.md | 3 ++- lib/em-http/http_connection.rb | 1 + spec/external_spec.rb | 3 +-- spec/ssl_spec.rb | 2 +- 6 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2ebaf596 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI +on: + pull_request: + push: + branches: + - master +jobs: + spec: + name: "RSpec / Ruby ${{ matrix.ruby }}" + runs-on: ubuntu-latest + strategy: + matrix: + ruby: + [ + "2.3", + "2.4", + "2.5", + "2.6", + "2.7", + "3.0", + "3.1", + "3.2" + ] + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: bundle exec rake spec + spec-legacy: + name: "RSpec / Ruby 2.2" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.2 + bundler-cache: true + - name: rake spec + run: bundle exec rake spec diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c1fd50b9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: ruby -rvm: - - 2.2.4 -script: bundle exec rake spec -notifications: - email: - - ilya@igvita.com \ No newline at end of file diff --git a/README.md b/README.md index fba5e601..71c349d5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # EM-HTTP-Request -[![Gem Version](https://badge.fury.io/rb/em-http-request.svg)](http://rubygems.org/gems/em-http-request) [![Build Status](https://travis-ci.org/igrigorik/em-http-request.svg)](https://travis-ci.org/igrigorik/em-http-request) +[![Gem Version](https://badge.fury.io/rb/em-http-request.svg)](http://rubygems.org/gems/em-http-request) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/igrigorik/em-http-request/ci.yml)](https://github.com/igrigorik/em-http-request/actions/workflows/ci.yml) Async (EventMachine) HTTP client, with support for: diff --git a/lib/em-http/http_connection.rb b/lib/em-http/http_connection.rb index 755a0427..d25c6d86 100644 --- a/lib/em-http/http_connection.rb +++ b/lib/em-http/http_connection.rb @@ -190,6 +190,7 @@ def post_init # the connection because we're processing invalid HTTP @p.reset! unbind + :stop end end diff --git a/spec/external_spec.rb b/spec/external_spec.rb index 40b21f4b..ec609c73 100644 --- a/spec/external_spec.rb +++ b/spec/external_spec.rb @@ -80,11 +80,10 @@ end it "should detect deflate encoding" do - # pending "need an endpoint which supports deflate.. MSN is no longer" EventMachine.run { options = {:head => {"accept-encoding" => "deflate"}, :redirects => 5} - http = EventMachine::HttpRequest.new('http://www.libpng.org/').get options + http = EventMachine::HttpRequest.new('https://www.bing.com/').get options http.errback { failed(http) } http.callback { diff --git a/spec/ssl_spec.rb b/spec/ssl_spec.rb index 9465a0c0..ce59be5f 100644 --- a/spec/ssl_spec.rb +++ b/spec/ssl_spec.rb @@ -9,7 +9,7 @@ http.errback { failed(http) } http.callback { - http.response_header.status.should == 302 + http.response_header.status.should == 301 EventMachine.stop } }