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

Support ruby 3.4 #19752

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 27 additions & 24 deletions .github/workflows/test_ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ jobs:
matrix:
include:
# Test both FFI and Native implementations on the highest and lowest
# Ruby versions for CRuby and JRuby, but only on Bazel 5.x.
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE }
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, continuous-only: true }
- { name: Ruby 3.1, ruby: ruby-3.1.0, continuous-only: true }
- { name: Ruby 3.2, ruby: ruby-3.2.0, continuous-only: true }
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE }
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI }
- { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: FFI }
# Ruby versions for CRuby and JRuby
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82' }
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, continuous-only: true, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82' }
- { name: Ruby 3.1, ruby: ruby-3.1.6, continuous-only: true }
- { name: Ruby 3.2, ruby: ruby-3.2.6, continuous-only: true }
- { name: Ruby 3.3, ruby: ruby-3.3.6, continuous-only: true }
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE }
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI }
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI }

name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.name }} ${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
runs-on: ubuntu-latest
Expand All @@ -51,7 +52,7 @@ jobs:
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
with:
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82', matrix.ruby) }}
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-90d207f4e749b54c8792bbe974dfc70323b6566e', matrix.ruby) }}
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: ruby_linux/${{ matrix.ruby }}
bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
Expand Down Expand Up @@ -132,14 +133,15 @@ jobs:
matrix:
include:
# Test both FFI and Native implementations on the highest and lowest
# Ruby versions for CRuby, but only on Bazel 5.x.
# Ruby versions for CRuby.
# Quote versions numbers otherwise 3.0 will render as 3
- { version: "3.0", ffi: NATIVE }
- { version: "3.0", ffi: FFI, continuous-only: true }
- { version: "3.1", continuous-only: true }
- { version: "3.2", continuous-only: true }
- { version: "3.3", ffi: NATIVE }
- { version: "3.3", ffi: FFI }
- { version: "3.3", continuous-only: true }
- { version: "3.4", ffi: NATIVE }
- { version: "3.4", ffi: FFI }

name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} MacOS Ruby ${{ matrix.version }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
runs-on: macos-13
Expand All @@ -152,7 +154,7 @@ jobs:

- name: Pin Ruby version
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: ruby/setup-ruby@961f85197f92e4842e3cb92a4f97bd8e010cdbaf # v1.165.0
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0
with:
ruby-version: ${{ matrix.version }}

Expand All @@ -176,15 +178,16 @@ jobs:
matrix:
include:
# Test both FFI and Native implementations on the highest and lowest
# Ruby versions for CRuby and JRuby, but only on Bazel 5.x.
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE}
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI}
- { name: Ruby 3.1, ruby: ruby-3.1.0}
- { name: Ruby 3.2, ruby: ruby-3.2.0}
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE }
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI }
- { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.6.0, ffi: FFI }
# Ruby versions for CRuby and JRuby.
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82'}
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82'}
- { name: Ruby 3.1, ruby: ruby-3.1.6}
- { name: Ruby 3.2, ruby: ruby-3.2.6}
- { name: Ruby 3.3, ruby: ruby-3.3.6}
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE }
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI }
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI }
name: ${{ inputs.continuous-prefix }} Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
runs-on: ubuntu-latest
steps:
Expand All @@ -197,7 +200,7 @@ jobs:
if: ${{ inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
with:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-${{ matrix.ruby }}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-90d207f4e749b54c8792bbe974dfc70323b6566e', matrix.ruby) }}
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }}
bash: >
Expand Down
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ load("@system_ruby//:bundle.bzl", "ruby_bundle")
ruby_bundle(
name = "protobuf_bundle",
srcs = ["//ruby:google-protobuf.gemspec"],
bundler_version = "2.4.22",
gemfile = "//ruby:Gemfile",
)

Expand Down
3 changes: 2 additions & 1 deletion ruby/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ GEM
specs:
bigdecimal (3.1.8)
bigdecimal (3.1.8-java)
ffi (1.17.0)
ffi (1.17.1)
ffi (1.17.1-java)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
Expand Down
4 changes: 2 additions & 2 deletions ruby/google-protobuf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Gem::Specification.new do |s|
s.add_development_dependency "rake-compiler-dock", "= 1.2.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

rake-compiler and rake-compiler-dock may need an update to support 3.4.0 as well:

https://github.com/rake-compiler/rake-compiler-dock/releases/tag/v1.7.0

Copy link
Contributor

Choose a reason for hiding this comment

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

This 1.2.1 version doesn't even support 3.3 so perhaps it's already outdated or not particularly relied upon for official builds, but probably good to update nonetheless.

end
s.required_ruby_version = '>= 3.0'
# bigdecimal must be used as a non-built in gem as of ruby-3.4
s.add_dependency "bigdecimal"
# TODO: evaluate removing Rakefile and moving logic to extconf.rb, so that we
# can remove this runtime dependency on rake. See the discussion here for
# more details:
Expand All @@ -41,6 +43,4 @@ Gem::Specification.new do |s|
s.add_development_dependency "ffi-compiler", "~>1"
s.add_development_dependency "rake-compiler", "~> 1.1.0"
s.add_development_dependency "test-unit", '~> 3.0', '>= 3.0.9'
# bigdecimal must be used as a non-built in gem as of ruby-3.4
s.add_development_dependency "bigdecimal"
end
8 changes: 5 additions & 3 deletions ruby/tests/repeated_field_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ def test_acts_like_enumerator
def test_acts_like_an_array
m = TestMessage.new
arr_methods = ([].methods - TestMessage.new.repeated_string.methods)
# jRuby additions to the Array class that we can ignore
# JRuby additions to the Array class that we ignore
arr_methods -= [ :indices, :iter_for_each, :iter_for_each_index,
:iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple,
:nitems, :iter_for_reverse_each, :indexes, :append, :prepend]
arr_methods -= [:filter!]
# ruby 2.7 methods we can ignore
# ruby 2.7 methods we ignore
arr_methods -= [:deconstruct, :resolve_feature_path]
# ruby 3.1 methods we can ignore
# ruby 3.1 methods we ignore
arr_methods -= [:intersect?]
# ruby 3.4 methods we ignore
arr_methods -= [:fetch_values]
arr_methods.each do |method_name|
assert_respond_to m.repeated_string, method_name
end
Expand Down
Loading