Skip to content

Modernize CI/test runner via Appraisal (mirrors u-case)#74

Merged
serradura merged 1 commit into
mainfrom
modernize-ci-matrix
May 23, 2026
Merged

Modernize CI/test runner via Appraisal (mirrors u-case)#74
serradura merged 1 commit into
mainfrom
modernize-ci-matrix

Conversation

@serradura

Copy link
Copy Markdown
Member

Summary

Brings the kind gem's test runner up to par with the modernized u-case + u-attributes gems.

CI matrix

  • Ruby: 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 4.0, head
  • ActiveModel: 6.0, 6.1, 7.0, 7.1, 7.2, 8.0, 8.1, edge (via Appraisal, gated per Ruby version)
  • Each job runs:
    • Baseline (no activemodel)
    • Per-module isolation tests (KIND_BASIC=t) + KIND_STRICT=t strict_disabled_test
    • Each applicable Rails appraisal

Infrastructure

  • Replaces bin/test + bin/prepare_coverage + the ENV-switched Gemfile with an Appraisals file and a generated gemfiles/rails_X_Y.gemfile layout.
  • Adds bin/setup, bin/matrix, and rake matrix / rake test_basic_modules tasks. The basic-modules task uses Rake's rake_test_loader.rb so it works under /bin/sh (no shell brace expansion required).
  • Workflow hardening (zizmor): explicit least-privilege permissions: { contents: read } and actions/checkout with persist-credentials: false.
  • Coverage upload swapped from CodeClimate to Qlty (token auth via QLTY_COVERAGE_TOKEN).
  • README badges swapped to Qlty equivalents; Ruby/Rails badges refreshed to >= 2.7 / >= 6.0.

Gemspec

  • required_ruby_version bumped from >= 2.1.0>= 2.7.0.
  • appraisal ~> 2.5 added as a development dependency.
  • changelog_uri metadata wired up.

Source change — lib/kind/any.rb
Ruby 4.0 changed Set#inspect from "#<Set: {:low, :high}>" to "Set[:low, :high]", which broke the regex-based stripping in Kind::Any#name. The replacement rebuilds the brace-list form directly from @values so the output stays Kind::Any{:low, :high} on every supported Ruby.

Test fixes for Ruby 3.4+/4.0 compatibility

  • Quote-agnostic regex for the private/protected method error message change (`b''b'; for #<Foo>for an instance of Foo).
  • Hash#inspect format change in Ruby 3.4 ({:foo=>:bar}{foo: :bar}): hardcoded error-message strings replaced with "#{hash.inspect} ..." interpolation so the assertion follows the runtime.

Manual setup needed on your side

  1. Create the project at qlty.sh under serradura/kind.
  2. Add QLTY_COVERAGE_TOKEN to the repo's GitHub Actions secrets (same flow as u-case).
  3. Optionally remove the legacy CC_TEST_REPORTER_ID secret if still present.

Test plan

  • CI passes the full 8-Ruby × N-Rails matrix
  • Locally verified on Ruby 4.0.1: baseline (196 tests) + all KIND_BASIC modules + rails-8-1 + rails-edge all green
  • Qlty badge resolves after merge to main

🤖 Generated with Claude Code

- Replace bin/test + bin/prepare_coverage + per-Ruby ENV-switched Gemfile
  with an Appraisal-driven setup
- Add Appraisals file gated on RUBY_VERSION (activemodel 6.0..8.1 + edge)
- Rewrite GitHub Actions matrix: Ruby 2.7..4.0+head, conditional Rails
  steps, plus baseline + per-module (KIND_BASIC) + KIND_STRICT runs
- Add bin/matrix, rake matrix, and rake test_basic_modules tasks
- Bump gemspec required_ruby_version to >= 2.7.0; add appraisal dev dep
- Workflow hardening: explicit permissions: contents: read +
  actions/checkout persist-credentials: false
- Switch coverage upload from CodeClimate to Qlty (token-auth)
- Replace CodeClimate badges with Qlty badges; refresh Ruby/Rails badges

Ruby 3.4+/4.0 compatibility fixes:
- lib/kind/any.rb: Set#inspect format changed in Ruby 4.0
  ("#<Set: {...}>" -> "Set[...]"); rebuild the brace-list form from
  the values directly so the Kind::Any name stays "Kind::Any{:low, :high}"
  across Ruby versions
- Tests: quote-agnostic regex for the private/protected method error
  message format change in 3.4
- Tests: derive hash-in-message expectations from Hash#inspect to
  survive the 3.4 hash-literal display change
- Add ostruct to Gemfile guarded by RUBY_VERSION >= 3.5

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@serradura serradura self-assigned this May 23, 2026
@serradura serradura merged commit 8d5e158 into main May 23, 2026
8 checks passed
@serradura serradura deleted the modernize-ci-matrix branch May 23, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant