Files
Salman Chishti adf9e8b80f Upgrade GitHub Actions for Node 24 compatibility (#25572)
## Summary

Upgrade GitHub Actions to their latest versions to ensure compatibility with Node 24, as Node 20 will reach end-of-life in April 2026.

## Changes

| Action | Old Version(s) | New Version | Release | Files |
|--------|---------------|-------------|---------|-------|
| `actions/cache` | [`1bd1e32`](1bd1e32a3b) | [`8b402f5`](8b402f58fb) | [Release](https://github.com/actions/cache/releases/tag/v5) | clear_caches.yml |
| `actions/checkout` | [`8ade135`](8ade135a41) | [`8e8c483`](8e8c483db8) | [Release](https://github.com/actions/checkout/releases/tag/v6) | scorecard.yml, staleness_refresh.yml, update_php_repo.yml |
| `actions/download-artifact` | [`018cc2c`](018cc2cf5b), [`fa0a91b`](fa0a91b85d) | [`37930b1`](37930b1c2a) | [Release](https://github.com/actions/download-artifact/releases/tag/v7) | test_cpp.yml, test_php_ext.yml, test_upb.yml |
| `actions/setup-dotnet` | [`3447fd6`](3447fd6a9f) | [`baa11fb`](baa11fbfe1) | [Release](https://github.com/actions/setup-dotnet/releases/tag/v5) | test_csharp.yml |
| `actions/setup-java` | [`3a4f6e1`](3a4f6e1af5) | [`be666c2`](be666c2fcd) | [Release](https://github.com/actions/setup-java/releases/tag/v5) | test_bazel.yml |
| `actions/setup-python` | [`39cd149`](39cd14951b), [`e797f83`](e797f83bcb) | [`a309ff8`](a309ff8b42) | [Release](https://github.com/actions/setup-python/releases/tag/v6) | test_python.yml, test_upb.yml |
| `actions/stale` | [`b69b346`](b69b346013) | [`9971854`](997185467f) | [Release](https://github.com/actions/stale/releases/tag/v10) | janitor.yml |
| `actions/upload-artifact` | [`5076954`](50769540e7), [`v4`](https://github.com/actions/upload-artifact/releases/tag/v4) | [`b7c566a`](b7c566a772) | [Release](https://github.com/actions/upload-artifact/releases/tag/v6) | scorecard.yml, test_cpp.yml, test_php_ext.yml, test_ruby.yml, test_upb.yml |

## Context

Per [GitHub's announcement](https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/), Node 20 is being deprecated and runners will begin using Node 24 by default starting March 4th, 2026.

### Why this matters

- **Node 20 EOL**: April 2026
- **Node 24 default**: March 4th, 2026
- **Action**: Update to latest action versions that support Node 24

### Security Note

Actions that were previously pinned to commit SHAs remain pinned to SHAs (updated to the latest release SHA) to maintain the security benefits of immutable references.

### Testing

These changes only affect CI/CD workflow configurations and should not impact application functionality. The workflows should be tested by running them on a branch before merging.

Closes #25572

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/25572 from salmanmkc:upgrade-github-actions-node24 ef77dcfa4f
PiperOrigin-RevId: 874140973
2026-02-23 10:27:07 -08:00

222 lines
10 KiB
YAML

name: Ruby Tests
on:
workflow_call:
inputs:
continuous-run:
required: true
description: "Boolean string denoting whether this run is continuous --
empty string for presubmit, non-empty string for continuous."
type: string
safe-checkout:
required: true
description: "The SHA key for the commit we want to run over"
type: string
continuous-prefix:
required: true
description: "The string continuous-only tests should be prefixed with when displaying test
results."
type: string
permissions:
contents: read
jobs:
linux:
strategy:
fail-fast: false
matrix:
include:
# Test both FFI and Native implementations on the highest and lowest
# Ruby versions for CRuby and JRuby
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: NATIVE }
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: FFI }
- { 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, continuous-only: true }
# TODO: Remove the image property in the two entries below and update the configuration
# used by all the images the next time there is an update to the Dockerfile
- { 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-f1c24ed6acfbf6ec709b0de2f702209c9d3ac659' }
- { 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-f1c24ed6acfbf6ec709b0de2f702209c9d3ac659' }
- { 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
steps:
- name: Checkout pending changes
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/checkout@v5
with:
ref: ${{ inputs.safe-checkout }}
- name: Run tests
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
with:
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-{0}-b77fdae6d4771789dfc66a56bf8d806354e8011a', 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' || '' }}
# Useful tool for troubleshooting, but the action introduces flakes as well,
# e.g. https://github.com/actions/upload-artifact/issues/569
# - name: Archive log artifacts
# if: ${{ matrix.presubmit || inputs.test-type == 'continuous' }}
# uses: actions/upload-artifact@v6
# with:
# name: test-logs-${{ matrix.ruby }}_${{ matrix.ffi || 'NATIVE' }}
# path: logs
linux-32bit:
name: Linux 32-bit
runs-on: ubuntu-22-4core
steps:
- name: Checkout pending changes
uses: protocolbuffers/protobuf-ci/checkout@v5
with:
ref: ${{ inputs.safe-checkout }}
- name: Cross compile protoc for i386
id: cross-compile
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
with:
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
architecture: linux-i386
- name: Run tests
uses: protocolbuffers/protobuf-ci/docker@v5
with:
image: i386/ruby:3.1.6-bullseye
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
command: >-
/bin/bash -cex '
gem install bundler -v 2.6.6;
cd /workspace/ruby;
bundle;
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
rake clobber_package gem;
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake test'
linux-aarch64:
name: ${{ inputs.continuous-prefix || '' }} Linux aarch64
runs-on: ubuntu-22-4core
steps:
- name: Checkout pending changes
if: ${{ inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/checkout@v5
with:
ref: ${{ inputs.safe-checkout }}
- name: Cross compile protoc for aarch64
if: ${{ inputs.continuous-run }}
id: cross-compile
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
with:
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
architecture: linux-aarch64
- name: Run tests
if: ${{ inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/docker@v5
with:
image: arm64v8/ruby:3.1.4-buster
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
command: >-
/bin/bash -cex '
gem install bundler -v 2.6.6;
cd /workspace/ruby;
bundle;
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
rake clobber_package gem;
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake test'
macos:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
include:
# Test both FFI and Native implementations on the highest and lowest
# Ruby versions for CRuby.
# Quote versions numbers otherwise 3.0 will render as 3
- { version: "3.1", ffi: NATIVE }
- { version: "3.1", ffi: FFI }
- { version: "3.2", continuous-only: true }
- { version: "3.3", continuous-only: true }
- { version: "3.4", ffi: NATIVE }
- { version: "3.4", ffi: FFI }
- { version: "4.0", ffi: NATIVE }
- { version: "4.0", ffi: FFI }
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} MacOS Ruby ${{ matrix.version }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
runs-on: macos-14
steps:
- name: Checkout pending changes
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/checkout@v5
with:
ref: ${{ inputs.safe-checkout }}
- name: Pin Ruby version
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: ruby/setup-ruby@ae195bbe749a7cef685ac729197124a48305c1cb # v1.276.0
with:
ruby-version: ${{ matrix.version }}
- name: Validate version
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
run: ruby --version | grep ${{ matrix.version }} || (echo "Invalid Ruby version - $(ruby --version)" && exit 1)
- name: Run tests
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel@v5
with:
version: 8.0.1 # Bazel version
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: ruby_macos/${{ matrix.version }}
bazel: test //ruby/... --test_env=KOKORO_RUBY_VERSION=${{ matrix.version }} --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
# This test should always be skipped on presubmit
test_ruby_gems:
strategy:
fail-fast: false
matrix:
include:
# Test both FFI and Native implementations on the highest and lowest
# Ruby versions for CRuby and JRuby.
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: NATIVE }
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: FFI }
- { 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, continuous-only: true }
- { 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-f1c24ed6acfbf6ec709b0de2f702209c9d3ac659' }
- { 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-f1c24ed6acfbf6ec709b0de2f702209c9d3ac659' }
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI, continuous-only: true }
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
runs-on: ubuntu-latest
steps:
- name: Checkout pending changes
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/checkout@v5
with:
ref: ${{ inputs.safe-checkout }}
- name: Run tests
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
with:
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-{0}-b77fdae6d4771789dfc66a56bf8d806354e8011a', matrix.ruby) }}
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }}
bash: >
bazel --version;
ruby --version;
./regenerate_stale_files.sh $BAZEL_FLAGS;
bazel build //ruby:release //:protoc ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled' || '' }} $BAZEL_FLAGS;
gem install bazel-bin/ruby/google-protobuf-*;
bazel-bin/protoc --proto_path=src --proto_path=ruby/tests --proto_path=ruby --ruby_out=ruby tests/test_import_proto2.proto;
bazel-bin/protoc --proto_path=src --proto_path=ruby/tests --proto_path=ruby --ruby_out=ruby tests/basic_test.proto;
${{ matrix.ffi == 'FFI' && 'PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} ruby ruby/tests/basic.rb;
${{ matrix.ffi == 'FFI' && 'PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} ruby ruby/tests/implementation.rb