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

Upgrade Ruby to version 3.0.6 #5074

Merged
merged 4 commits into from
Apr 13, 2023
Merged

Upgrade Ruby to version 3.0.6 #5074

merged 4 commits into from
Apr 13, 2023

Conversation

javierm
Copy link
Member

@javierm javierm commented Jan 30, 2023

References

Objectives

  • Update Ruby to a more recent version

Notes

These were the gems we're currently using whose compatibility with Ruby 3 we hadn't confirmed yet. They're all confirmed now.

  • autoprefixer-rails
  • byebug
  • capistrano-bundler
  • capistrano-rails
  • capistrano3-delayed-job (no updates since January 2019)
  • capistrano3-puma
  • ckeditor
  • cocoon
  • email_spec (no release since April 2018)
  • erb_lint (pull request Bump erb_lint from 0.0.37 to 0.3.1 #5093)
  • foundation-rails (has almost no Ruby code, so it might work)
  • graphiql-rails (has almost no Ruby code)
  • initialjs-rails
  • jquery-ui-rails (has almost no Ruby code, so it might work even if there haven been no updates since January 2017)
  • mdl (support in version 0.12 for sure)
  • omniauth-twitter (no updates since February 2017)
  • pronto-erb_lint (pull request Bump erb_lint from 0.0.37 to 0.3.1 #5093)
  • puma
  • rinku (no updates since April 2019)
  • rvm1-capistrano (no updates since October 2015)
  • sassc-rails (no updates since December 2019)
  • scss-lint
  • selenium-webdriver
  • spring
  • spring-commands-rspec (no updates since March 2015)
  • turbolinks (unmaintained, but it's mostly written in CoffeeScript and might work)
  • turnout (no updates since December 2018)

@javierm javierm self-assigned this Jan 30, 2023
@javierm javierm added this to Doing in Consul Democracy Jan 30, 2023
Base automatically changed from ruby_3_warnings to master January 31, 2023 13:39
@javierm javierm force-pushed the ruby3.0 branch 3 times, most recently from b30c725 to a76b82a Compare January 31, 2023 16:18
@javierm javierm changed the base branch from master to bing-translator March 10, 2023 00:05
@taitus taitus force-pushed the bing-translator branch 4 times, most recently from 4250148 to 306e735 Compare March 15, 2023 14:53
Base automatically changed from bing-translator to master March 15, 2023 16:50
@javierm javierm force-pushed the ruby3.0 branch 2 times, most recently from 19abc1d to 83d4d8c Compare March 15, 2023 16:51
@javierm javierm moved this from Doing to Reviewing in Consul Democracy Mar 15, 2023
@taitus taitus self-assigned this Mar 20, 2023
@Senen
Copy link
Member

Senen commented Mar 20, 2023

Hi @javierm,

Capistrano seems to work fine with Ruby 3. I tested it by doing the following:

  • Created a new virtual machine with Ubuntu 20.04
  • Run the installer in it, so it installs the 1.5.0 version
  • From the ruby3.0 branch, I deployed the master branch, which installs Ruby 2.7.7 in the server
  • From the ruby3.0 branch, I deployed the ruby3.0 branch to the server which installs Ruby 3.0.5 in the server

Everything worked fine 👌🏼. I marked the following gems as revised:

  • capistrano-bundler
  • capistrano-rails
  • capistrano3-delayed-job (no updates since January 2019)
  • capistrano3-puma
  • rvm1-capistrano

@javierm
Copy link
Member Author

javierm commented Mar 20, 2023

@Senen Great!

Regarding the installer, I think the only thing left would be installing the ruby3.0 branch on an empty machine, and if it works we could also mark autoprefixer-rails (if it adds the prefixes), puma and sassc-rails 🤔.

@Senen
Copy link
Member

Senen commented Mar 20, 2023

@Senen Great!

Regarding the installer, I think the only thing left would be installing the ruby3.0 branch on an empty machine, and if it works we could also mark autoprefixer-rails (if it adds the prefixes), puma and sassc-rails 🤔.

Everything worked fine!

Here is a piece of the compiled CSS that demonstrates autoprefixer works:

.feed-debates{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-top:1.5rem;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}

Regarding sassc-rails and puma nothing to comment on, everything seems to work fine.

Below are the post-install messages the server throws after bundling:

Bundle complete! 102 Gemfile dependencies, 176 gems now installed.
    Gems in the groups 'development' and 'test' were not installed.
    Bundled gems are installed into `/home/deploy/consul/shared/bundle`
    Post-install message from ancestry:
    Thank you for installing Ancestry. You can visit http:https://github.com/stefankroes/ancestry to read the documentation.
    Post-install message from rubyzip:
    RubyZip 3.0 is coming!
    **********************
  
    The public API of some Rubyzip classes has been modernized to use named
    parameters for optional arguments. Please check your usage of the
    following classes:
      * `Zip::File`
      * `Zip::Entry`
      * `Zip::InputStream`
      * `Zip::OutputStream`
  
    Please ensure that your Gemfiles and .gemspecs are suitably restrictive
    to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
    See https://github.com/rubyzip/rubyzip for details. The Changelog also
    lists other enhancements and bugfixes that have been implemented since
    version 2.3.0.
    Post-install message from sass:
  
    Ruby Sass has reached end-of-life and should no longer be used.
  
    * If you use Sass as a command-line tool, we recommend using Dart Sass, the new
      primary implementation: https://sass-lang.com/install
  
    * If you use Sass as a plug-in for a Ruby web framework, we recommend using the
      sassc gem: https://github.com/sass/sassc-ruby#readme
  
    * For more details, please refer to the Sass blog:
      https://sass-lang.com/blog/posts/7828841
  
    Post-install message from oauth2:
  
    You have installed oauth2 version 1.4.10, which is EOL.
    No further support is anticipated for the 1.4.x series.
  
    OAuth2 version 2 is released.
    There are BREAKING changes, but most will not encounter them, and upgrading should be easy!
  
    Please see:
     https://github.com/oauth-xx/oauth2#what-is-new-for-v20
     https://github.com/oauth-xx/oauth2/blob/master/CHANGELOG.md
  
    Please upgrade, report issues, and support the project! Thanks, |7eter l-|. l3oling
  
    Post-install message from rails-assets-leaflet:
    This component doesn't define main assets in bower.json.
    Please open new pull request in component's repository:
    https://github.com/Leaflet/Leaflet
  1. Our current scss_lint version depends on the sass gem, which reached its EOL. It seems there is no plan to upgrade the scss_lint gem.
  2. Not sure what mean the leaflet-related message; we should test if the map keeps working in production. Added to the list of gems to check.

@javierm
Copy link
Member Author

javierm commented Mar 20, 2023

@Senen Awesome!

These messages appear when installing these gems with Ruby 2.7.x as well, so there shouldn't be an issue with this upgrade 🤞.

@Senen
Copy link
Member

Senen commented Mar 21, 2023

Hi @javierm , @taitus,

More gem checks:

  • The rinku gem works fine. We have specific tests for auto-linking and all of them pass.
  • The scss-lint gem works fine (at least in my development machine MacOS Ventura 13)
  • The selenium-webdriver gem works fine as it worked fine in my machine and in the GitHub Actions
  • The turbolinks gem works fine too. I ran the application locally and browsed through links managed by turbolinks and played around with the browser back and forward buttons. Everything seems to behave the same without errors in the browser console.
  • The turnout gem works fine in development and production environments.
  • The spring and spring-commands-rspec work fine. We are only using spring in the bin/rspec file.

Deprecation warnings:

  • The capybara-webmock gem shows a deprecation warning that it's already solved but not released yet.

Copy link
Member

@Senen Senen left a comment

Choose a reason for hiding this comment

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

I think we are ready to go @javierm, @taitus 👏🏼 ! Or are there more things to test 🤔 ?

@javierm
Copy link
Member Author

javierm commented Mar 21, 2023

@Senen Great! 😄

That's all for now, but let's leave it as a draft until we decide whether we include it in version 2.0.0.

You can approve it, though.

Consul Democracy automation moved this from Reviewing to Testing Mar 28, 2023
These tests were failing with Ruby 3.0 because we were getting an error
when loading the `translations` association of the dummy class:

```
NameError:
  uninitialized constant
  DummyBanner::#<Class:0x000055630e4dccd8>::Translation
```

Specifying the `class_name` of the `translations` association solves the
issue.
Note the structure of the Gemfile changes slightly because Ruby 3.0
includes a new version of the Bundler gem.
In Ruby 3.0, Regexp and Range literals are frozen objects, and so we
don't need to freeze them.
We were already using it because Rails adds the `Hash#except` method for
Ruby 2.7 and earlier, but since the method wasn't part of Ruby itself,
the Rubocop rule only works with Ruby 3.0 and later.
@javierm javierm changed the title Upgrade Ruby to version 3.0.5 Upgrade Ruby to version 3.0.6 Apr 13, 2023
@javierm javierm marked this pull request as ready for review April 13, 2023 14:48
@javierm javierm merged commit 03a12ea into master Apr 13, 2023
Consul Democracy automation moved this from Testing to Release 2.0.0 Apr 13, 2023
@javierm javierm deleted the ruby3.0 branch April 13, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants