From 66a78f4fa646aa9cf347d45bfcbf81c574048df9 Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Sun, 10 Nov 2024 20:57:39 -0500 Subject: [PATCH] Make rails 8 work... maybe --- .github/workflows/ci.yml | 1 - .github/workflows/examples.yml | 21 +++++++++++++++---- Gemfile | 16 +++++++++++++-- flipper-active_record.gemspec | 2 +- flipper-active_support_cache_store.gemspec | 2 +- script/test | 24 ++++++++++++++++++---- test_rails/system/test_help_test.rb | 1 + 7 files changed, 54 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8775e0503..2b2040f05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,6 @@ jobs: - ruby: "3.3" rails: "6.1.0" env: - SQLITE3_VERSION: 1.4.1 REDIS_URL: redis://localhost:6379/0 CI: true RAILS_VERSION: ${{ matrix.rails }} diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index db747a826..f77433622 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -8,7 +8,7 @@ jobs: services: redis: image: redis - ports: ['6379:6379'] + ports: ["6379:6379"] options: >- --health-cmd "redis-cli ping" --health-interval 10s @@ -16,9 +16,23 @@ jobs: --health-retries 5 strategy: matrix: - ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3'] - rails: ['5.2', '6.0.0', '6.1.0', '7.0.0', '7.1.0'] + ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"] + rails: ["5.2", "6.0.0", "6.1.0", "7.0.0", "7.1.0", "7.2.0", "8.0.0"] exclude: + - ruby: "2.6" + rails: "8.0.0" + - ruby: "2.7" + rails: "8.0.0" + - ruby: "3.0" + rails: "8.0.0" + - ruby: "3.1" + rails: "8.0.0" + - ruby: "2.6" + rails: "7.2.0" + - ruby: "2.7" + rails: "7.2.0" + - ruby: "3.0" + rails: "7.2.0" - ruby: "2.6" rails: "7.1.0" - ruby: "2.6" @@ -44,7 +58,6 @@ jobs: - ruby: "3.3" rails: "6.1.0" env: - SQLITE3_VERSION: 1.4.1 REDIS_URL: redis://localhost:6379/0 CI: true RAILS_VERSION: ${{ matrix.rails }} diff --git a/Gemfile b/Gemfile index cea81923e..ef2eabb7f 100644 --- a/Gemfile +++ b/Gemfile @@ -6,14 +6,26 @@ Dir['flipper-*.gemspec'].each do |gemspec| gemspec(name: "flipper-#{plugin}", development_group: plugin) end +rails_version = ENV['RAILS_VERSION'] || '8.0' +sqlite3_version = ENV['SQLITE3_VERSION'] || case rails_version +when /8\.\d+/ + '2.1.0' +when /7\.\d+/ + '1.4.1' +when /6\.\d+/ + '1.4.1' +when /5\.\d+/ + '1.3.11' +end + gem 'debug' gem 'rake' gem 'statsd-ruby', '~> 1.2.1' gem 'rspec', '~> 3.0' gem 'rack-test' gem 'rackup' -gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.4.1'}" -gem 'rails', "~> #{ENV['RAILS_VERSION'] || '7.1'}" +gem 'sqlite3', "~> #{sqlite3_version}" +gem 'rails', "~> #{rails_version}" gem 'minitest', '~> 5.18' gem 'minitest-documentation' gem 'webmock' diff --git a/flipper-active_record.gemspec b/flipper-active_record.gemspec index 1c9862290..a9b356e06 100644 --- a/flipper-active_record.gemspec +++ b/flipper-active_record.gemspec @@ -32,5 +32,5 @@ Gem::Specification.new do |gem| gem.metadata = Flipper::METADATA gem.add_dependency 'flipper', "~> #{Flipper::VERSION}" - gem.add_dependency 'activerecord', '>= 4.2', '< 8' + gem.add_dependency 'activerecord', '>= 4.2', '< 9' end diff --git a/flipper-active_support_cache_store.gemspec b/flipper-active_support_cache_store.gemspec index e2411b76b..01204d652 100644 --- a/flipper-active_support_cache_store.gemspec +++ b/flipper-active_support_cache_store.gemspec @@ -21,5 +21,5 @@ Gem::Specification.new do |gem| gem.metadata = Flipper::METADATA gem.add_dependency 'flipper', "~> #{Flipper::VERSION}" - gem.add_dependency 'activesupport', '>= 4.2', '< 8' + gem.add_dependency 'activesupport', '>= 4.2', '< 9' end diff --git a/script/test b/script/test index d4cec4f20..9686bf131 100755 --- a/script/test +++ b/script/test @@ -13,21 +13,37 @@ cd $(dirname "$0")/.. } export RAILS_VERSION=5.0.0 -export SQLITE3_VERSION=1.3.11 script/bootstrap || bundle update bundle exec rake export RAILS_VERSION=5.1.4 -export SQLITE3_VERSION=1.3.11 script/bootstrap || bundle update bundle exec rake export RAILS_VERSION=5.2.3 -export SQLITE3_VERSION=1.3.11 script/bootstrap || bundle update bundle exec rake export RAILS_VERSION=6.0.0 -export SQLITE3_VERSION=1.4.1 +script/bootstrap || bundle update +bundle exec rake + +export RAILS_VERSION=6.1.0 +script/bootstrap || bundle update +bundle exec rake + +export RAILS_VERSION=7.0.0 +script/bootstrap || bundle update +bundle exec rake + +export RAILS_VERSION=7.1.0 +script/bootstrap || bundle update +bundle exec rake + +export RAILS_VERSION=7.2.0 +script/bootstrap || bundle update +bundle exec rake + +export RAILS_VERSION=8.0.0 script/bootstrap || bundle update bundle exec rake diff --git a/test_rails/system/test_help_test.rb b/test_rails/system/test_help_test.rb index e5e273dcb..ea7032409 100644 --- a/test_rails/system/test_help_test.rb +++ b/test_rails/system/test_help_test.rb @@ -6,6 +6,7 @@ require "capybara/cuprite" require "flipper" require "flipper/test_help" +require "action_controller/railtie" require 'action_dispatch/system_testing/server' ActionDispatch::SystemTesting::Server.silence_puma = true