Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THREESCALE-9169: Upgrade to Ruby 3.1 #3847

Merged
merged 22 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
063fd2f
Upgrade Ruby to version 3.1 and Node to version 18
mayorova Jul 19, 2024
eac1651
Update CircleCI config and the builder image
mayorova Jul 19, 2024
a897958
Fix keyword arguments for Ruby 3 compatibility
mayorova Jul 19, 2024
f34f392
Fix keyword arguments for representers and 'with_options'
mayorova Jul 19, 2024
5ef5c6f
Fix keyword arguments in new accounts query and sifter
mayorova Jul 19, 2024
fed96e3
Fix decorators by making methods non-private
mayorova Jul 19, 2024
87a483f
Fix URI.escape and URI.encode which are not available in Ruby 3
mayorova Jul 19, 2024
3decaf0
Fix various hacks that are not needed anymore after Ruby upgrade
mayorova Jul 19, 2024
397abeb
Skip the test using fibers
mayorova Jul 19, 2024
ab4ff8f
Fix deprecation warning for `fixture_file_upload`
mayorova Jul 19, 2024
b023f85
Remove URL hacks for Liquid
mayorova Jul 19, 2024
e4dbdbc
Remove an unused Dockerfile
mayorova Jul 22, 2024
8e46a2f
Upgrade the upstream Dockerfile
mayorova Jul 22, 2024
c98b003
Fix decorators by removing private methods
mayorova Jul 25, 2024
645960f
Fix billing service error reporting
mayorova Jul 25, 2024
866484e
Fix user tracking error reporting
mayorova Jul 30, 2024
77d2aac
Upgrade simplecov and remove codecov ruby uploader
mayorova Aug 9, 2024
33e9a2b
Use Chrome version 126
mayorova Aug 13, 2024
4924c8d
Fix legal terms regression
mayorova Sep 18, 2024
b979e95
Less confusing syntax for user_options hash safe navigation
mayorova Sep 18, 2024
1de699d
Small tweaks
mayorova Sep 18, 2024
2114f9f
Refactor pf_inline_alert (#3893)
mayorova Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 73 additions & 73 deletions .circleci/config.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .tool-versions.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ruby 2.7.6
nodejs 16.19.1
ruby 3.1.5
nodejs 18.20.4
python 2.7.18
33 changes: 0 additions & 33 deletions Dockerfile

This file was deleted.

22 changes: 11 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ gem 'aws-sdk-s3', '~> 1'
gem 'dotenv-rails', '~> 2.7'
gem 'rails', '~> 6.1'

# Locking mail to 2.7.x, as 2.8 has a regression related to `enable_starttls_auto` setting:
# https://github.com/mikel/mail/blob/2-8-stable/CHANGELOG.rdoc#version-281-unreleased-
# Also, upgrading makes this test fail: SendUserInvitationWorkerTest#test_handles_errors
gem 'mail', '~> 2.7.1'
gem 'mail', '~> 2.8.1'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing

/home/dmayorov/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- net/smtp (LoadError)


gem "activejob-uniqueness"
# Needed for XML serialization of ActiveRecord::Base
Expand All @@ -44,6 +41,8 @@ gem 'bcrypt', '~> 3.1.7'
gem 'oauth2', '~> 2.0'
gem 'open_id_authentication'

gem 'sorted_set', '~> 1.0'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing:

/home/dmayorov/.asdf/installs/ruby/3.1.4/lib/ruby/3.1.0/set/sorted_set.rb:4:in `rescue in <main>': The `SortedSet` class has been extracted from the `set` library. You must use the `sorted_set` gem or other alternatives. (RuntimeError)
/home/dmayorov/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- sorted_set (LoadError)
/home/dmayorov/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require': cannot load such file -- oily_png (LoadError)

See ruby/set#2


gem 'i18n'

# Apisonator client
Expand All @@ -70,7 +69,7 @@ gem 'stripe', '~> 5.28.0' # we need the stripe gem because activemerchant can no
gem 'acts_as_list', '~> 0.9.17'
gem 'braintree', '~> 2.93'
gem 'bugsnag', '~> 6.26'
gem 'cancancan', '~> 3.0.0'
gem 'cancancan', '~> 3.6.0'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.1.0 was the first version to fix keyword arguments: https://github.com/CanCanCommunity/cancancan/blob/develop/CHANGELOG.md#310

But going up to 3.6.0 seemed OK.

gem 'formtastic', '~> 4.0'
gem 'htmlentities', '~>4.3', '>= 4.3.4'
# TODO: Not actively maintained https://github.com/activeadmin/inherited_resources#notice replace with respond_with and fix things the rails way
Expand Down Expand Up @@ -98,6 +97,7 @@ gem 'httpclient', github: '3scale/httpclient', branch: 'ssl-env-cert'
gem 'json-schema', git: 'https://github.com/3scale/json-schema.git'
gem 'local-fastimage_resize', '~> 3.4.0', require: 'fastimage/resize'
gem 'kt-paperclip', '~> 7.2'
gem 'matrix', '~> 0.4.2' # needed only until we upgrade capybara and prawn that list it as a dependency
gem 'prawn'
gem 'prawn-table', git: "https://github.com/prawnpdf/prawn-table.git", branch: "38b5bdb5dd95237646675c968091706f57a7a641"
gem 'prawn-svg'
Expand All @@ -117,7 +117,8 @@ gem 'ts-datetime-delta', require: 'thinking_sphinx/deltas/datetime_delta'
gem 'will_paginate', '~> 3.3'
gem 'zip-zip', require: false

gem 'acts_as_tree'
# TODO: this gem seems a bit abandoned, consider getting rid of it
gem 'acts_as_tree', '~> 2.9.1'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing:

ActionView::Template::Error (undefined method `arity' for {:class_name=>"Metric", :primary_key=>"id", :foreign_key=>"parent_id", :counter_cache=>nil, :touch=>false, :inverse_of=>:children, :optional=>true}:Hash

      if scope && scope.arity == 0
                       ^^^^^^):
    1: #quick-start-container data-render-catalog=(active_menu == :quickstarts).to_s data-links=quickstarts_presenter.links

Version 2.9.1 adds Ruby 3 compatibility: https://github.com/amerine/acts_as_tree/releases/tag/v2.9.1

gem 'addressable', require: false
gem 'hashie', require: false
gem 'rack-x_served_by', '~> 0.1.1'
Expand Down Expand Up @@ -155,7 +156,7 @@ gem 'html-pipeline'
gem 'ruby-openid'
gem 'slim-rails', '~> 3.2'

gem 'draper', '~> 3.1'
gem 'draper', '~> 4.0.2'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing:

/home/dmayorov/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-6.1.7.8/lib/active_support/core_ext/module/delegation.rb:173:in `delegate': Delegation needs a target. Supply a keyword argument 'to' (e.g. delegate :hello, to: :greeter). (ArgumentError)

4.0.2 is the first version with Ruby 3 compatibility: https://github.com/drapergem/draper/blob/master/CHANGELOG.md#402---2021-05-27


group :development do
gem 'listen'
Expand All @@ -179,13 +180,12 @@ gem 'dynamic_form'
gem 'record_tag_helper', '~> 1.0'

group :test do
# To remove once migrated all functional tests
gem 'codecov', :require => false
gem 'rack-no_animations', '~> 1.0.3'
gem 'rails-controller-testing', '~> 1.0.4'
gem 'simplecov', '~> 0.21.2', require: false
gem 'simplecov', '~> 0.22.0', require: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was because of this error seen in CircleCI:

rake aborted!
coverage measurement is already setup
/opt/ci/workdir/vendor/bundle/ruby/3.1.0/gems/simplecov-0.21.2/lib/simplecov.rb:354:in `start'
/opt/ci/workdir/vendor/bundle/ruby/3.1.0/gems/simplecov-0.21.2/lib/simplecov.rb:354:in `start_coverage_with_criteria'
/opt/ci/workdir/vendor/bundle/ruby/3.1.0/gems/simplecov-0.21.2/lib/simplecov.rb:343:in `start_coverage_measurement'
/opt/ci/workdir/vendor/bundle/ruby/3.1.0/gems/simplecov-0.21.2/lib/simplecov.rb:59:in `start'
/opt/ci/workdir/test/minitest_helper.rb:18:in `<top (re

referenced in simplecov-ruby/simplecov#1020 and fixed in simplecov-ruby/simplecov#1035

This is included in 0.22.0 as per simplecov-ruby/simplecov#1041 (comment)

gem 'simplecov-cobertura', '~> 2.1'

gem 'capybara', '~>3.35.3', source: 'https://rubygems.org'
gem 'capybara', '~>3.35.3'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why rubygems.org was referenced here explicitly 🤔

gem 'xpath', '~>3.2.0'

gem 'chronic'
Expand Down
Loading