ruby-sdk/.github/workflows/ci.yml
Koichi ITO c4c73e05f5 Fix a SyntaxError on Ruby 2.7.0 caused by arguments forwarding syntax
## Motivation and Context

The gemspec already declares `required_ruby_version >= 2.7.0`, but `ServerContext` used
the `...` arguments forwarding syntax in `method_missing`. That syntax was added in Ruby 2.7.3,
so requiring the gem raised a `SyntaxError` on Ruby 2.7.0 through 2.7.2, and the library could not
be loaded at all.

RuboCop did not catch this because its Parser backend runs on Ruby 2.7.8, where the syntax is valid.
CI missed it too because the test matrix tested `2.7`, which resolves to the latest 2.7.x rather than
the declared minimum.

## How Has This Been Tested?

Forward arguments explicitly with `*args, **kwargs, &block` so the method loads on Ruby 2.7.0,
and pin the CI test matrix to 2.7.0 so the suite runs against the declared minimum instead of
the latest 2.7.x.

Running the suite on 2.7.0 also requires a `Hash.ruby2_keywords_hash?` shim in the test helper,
since mocha would otherwise raise a `NoMethodError` on that version.

## Breaking Changes

None.

Closes #418
2026-06-20 01:01:07 +09:00

54 lines
1.6 KiB
YAML

name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
entry:
- { ruby: '2.7.0', allowed-failure: false } # Minimum supported Ruby version.
- { ruby: '3.0', allowed-failure: false }
- { ruby: '3.1', allowed-failure: false }
- { ruby: '3.2', allowed-failure: false }
- { ruby: '3.3', allowed-failure: false }
- { ruby: '3.4', allowed-failure: false }
- { ruby: '4.0', allowed-failure: false }
- { ruby: 'head', allowed-failure: true }
name: Test Ruby ${{ matrix.entry.ruby }}
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
bundler-cache: true
- run: bundle exec rake test
continue-on-error: ${{ matrix.entry.allowed-failure }}
rubocop:
runs-on: ubuntu-latest
permissions:
contents: read
name: RuboCop
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 4.0 # Specify the latest supported Ruby version.
bundler-cache: true
- run: bundle exec rake rubocop
yard:
runs-on: ubuntu-latest
permissions:
contents: read
name: YARD Documentation
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 4.0 # Specify the latest supported Ruby version.
bundler-cache: true
- run: bundle exec yard --no-output