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 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