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

Test compilation against Ruby 3.3 #108

Closed
mudge opened this issue Sep 24, 2023 · 10 comments
Closed

Test compilation against Ruby 3.3 #108

mudge opened this issue Sep 24, 2023 · 10 comments
Assignees
Labels

Comments

@mudge
Copy link
Owner

mudge commented Sep 24, 2023

As Ruby 3.3 will likely be released on Christmas Day, we should test and precompile the gem against the latest preview version already so we can release an update ASAP. If we don’t have an update to the gem, it’ll be broken on 3.3.

@mudge mudge added the feature label Sep 24, 2023
@mudge
Copy link
Owner Author

mudge commented Sep 24, 2023

@flavorjones do you have any advice for preparing for this? Does putting out support for the latest preview versions give you some coverage for the final release on Christmas Day or is there no escaping putting out a new version ASAP?

@mudge
Copy link
Owner Author

mudge commented Sep 24, 2023

I see now the native gems won’t install on unsupported future Ruby versions due to the stricter version constraint which gives us a little breathing room.

mudge added a commit that referenced this issue Sep 24, 2023
Before compiling the native gems against the latest, unreleased version
of Ruby, check the gem compiles and passes its tests when the user has
to compile against it on install.

See #108
mudge added a commit that referenced this issue Sep 24, 2023
Before compiling the native gems against the latest, unreleased version
of Ruby, check the gem compiles and passes its tests when the user has
to compile against it on install.

Note 3.3.0-preview2 is not available for Windows.

See #108
@mudge mudge self-assigned this Sep 24, 2023
@flavorjones
Copy link

flavorjones commented Sep 24, 2023

Thanks for asking. You probably know most of this, but just to set some explicit context ...

rake-compiler sets required ruby version ranges

In precompiled native gem packages, rake-compiler will have set the required_ruby_version in the gemspec so that only the rubies explicitly included will use the precompiled gem. Modern versions of Bundler know how to navigate this, and will use the vanilla "ruby" platform source gem for versions of Ruby not explicitly included in that range.

So right now, rake-compiler-dock official releases only support up to Ruby 3.2, which means all of our precompiled gems say something like

spec.required_ruby_version = [">= 2.7", "< 3.3.dev"]

so people who are running a Ruby 3.3 preview release will end up using the "ruby" platform gem and compiling from source (and not a precompiled native platform gem).

rake-compiler-dock support for new ruby versions

Historically, new versions of rake-compiler-dock haven't gotten cut until January, meaning that as people upgrade to the new Ruby, they end up having to compile all these gems from source, which isn't great for them and usually results in a non-zero number of support issues being filed for the maintainers to deal with.

This year, I'm hoping to do better:

I'm trying to get this shipped in advance of December. That PR is very close to passing all the tests, and I think I can finish it with a few more hours of work.

If the Ruby core team promises the ABI won't change between a preview release and the final release, it will be possible for us to ship a version of rake-compiler-dock that will support Ruby 3.3.0 before Ruby 3.3.0 is even released. And that means we can all ship precompiled gems in advance of the 3.3 final release.

Anyway. My OSS time for the next few weeks is already allocated, but I'm hoping to get back to that PR in mid-October.

@mudge
Copy link
Owner Author

mudge commented Sep 24, 2023

Thanks, @flavorjones. ABI stability of 3.3 ahead of its release would be the dream so we could precompile gems before Christmas Day.

mudge added a commit that referenced this issue Sep 24, 2023
Before precompiling the native gems against the latest, unreleased
version of Ruby, check the gem compiles and passes its tests when the
user has to compile against it on install.

Note preview versions of Ruby are not available for Windows, see
https://github.com/ruby/setup-ruby#supported-versions

See #108
mudge added a commit that referenced this issue Sep 24, 2023
Before precompiling the native gems against the latest, unreleased
version of Ruby, check the gem compiles and passes its tests when the
user has to compile against it on install.

Note preview versions of Ruby are not available for Windows, see
https://github.com/ruby/setup-ruby#supported-versions

See #108
@mudge
Copy link
Owner Author

mudge commented Sep 24, 2023

Closing this now we've added Ruby 3.3 to CI.

@mudge mudge closed this as completed Sep 24, 2023
@mudge
Copy link
Owner Author

mudge commented Dec 11, 2023

@flavorjones given that the Ruby 3.3.0-rc1 announcement says that ABI changes will be “avoided” from here on in, do you think it possible that we could build native gems for 3.3 ahead of release or is the risk still too high (or perhaps uncertain)?

@flavorjones
Copy link

@mudge I'm going to ship a release of rake-compiler-dock this week that uses Ruby 3.3 rc1. I'd like to ship an RC of nokogiri shortly thereafter and at that point I'll know more, maybe enough to be confident in shipping a final.

But I don't know of any reason that you couldn't ship an RC of re2 using rake-compiler-dock 1.4.0.rc1 (which uses Ruby 3.3.0-preview3) if you want to start building confidence.

@mudge
Copy link
Owner Author

mudge commented Dec 12, 2023

Thanks, @flavorjones. I've raised #122 with rake-compiler-dock 1.4.0.rc1 to kick the tyres a bit. It's looking good (all is green!) but reveals we will also need the following dependencies to add Ruby 3.3.0-rc1 support if want to test the compiled gems in CI:

  1. setup-ruby (should be in place as of ruby/setup-ruby@af848b4 though I don't believe they will add support for Windows until the final release)
  2. The official ruby Docker image (used for testing the various CPU architectures)

@flavorjones
Copy link

@mudge Yes, testing against a ruby prerelease is annoying. See this nokogiri commit for the mix of "head" and "3.3.0-preview3" I had to use across all the CI platforms; and yes, the official ruby images on dockerhub tend to lag a day or two.

Note that ruby:3.3.0-rc1 is now live, though! https://hub.docker.com/_/ruby

@mudge
Copy link
Owner Author

mudge commented Dec 13, 2023

Thanks, I cut an initial RC today with native 3.3 support using rake-compiler-dock 1.4.0.rc2 and testing against the Ruby 3.3.0-rc1 Docker image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants