From 256e4f8d85a80b7c9d7e395dccd6309e58bbcc48 Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Mon, 30 Nov 2026 15:27:45 +0000 Subject: [PATCH 1/2] ci: test against newest Rails and Rack Add an unlocked Gemfile and CI job that resolves the newest activerecord, actionpack, railties, and rack allowed by the gemspec on every run. Existing locked jobs are unchanged. --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ .gitignore | 1 + gemfiles/latest_rails.gemfile | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 gemfiles/latest_rails.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b97d352..e6ab07a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,6 +155,26 @@ jobs: bundler-cache: true - run: bundle exec rake standard rubocop rbs steep security + latest_rails: + runs-on: ubuntu-latest + timeout-minutes: 15 + env: + BUNDLE_GEMFILE: gemfiles/latest_rails.gemfile + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1 + with: + ruby-version: "4.0" + bundler-cache: false + - run: bundle install --jobs 4 + - name: Show resolved Rails and Rack + run: | + for gem in activerecord actionpack railties rack; do + bundle info "$gem" + done + - run: bundle exec rake test + - run: bundle exec rake at_least_once + release: if: startsWith(github.ref, 'refs/tags/v') needs: diff --git a/.gitignore b/.gitignore index ebd9bc7..f6d1c79 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.claude /.codex /node_modules +/gemfiles/*.lock diff --git a/gemfiles/latest_rails.gemfile b/gemfiles/latest_rails.gemfile new file mode 100644 index 0000000..fe46c7f --- /dev/null +++ b/gemfiles/latest_rails.gemfile @@ -0,0 +1,14 @@ +# Unlocked appraisal of the newest activerecord, actionpack, railties, and +# rack the gemspec's >= bounds allow. CI resolves this Gemfile fresh on every +# run; do not commit a lockfile. +source "https://rubygems.org" + +gemspec path: ".." + +group :development, :test do + gem "activejob", ">= 7.1", require: false + gem "mysql2", ">= 0.5", require: false + gem "pg", ">= 1.5", require: false + gem "redis", ">= 5.0", require: false + gem "sqlite3", ">= 2.1", require: false +end From dd38852e9fabb228049724ac489c2e6ccab6d2d1 Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Mon, 30 Nov 2026 15:43:56 +0000 Subject: [PATCH 2/2] test: honor BUNDLE_GEMFILE in subprocesses Child processes were hard-coded to the root Gemfile, so the unlocked latest-Rails CI job would either miss those gems or test the lockfile instead. Preserve and expand the selected bundle path. --- test/integration/active_record_load_timing_test.rb | 2 +- test/integration/cli_test.rb | 6 +++--- test/integration/load_contract_test.rb | 2 +- test/test_helper.rb | 12 ++++++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/test/integration/active_record_load_timing_test.rb b/test/integration/active_record_load_timing_test.rb index 1121971..591da4c 100644 --- a/test/integration/active_record_load_timing_test.rb +++ b/test/integration/active_record_load_timing_test.rb @@ -34,7 +34,7 @@ class ActiveRecordLoadTimingTest < ActiveSupport::TestCase # before the question was asked. def probe_result output, error_output, status = Open3.capture3( - { "BUNDLE_GEMFILE" => gem_root("Gemfile") }, + { "BUNDLE_GEMFILE" => bundle_gemfile }, Gem.ruby, "-e", probe, diff --git a/test/integration/cli_test.rb b/test/integration/cli_test.rb index 8650911..780c367 100644 --- a/test/integration/cli_test.rb +++ b/test/integration/cli_test.rb @@ -84,7 +84,7 @@ class CLITest < ActiveSupport::TestCase dummy_root = File.expand_path("../dummy", __dir__) _output, error_output, status = Open3.capture3( { - "BUNDLE_GEMFILE" => File.expand_path("../../Gemfile", __dir__), + "BUNDLE_GEMFILE" => bundle_gemfile, "RAILS_ENV" => "test", "SOLID_OBJECTS_DUMMY_DATABASE" => File.join(directory, "dummy.sqlite3") }, @@ -105,7 +105,7 @@ class CLITest < ActiveSupport::TestCase database = File.join(directory, "dummy.sqlite3") completed = File.join(directory, "completed") environment = { - "BUNDLE_GEMFILE" => File.expand_path("../../Gemfile", __dir__), + "BUNDLE_GEMFILE" => bundle_gemfile, "RAILS_ENV" => "test", "SOLID_OBJECTS_CLI_WORKER_PROBE" => completed, "SOLID_OBJECTS_DUMMY_DATABASE" => database @@ -159,7 +159,7 @@ class CLITest < ActiveSupport::TestCase def worker_environment(directory, probe) { - "BUNDLE_GEMFILE" => File.expand_path("../../Gemfile", __dir__), + "BUNDLE_GEMFILE" => bundle_gemfile, "RAILS_ENV" => "test", "SOLID_OBJECTS_CLI_WORKER_PROBE" => probe, "SOLID_OBJECTS_DUMMY_DATABASE" => File.join(directory, "dummy.sqlite3") diff --git a/test/integration/load_contract_test.rb b/test/integration/load_contract_test.rb index 9e413d7..fbb389f 100644 --- a/test/integration/load_contract_test.rb +++ b/test/integration/load_contract_test.rb @@ -53,7 +53,7 @@ class LoadContractTest < ActiveSupport::TestCase def undefined_after_require @undefined_after_require ||= begin output, error_output, status = Open3.capture3( - { "BUNDLE_GEMFILE" => gem_root("Gemfile") }, + { "BUNDLE_GEMFILE" => bundle_gemfile }, Gem.ruby, "-e", probe, diff --git a/test/test_helper.rb b/test/test_helper.rb index dd91022..968349e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -13,4 +13,16 @@ class ActiveSupport::TestCase SolidObjects.configuration.authorize_query = ->(**) { true } SolidObjects.configuration.authorize_destroy = ->(**) { true } end + + private + + # Prefer the bundle this process was launched with so CI jobs that set + # BUNDLE_GEMFILE also exercise that bundle in child processes. Expand the + # path because some children change directories. + def bundle_gemfile + selected = ENV["BUNDLE_GEMFILE"] + return File.expand_path(selected) unless selected.nil? || selected.empty? + + File.expand_path("../Gemfile", __dir__) + end end