Skip to content

Commit 5a9ea4d

Browse files
frederikspangcopybara-github
authored andcommitted
Support Ruby 4.0 (#25051)
Closes #25051 COPYBARA_INTEGRATE_REVIEW=#25051 from frederikspang:main 83f91c7 FUTURE_COPYBARA_INTEGRATE_REVIEW=#25051 from frederikspang:main 83f91c7 PiperOrigin-RevId: 853462400
1 parent ce5ff11 commit 5a9ea4d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.github/workflows/test_ruby.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ jobs:
3434
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: FFI }
3535
- { name: Ruby 3.2, ruby: ruby-3.2.6, continuous-only: true }
3636
- { name: Ruby 3.3, ruby: ruby-3.3.6, continuous-only: true }
37-
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE }
38-
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI }
37+
- { name: Ruby 3.4, ruby: ruby-3.4.1, continuous-only: true }
38+
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-ruby-4.0.0-1a1642a7cba0a7fa4c226c2d047ed5fbe6ca5451' }
39+
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-ruby-4.0.0-1a1642a7cba0a7fa4c226c2d047ed5fbe6ca5451' }
3940
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
4041
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI }
4142

@@ -143,6 +144,8 @@ jobs:
143144
- { version: "3.3", continuous-only: true }
144145
- { version: "3.4", ffi: NATIVE }
145146
- { version: "3.4", ffi: FFI }
147+
- { version: "4.0", ffi: NATIVE }
148+
- { version: "4.0", ffi: FFI }
146149

147150
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} MacOS Ruby ${{ matrix.version }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
148151
runs-on: macos-14
@@ -155,7 +158,7 @@ jobs:
155158

156159
- name: Pin Ruby version
157160
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
158-
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0
161+
uses: ruby/setup-ruby@ae195bbe749a7cef685ac729197124a48305c1cb # v1.276.0
159162
with:
160163
ruby-version: ${{ matrix.version }}
161164

@@ -184,8 +187,9 @@ jobs:
184187
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: FFI }
185188
- { name: Ruby 3.2, ruby: ruby-3.2.6, continuous-only: true}
186189
- { name: Ruby 3.3, ruby: ruby-3.3.6, continuous-only: true}
187-
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE }
188-
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI, continuous-only: true }
190+
- { name: Ruby 3.4, ruby: ruby-3.4.1, continuous-only: true }
191+
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-ruby-4.0.0-1a1642a7cba0a7fa4c226c2d047ed5fbe6ca5451' }
192+
- { name: Ruby 4.0, ruby: ruby-4.0.0, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-ruby-4.0.0-1a1642a7cba0a7fa4c226c2d047ed5fbe6ca5451' }
189193
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
190194
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI, continuous-only: true }
191195
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
@@ -209,6 +213,7 @@ jobs:
209213
./regenerate_stale_files.sh $BAZEL_FLAGS;
210214
bazel build //ruby:release //:protoc ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled' || '' }} $BAZEL_FLAGS;
211215
gem install bazel-bin/ruby/google-protobuf-*;
216+
find /usr/local/rvm/gems/ruby-4.0.0/gems/google-protobuf-4.34.0/ -ls;
212217
bazel-bin/protoc --proto_path=src --proto_path=ruby/tests --proto_path=ruby --ruby_out=ruby tests/test_import_proto2.proto;
213218
bazel-bin/protoc --proto_path=src --proto_path=ruby/tests --proto_path=ruby --ruby_out=ruby tests/basic_test.proto;
214219
${{ matrix.ffi == 'FFI' && 'PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} ruby ruby/tests/basic.rb;

ruby/tests/repeated_field_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ def test_acts_like_an_array
2929
arr_methods -= [:intersect?]
3030
# ruby 3.4 methods we ignore
3131
arr_methods -= [:fetch_values]
32+
# ruby 4.0 methods we ignore
33+
arr_methods -= [:rfind]
34+
3235
arr_methods.each do |method_name|
3336
assert_respond_to m.repeated_string, method_name
3437
end

0 commit comments

Comments
 (0)