-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add Rails 7 support #4220
Add Rails 7 support #4220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting a head start on this @peterberkenbosch!
f907029
to
16acf54
Compare
Updated this with the last few missing dependencies to run the sandbox. |
3ecea7d
to
27f6b21
Compare
Updated with the latest released gems. Wondering if we want to stop supporting Rails 5.2? Also not sure why the added circlci build for postgres_rails70 is not being picked up by circleCI, probably needs someone with more permissions on the CircleCI account to enable or approve that build step? |
0f0b175
to
ceead5f
Compare
0e82a0a
to
1f2fb2a
Compare
Oooh, look at that green check mark. |
I know I'm not supposed to leave emoji specific Github comments, but 😎 Thanks Peter! |
hey 👋 Looking forward to Rails 7 🎉 Anything I can do to help? |
Gemfile
Outdated
@@ -11,13 +11,18 @@ group :backend, :frontend, :core, :api do | |||
else | |||
gem 'rails', ENV['RAILS_VERSION'] || '~> 6.1.0', require: false | |||
end | |||
|
|||
if ENV['RAILS_VERSION'] == '7.0.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be adjusted to compare against any version later than 7.0.0 since 7.0.1 is already out?
Thank you for opening this PR, by the way, we'd love to bump to Rails 7 ASAP and Solidus is one of the few things preventing that for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this needs to be a bit smarter. Good catch!
@peterberkenbosch Now that specs are green, should we be taking a more serious look at this PR? |
Yes! Let's do that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rebase out some of the Gemfile churn as the different versions of things get updated/released? We also don't need stuff like changing the version of devise and then removing it altogether both in the git history.
Left a couple small comments, but generally this all looks good. Thanks for taking this on, Peter. 🙏🏻
@@ -7,7 +7,7 @@ module CurrentHost | |||
extend ActiveSupport::Concern | |||
|
|||
included do | |||
if Gem::Requirement.new("> 5.2").satisfied_by?(Rails.gem_version) | |||
if Gem::Requirement.new(">= 6").satisfied_by?(Rails.gem_version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you're doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remove deprecation warning on Rails 7. Might be better suitable for standalone PR now that I think of it. So we have 1 PR focussed only on adding Rails 7 compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's pertinent to have it on this PR. Besides, if there's a warning, CI will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah.. thanks! Let's keep it then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @peterberkenbosch, what was the deprecation warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
host is already set or something like that. I'm happy to remove all non-essential changes here actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to understand if that was coming from Solidus or Rails, because if it's the latter and we will receive warnings, the CI won't fail, it only fails for Solidus deprecations. cc @waiting-for-dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it's from Rails, not Solidus.
I would say YES! Thoughts? cc @kennyadsl
@peterberkenbosch, besides defining it, you need to add a new job within However, what we need to add is a job for |
For our current policy, we should stop supporting a specific Rails version when it no more receives security patches, and 5.2 appears to be still receiving them, see: https://guides.rubyonrails.org/maintenance_policy.html#severe-security-issues. Also, changing this will probably require a major bump for Solidus, because this would be technically a breaking change, isn't it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 7️⃣ times (at least), @peterberkenbosch! I left some comments, let me know if I'm missing something.
bin/sandbox
Outdated
@@ -53,10 +53,10 @@ fi | |||
cd ./sandbox | |||
cat <<RUBY >> Gemfile | |||
|
|||
gem 'awesome_nested_set', github: 'peterberkenbosch/awesome_nested_set', branch: 'rails-7-support' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that collectiveidea/awesome_nested_set#460 has been merged, why not using:
gem 'awesome_nested_set', github: 'collectiveidea/awesome_nested_set'
as you did in the Gemfile?
bin/sandbox
Outdated
gem 'solidus', path: '..' | ||
gem 'solidus_auth_devise', '>= 2.1.0' | ||
gem 'rails-i18n' | ||
gem 'solidus_i18n' | ||
gem 'solidus_i18n', github: 'solidusio/solidus_i18n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to release a new version of solidus_i18n with the code currently in master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, revisiting this now. 2.1.1 should have the latest from master now anyway right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming we don't need to do this anymore. There are a few deprecation warnings showing up, looking into those as well, but it's working as expected right now.
Thanks! Updating this PR, and will respond back to the questions, suggestions etc. |
hey @peterberkenbosch Do you need any help with this branch getting merged? |
401cf93
to
059dc35
Compare
Not yet, rebasing all the cruft right now so we have a clean PR to work from. |
a772ca0
to
b1f349f
Compare
Should we track latest Rails 7 release by default on our main (unreleased) branch? We probably have to bump versions here too? |
I'm not sure I get it. Where exactly should we bump versions? |
@waiting-for-dev I was thinking the Solidus version, but that's not really needed in this PR. |
for Rails 7.0.1 support we need a few more updates on dependencies, tracking those down now. |
0e58a5c
to
f2ecc9e
Compare
Rails 7 deprecates Enum#sum in favor of Ruby's Enum#sum, which requires an initial value when elements are not numbers. In this case, as the elements are `Spree::StockQuantities`, we reduce with `:+` so that the first one is taken as the initial value.
Rails 7 deprecates image/jpg mime type, only accepting image/jpeg for JPG images. However, we can keep it as a supported image extension for Solidus applications (`Spree::Config#allowed_image_mime_types`). Host applications will see the deprecation message, and they will be able to act as desired. Besides, we can keep it for the Paperclip adapter.
We create a compatibility module to wrap this kind of internal usage of Rails API
`config.action.view.raise_on_missing_translations` [was deprecated on Rails 6.1](https://github.com/rails/rails/releases/tag/v6.1.0) in favor of `config.i18n.raise_on_missing_translations`. It was [removed on Rails 7.0](https://edgeguides.rubyonrails.org/7_0_release_notes.html#action-view).
Looks like failed test is a false positive 🤔 pr maybe
|
@denys-medynskyi should be a flaky, re-running! |
It is green now 💚 |
@kennyadsl can you merge it please 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Approved.
@denys-medynskyi we need to wait for a review from another core team member before merging.
This commit reverts part of 0cd2431 Even if we now support Rails 7, which only works from Ruby 2.7 onwards, we also still support Rails 5.2, which works from Ruby 2.5. Deprecating Ruby versions is a backward incompatible change, so we'll do that in major releases.
I added a new commit reverting dropping support for Ruby 2.5 & Ruby 2.6. We still support Rails 5.2, which works from 2.5 onwards. We'll deprecate Ruby & Rails versions on major releases, as that's backward-incompatible changes. |
We are good to merge 🎉 |
When might this merged PR get packaged into a released gem? Solidus 3.1.7 still uses Rail 6.1. |
@mslinn, we're wrapping everything up and you can expect a new release in the next couple of weeks 🤞 |
@waiting-for-dev I am new to this project. Is there anything I should watch out for if I clone master and build the gem locally? |
You can point your Gemfile at the latest code from GitHub, yes. Some stores do that to stay as up to date as possible. |
I wrote up a detailed explanation of what I did to build the gems, and created a GitHub discussion to figure out why |
Thank you all for the great effort pushing solidus to suppoer rails 7 as soon as possible .. |
Rails 7 support had been merged and released a while ago, maybe in 3.2 if I recall correctly. |
@asfour75 Retro Market is on Rails 7 with Solidus 3.3 but we ran 3.2 with 7 as well. |
Based on the offical gihub page https://github.com/solidusio/solidus To add Solidus, begin with a Rails 5.2, 6 or 6.1 application and a database configured and created. so I assumed it only supports up to 6.1 |
Yup .. I tried 3.3 on Rails 7 .. worked smoothly .. |
Thanks for reporting. The README is currently being fixed at https://github.com/solidusio/solidus/pull/5012/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5 |
Description
With the release of Rails 7.0.0 we should start preparing Solidus edge to be supported. This PR starts with that.
Default using the latest released rails 7.0 on setup and sandbox creation:
There is however still an error showing up with title: TypeError in Spree::Home#index
Solving this with:
add
mini_magick
tosandbox/config/application.rb
since the default:vips
does not work out of the box with Solidus just yet. (see more details below).If we want to use
:vips
by default we have to changecore/app/models/concerns/spree/active_storage_adapter/attachment.rb#variant
:from:
to:
The size elements have to be an integer, and
strip
is not a valid command for:vips
Dependencies that we wait for new release:
config.active_storage.variant_processor = :mini_magick
automation with install generator?Checklist: