mudge / re2

Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python".
http://mudge.name/re2/
BSD 3-Clause "New" or "Revised" License
129 stars 13 forks source link

Test compilation against Ruby 3.3 #108

Closed mudge closed 11 months ago

mudge commented 11 months ago

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 commented 11 months ago

@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 commented 11 months ago

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.

flavorjones commented 11 months ago

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 commented 11 months ago

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

mudge commented 11 months ago

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

mudge commented 9 months ago

@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 commented 9 months ago

@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 commented 9 months ago

Thanks, @flavorjones. I've raised https://github.com/mudge/re2/pull/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 https://github.com/ruby/setup-ruby/commit/af848b40be8bb463a751551a1180d74782ba8a72 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 commented 9 months ago

@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 commented 9 months ago

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.