Skip to content

Commit

Permalink
Add Rails 7.1 to CI and fix compatibility issue with DebugExceptions#…
Browse files Browse the repository at this point in the history
…render_exception (#1132)

* add rails 7.1 to ci

* fix: handle new argument to render_exception

* ci: bump ubuntu to 20.04

* remove ruby 2.0.0 from ci

* ci: pin loofah to supported version
  • Loading branch information
waltjones authored Oct 12, 2023
1 parent 32d7856 commit 8130206
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 27 deletions.
25 changes: 5 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
ruby-version: [2.5.3, 2.6.0, 2.6.6, 2.7.2]
Expand All @@ -19,6 +19,10 @@ jobs:
- gemfiles/rails60.gemfile
- gemfiles/rails61.gemfile
include:
- gemfile: gemfiles/rails71.gemfile
ruby-version: 3.2.2
- gemfile: gemfiles/rails71.gemfile
ruby-version: 3.1.1
- gemfile: gemfiles/rails70.gemfile
ruby-version: 3.1.1
- gemfile: gemfiles/rails70.gemfile
Expand Down Expand Up @@ -47,10 +51,6 @@ jobs:
ruby-version: 2.2.10
- gemfile: gemfiles/rails32.gemfile
ruby-version: 2.1.9
- gemfile: gemfiles/rails31.gemfile
ruby-version: 2.0.0
- gemfile: gemfiles/rails30.gemfile
ruby-version: 2.0.0

steps:
- uses: actions/checkout@v2
Expand All @@ -68,21 +68,6 @@ jobs:
with:
ruby-version: ${{ matrix.ruby-version }}

- name: Setup Ruby 2.0.0
if: ${{ matrix.ruby-version == '2.0.0' }}
timeout-minutes: 15
run: |
sudo apt-get update -y
sudo apt-get install -y libssl1.0-dev
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p648.tar.gz
tar xvfz ruby-2.0.0-p648.tar.gz
cd ruby-2.0.0-p648
./configure && make && sudo make install-nodoc
- name: Ruby 2.0.0, install bundler
if: ${{ matrix.ruby-version == '2.0.0' }}
run: sudo gem install bundler -v 1.17.3

- name: Rails 4.2 ensure bundler version
if: ${{ matrix.gemfile == 'gemfiles/rails42.gemfile' }}
run: |
Expand Down
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This Gemfile is compatible with Ruby 2.5.0 or greater. To test with
# earlier Rubies, use the appropriate Gemfile from the ./gemfiles/ dir.
ruby '>= 2.5.0'
ruby '3.2.2'

source 'https://rubygems.org'

Expand All @@ -13,16 +13,18 @@ ENV['CURRENT_GEMFILE'] ||= __FILE__

is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby')

GEMFILE_RAILS_VERSION = '~> 6.1.5'.freeze
GEMFILE_RAILS_VERSION = '~> 7.1.0'.freeze
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
gem 'appraisal'
gem 'jruby-openssl', :platform => :jruby
gem 'rails', GEMFILE_RAILS_VERSION
gem 'rake'
if GEMFILE_RAILS_VERSION < '6.0'
gem 'rspec-rails', '~> 3.4'
else
elsif GEMFILE_RAILS_VERSION < '7.0'
gem 'rspec-rails', '~> 4.0.2'
else
gem 'rspec-rails', '~> 6.0.3'
end

if GEMFILE_RAILS_VERSION < '6.0'
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails42.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ gem 'database_cleaner', '~> 1.0.0'
gem 'delayed_job', :require => false
gem 'generator_spec'
gem 'girl_friday', '>= 0.11.1'
gem 'loofah', '~>2.19.1'
gem 'redis', '<= 3.3.5'
gem 'resque'
gem 'rspec-command'
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails70.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == '

gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
gem 'jruby-openssl', :platform => :jruby
gem 'rails', '~> 7.0.2.3'
gem 'rails', '~> 7.0.8'
gem 'sqlite3', '~> 1.4', :platform => [:ruby, :mswin, :mingw]

gem 'rspec-rails', '~> 4.0.2'
gem 'rspec-rails', '~> 6.0.3'

gem 'rake'

Expand Down
52 changes: 52 additions & 0 deletions gemfiles/rails71.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
require 'rubygems/version'

source 'https://rubygems.org'

is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby')

gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
gem 'jruby-openssl', :platform => :jruby
gem 'rails', '~> 7.1.0'
gem 'sqlite3', '~> 1.4', :platform => [:ruby, :mswin, :mingw]

gem 'rspec-rails', '~> 6.0.3'

gem 'rake'

gem 'sidekiq', '>= 6.4.0'

platforms :rbx do
gem 'minitest'
gem 'racc'
gem 'rubinius-developer_tools'
gem 'rubysl', '~> 2.0' if RUBY_VERSION.start_with?('2')
end

gem 'sucker_punch', '~> 2.0'

# We need last sinatra that uses rack 2.x and ruby 2.5.x
gem 'sinatra', :git => 'https://github.com/sinatra/sinatra', :tag =>'v2.1.0'

gem 'database_cleaner'
gem 'delayed_job', '4.1.10', :require => false
gem 'generator_spec'
gem 'redis', '<= 4.8.0'
gem 'resque'
gem 'secure_headers', '~> 6.3.2', :require => false
gem 'simplecov'

unless is_jruby
# JRuby doesn't support fork, which is required for this test helper.
gem 'rspec-command'
end

gem 'mime-types'

gem 'webmock', :require => false

gem 'aws-sdk-sqs'
gem 'shoryuken'

gem 'capistrano', :require => false

gemspec :path => '../'
9 changes: 7 additions & 2 deletions lib/rollbar/middleware/rails/show_exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Rails
module ShowExceptions
include ExceptionReporter

def render_exception_with_rollbar(env, exception)
def render_exception_with_rollbar(env, exception, wrapper = nil)
key = 'action_dispatch.show_detailed_exceptions'

if exception.is_a?(ActionController::RoutingError) && env[key]
Expand All @@ -15,7 +15,12 @@ def render_exception_with_rollbar(env, exception)
end
end

render_exception_without_rollbar(env, exception)
# Rails 7.1 changes the method signature for render_exception.
if self.class.instance_method(:render_exception_without_rollbar).arity == 2
render_exception_without_rollbar(env, exception)
else
render_exception_without_rollbar(env, exception, wrapper)
end
end

def call_with_rollbar(env)
Expand Down

0 comments on commit 8130206

Please sign in to comment.