From 518eb116615aff545e4ccf900664644eebf33a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 21:45:59 +0100 Subject: [PATCH 01/14] Remove unused parts of CI workflow code Mentioned Rails and Ruby versions are not a part of workflow matrix anymore --- .github/workflows/ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 797dffb9..77c2d105 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,16 +42,9 @@ jobs: - name: Setup Ruby > 2.0 uses: ruby/setup-ruby@v1 - if: ${{ matrix.ruby-version != '2.0.0' }} with: ruby-version: ${{ matrix.ruby-version }} - - name: Rails 4.2 ensure bundler version - if: ${{ matrix.gemfile == 'gemfiles/rails42.gemfile' }} - run: | - gem uninstall bundler - gem install bundler -v '< 2.0.0' - - name: Bundle Install run: | export BUNDLE_GEMFILE=${{ matrix.gemfile }} From d4a058bf299838e7c45861f8e292fa3c466b9d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 21:46:26 +0100 Subject: [PATCH 02/14] Use newest versions of Ruby for given branches --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77c2d105..e93a2017 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - ruby-version: [2.5.3, 2.6.0, 2.6.6, 2.7.2] + ruby-version: [2.5.9, 2.6.0, 2.6.10, 2.7.8] gemfile: - gemfiles/rails50.gemfile - gemfiles/rails51.gemfile @@ -20,15 +20,15 @@ jobs: - gemfiles/rails61.gemfile include: - gemfile: gemfiles/rails71.gemfile - ruby-version: 3.2.2 + ruby-version: 3.2.6 - gemfile: gemfiles/rails71.gemfile - ruby-version: 3.1.1 + ruby-version: 3.1.6 - gemfile: gemfiles/rails70.gemfile - ruby-version: 3.1.1 + ruby-version: 3.1.6 - gemfile: gemfiles/rails70.gemfile - ruby-version: 3.0.3 + ruby-version: 3.0.7 - gemfile: gemfiles/rails61.gemfile - ruby-version: 3.0.3 + ruby-version: 3.0.7 steps: - uses: actions/checkout@v2 From 638a46341664fbaece99fbb1f10d0d4ce2c1673f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 21:47:26 +0100 Subject: [PATCH 03/14] Define new gemfiles for Rails v7.2 and v8.0 --- .github/workflows/ci.yml | 8 +++++++ gemfiles/rails72.gemfile | 50 ++++++++++++++++++++++++++++++++++++++++ gemfiles/rails80.gemfile | 50 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 gemfiles/rails72.gemfile create mode 100644 gemfiles/rails80.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e93a2017..0e23ad36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,14 @@ jobs: - gemfiles/rails60.gemfile - gemfiles/rails61.gemfile include: + - gemfile: gemfiles/rails80.gemfile + ruby-version: 3.4.1 + - gemfile: gemfiles/rails80.gemfile + ruby-version: 3.3.6 + - gemfile: gemfiles/rails72.gemfile + ruby-version: 3.3.6 + - gemfile: gemfiles/rails72.gemfile + ruby-version: 3.2.6 - gemfile: gemfiles/rails71.gemfile ruby-version: 3.2.6 - gemfile: gemfiles/rails71.gemfile diff --git a/gemfiles/rails72.gemfile b/gemfiles/rails72.gemfile new file mode 100644 index 00000000..856d3d37 --- /dev/null +++ b/gemfiles/rails72.gemfile @@ -0,0 +1,50 @@ +require 'rubygems/version' + +source 'https://rubygems.org' + +is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') + +gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby +gem 'jruby-openssl', platform: :jruby +gem 'rails', '~> 7.2.2' +gem 'sqlite3', platform: [:ruby, :mswin, :mingw] + +gem 'rspec-rails' + +gem 'rake' + +gem 'sidekiq' + +platforms :rbx do + gem 'minitest' + gem 'racc' + gem 'rubinius-developer_tools' +end + +gem 'sucker_punch' + +gem 'sinatra' + +gem 'database_cleaner' +gem 'delayed_job', '~> 4.1.13', require: false +gem 'generator_spec' +gem 'redis' +gem 'resque' +gem 'secure_headers', require: false +gem 'simplecov' + +unless is_jruby + # JRuby doesn't support fork, which is required for this test helper. + gem 'rspec-command' +end + +gem 'mime-types' + +gem 'webmock', require: false + +gem 'aws-sdk-sqs' +gem 'shoryuken' + +gem 'capistrano', require: false + +gemspec path: '../' diff --git a/gemfiles/rails80.gemfile b/gemfiles/rails80.gemfile new file mode 100644 index 00000000..03d6fe44 --- /dev/null +++ b/gemfiles/rails80.gemfile @@ -0,0 +1,50 @@ +require 'rubygems/version' + +source 'https://rubygems.org' + +is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') + +gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby +gem 'jruby-openssl', platform: :jruby +gem 'rails', '~> 8.0.1' +gem 'sqlite3', platform: [:ruby, :mswin, :mingw] + +gem 'rspec-rails' + +gem 'rake' + +gem 'sidekiq' + +platforms :rbx do + gem 'minitest' + gem 'racc' + gem 'rubinius-developer_tools' +end + +gem 'sucker_punch' + +gem 'sinatra' + +gem 'database_cleaner' +gem 'delayed_job', '~> 4.1.13', require: false +gem 'generator_spec' +gem 'redis' +gem 'resque' +gem 'secure_headers', require: false +gem 'simplecov' + +unless is_jruby + # JRuby doesn't support fork, which is required for this test helper. + gem 'rspec-command' +end + +gem 'mime-types' + +gem 'webmock', require: false + +gem 'aws-sdk-sqs' +gem 'shoryuken' + +gem 'capistrano', require: false + +gemspec path: '../' From f1efc75113a8460f5dccc0ead3c858e0133f1a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 21:48:07 +0100 Subject: [PATCH 04/14] Update used GH Actions to avoid some risks connected with future maintenance --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e23ad36..4db0a01b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,14 +39,14 @@ jobs: ruby-version: 3.0.7 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive - name: Start Redis - uses: supercharge/redis-github-action@1.1.0 + uses: supercharge/redis-github-action@1.8.0 with: - redis-version: 4 + redis-version: 6 - name: Setup Ruby > 2.0 uses: ruby/setup-ruby@v1 From baa5ba94b11e70356e8a6ab39aa1720cfc6666e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 21:51:15 +0100 Subject: [PATCH 05/14] Remove unused condition as Rails below v5 are not supported anymore --- spec/spec_helper.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a81c1cdf..b26e8bb7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -38,11 +38,7 @@ Rollbar::Configuration::DEFAULT_ENDPOINT = 'https://api-alt.rollbar.com/api/1/item/'.freeze end -if Gem::Version.new(Rails.version) < Gem::Version.new('5.0') - Rake::Task['dummy:db:setup'].invoke -else - Rake::Task['dummy:db:test:prepare'].invoke -end +Rake::Task['dummy:db:test:prepare'].invoke Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f } From ceccc054668c7fcc472f8681f1fd1e35638f73ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 22:05:58 +0100 Subject: [PATCH 06/14] Remove "appraisal" - it's not used since adding support for Rails v5 --- Appraisals | 19 ------------------- Gemfile | 1 - Rakefile | 1 - 3 files changed, 21 deletions(-) delete mode 100644 Appraisals diff --git a/Appraisals b/Appraisals deleted file mode 100644 index 758c7ee6..00000000 --- a/Appraisals +++ /dev/null @@ -1,19 +0,0 @@ -appraise 'rails30' do - gem 'rails', '3.0.20' -end - -appraise 'rails31' do - gem 'rails', '3.1.12' -end - -appraise 'rails32' do - gem 'rails', '3.2.21' -end - -appraise 'rails40' do - gem 'rails', '4.0.13' -end - -appraise 'rails41' do - gem 'rails', '4.1.9' -end diff --git a/Gemfile b/Gemfile index 21168daa..46926046 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,6 @@ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == ' GEMFILE_RAILS_VERSION = '~> 7.1.0'.freeze gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby -gem 'appraisal' gem 'jruby-openssl', :platform => :jruby gem 'rails', GEMFILE_RAILS_VERSION gem 'rake' diff --git a/Rakefile b/Rakefile index 8202a863..998c9168 100755 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,6 @@ require 'rubygems' require 'bundler/setup' require 'bundler/gem_tasks' require 'rspec/core/rake_task' -require 'appraisal' RSpec::Core::RakeTask.new(:spec) From 591d23827e4fc257ed355f2b103147e5a3666fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 22:09:55 +0100 Subject: [PATCH 07/14] Update default Ruby version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 46926046..3c1a195f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ # This Gemfile is compatible with Ruby 2.5.0 or greater. To test with # earlier Rubies, use the appropriate Gemfile from the ./gemfiles/ dir. -ruby '3.2.2' +ruby '3.3.6' source 'https://rubygems.org' From 685d623de187fce6b5a3ecc6a4b3cb0b8d875aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Wed, 8 Jan 2025 22:10:09 +0100 Subject: [PATCH 08/14] Use a newer hash syntax for the Gemfile --- Gemfile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 3c1a195f..98e37eda 100644 --- a/Gemfile +++ b/Gemfile @@ -13,9 +13,9 @@ ENV['CURRENT_GEMFILE'] ||= __FILE__ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') -GEMFILE_RAILS_VERSION = '~> 7.1.0'.freeze -gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby -gem 'jruby-openssl', :platform => :jruby +GEMFILE_RAILS_VERSION = '~> 7.2.0'.freeze +gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby +gem 'jruby-openssl', platform: :jruby gem 'rails', GEMFILE_RAILS_VERSION gem 'rake' if GEMFILE_RAILS_VERSION < '6.0' @@ -27,9 +27,9 @@ else end if GEMFILE_RAILS_VERSION < '6.0' - gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw] + gem 'sqlite3', '< 1.4.0', platform: [:ruby, :mswin, :mingw] else - gem 'sqlite3', '~> 1.4', :platform => [:ruby, :mswin, :mingw] + gem 'sqlite3', '~> 1.4', platform: [:ruby, :mswin, :mingw] end gem 'sidekiq', '>= 6.4.0' @@ -38,10 +38,9 @@ platforms :rbx do gem 'minitest' gem 'racc' gem 'rubinius-developer_tools' - gem 'rubysl', '~> 2.0' if RUBY_VERSION.start_with?('2') end -gem 'capistrano', :require => false +gem 'capistrano', require: false gem 'shoryuken' gem 'simplecov' gem 'sucker_punch', '~> 2.0' @@ -62,16 +61,16 @@ elsif GEMFILE_RAILS_VERSION < '5.0' end if GEMFILE_RAILS_VERSION < '6.0' - gem 'delayed_job', :require => false + gem 'delayed_job', require: false else - gem 'delayed_job', '~> 4.1', :require => false + gem 'delayed_job', '~> 4.1', require: false end gem 'generator_spec' gem 'redis', '<= 4.8.0' gem 'resque', '< 2.0.0' -gem 'rubocop', '1.15.0', :require => false # pin specific version, update manually -gem 'rubocop-performance', :require => false -gem 'secure_headers', '~> 6.3.2', :require => false +gem 'rubocop', '1.15.0', require: false # pin specific version, update manually +gem 'rubocop-performance', require: false +gem 'secure_headers', '~> 6.3.2', require: false gem 'sinatra' -gem 'webmock', :require => false +gem 'webmock', require: false gemspec From 6a91fcd2de7971cc27e9a8992ceca4412cb8b8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Thu, 9 Jan 2025 00:03:10 +0100 Subject: [PATCH 09/14] Fix typo --- spec/dummyapp/app/controllers/home_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/dummyapp/app/controllers/home_controller.rb b/spec/dummyapp/app/controllers/home_controller.rb index 5ced1b75..0c4f68ab 100644 --- a/spec/dummyapp/app/controllers/home_controller.rb +++ b/spec/dummyapp/app/controllers/home_controller.rb @@ -104,6 +104,6 @@ def custom_current_user end def recursive_current_user - Rollbar.error('Recurisve call to rollbar') + Rollbar.error('Recursive call to rollbar') end end From 9c4dad9424f6bee4a89b7176aab3ec7315b86d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Thu, 9 Jan 2025 00:03:56 +0100 Subject: [PATCH 10/14] Add generated DB files to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7c4cdb9b..3db6b62f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ lib/bundler/man vendor/bundle pkg rdoc +spec/dummyapp/db/*.sqlite3-* spec/reports test/tmp test/version_tmp @@ -25,4 +26,4 @@ tmp gemfiles/vendor -vendor \ No newline at end of file +vendor From 2538ec000082a794b7c3970260b735c053f37aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Thu, 9 Jan 2025 00:32:00 +0100 Subject: [PATCH 11/14] Remove warning caused by missing config of eager loading --- spec/dummyapp/config/environments/development.rb | 1 + spec/dummyapp/config/environments/production.rb | 1 + spec/dummyapp/config/environments/test.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/spec/dummyapp/config/environments/development.rb b/spec/dummyapp/config/environments/development.rb index 7352f3cd..2b73a8b4 100644 --- a/spec/dummyapp/config/environments/development.rb +++ b/spec/dummyapp/config/environments/development.rb @@ -5,6 +5,7 @@ # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false + config.eager_load = false # Log error messages when you accidentally call methods on nil. config.whiny_nils = true diff --git a/spec/dummyapp/config/environments/production.rb b/spec/dummyapp/config/environments/production.rb index bdac56a7..f15bdb4e 100644 --- a/spec/dummyapp/config/environments/production.rb +++ b/spec/dummyapp/config/environments/production.rb @@ -3,6 +3,7 @@ # Code is not reloaded between requests config.cache_classes = true + config.eager_load = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false diff --git a/spec/dummyapp/config/environments/test.rb b/spec/dummyapp/config/environments/test.rb index 4468de4e..785e13af 100644 --- a/spec/dummyapp/config/environments/test.rb +++ b/spec/dummyapp/config/environments/test.rb @@ -6,6 +6,7 @@ # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = true + config.eager_load = false # Configure static asset server for tests with Cache-Control for performance config.serve_static_assets = true From fa23a7cdac1c7fd7003c7670407a6013fb44b3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Thu, 9 Jan 2025 00:32:17 +0100 Subject: [PATCH 12/14] Use newer interface for "show_exceptions" as it has been changed for Rails 7.2 --- spec/dummyapp/config/environments/test.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/dummyapp/config/environments/test.rb b/spec/dummyapp/config/environments/test.rb index 785e13af..a1262481 100644 --- a/spec/dummyapp/config/environments/test.rb +++ b/spec/dummyapp/config/environments/test.rb @@ -20,7 +20,11 @@ config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false + if Gem::Version.new(Rails.version) < Gem::Version.new('7.2.0') + config.action_dispatch.show_exceptions = false + else + config.action_dispatch.show_exceptions = :none + end # Disable request forgery protection in test environment config.action_controller.allow_forgery_protection = false From 9b3efee624b074694d2f302a07a4867ae0af0c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Thu, 9 Jan 2025 00:32:30 +0100 Subject: [PATCH 13/14] Fix deprecation warning for SimpleCov formatter --- spec/spec_helper.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b26e8bb7..8e75ef2c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,8 @@ begin require 'simplecov' - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ - SimpleCov::Formatter::HTMLFormatter - ] + SimpleCov.formatter = + SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::HTMLFormatter]) SimpleCov.start do add_filter '/spec/' From fdf1feac6d30faae7ffbe58d1b9a6f18468759ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20G=C3=B3rniak?= Date: Thu, 9 Jan 2025 01:11:00 +0100 Subject: [PATCH 14/14] Use proper version of "sqlite3" for newest Rails versions --- Gemfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 98e37eda..2887d3d0 100644 --- a/Gemfile +++ b/Gemfile @@ -13,11 +13,12 @@ ENV['CURRENT_GEMFILE'] ||= __FILE__ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') -GEMFILE_RAILS_VERSION = '~> 7.2.0'.freeze +GEMFILE_RAILS_VERSION = '~> 8.0.0'.freeze gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby gem 'jruby-openssl', platform: :jruby gem 'rails', GEMFILE_RAILS_VERSION gem 'rake' + if GEMFILE_RAILS_VERSION < '6.0' gem 'rspec-rails', '~> 3.4' elsif GEMFILE_RAILS_VERSION < '7.0' @@ -26,7 +27,9 @@ else gem 'rspec-rails', '~> 6.0.3' end -if GEMFILE_RAILS_VERSION < '6.0' +if GEMFILE_RAILS_VERSION >= '8.0' + gem 'sqlite3', '~> 2.0', platform: [:ruby, :mswin, :mingw] +elsif GEMFILE_RAILS_VERSION < '6.0' gem 'sqlite3', '< 1.4.0', platform: [:ruby, :mswin, :mingw] else gem 'sqlite3', '~> 1.4', platform: [:ruby, :mswin, :mingw] @@ -65,6 +68,7 @@ if GEMFILE_RAILS_VERSION < '6.0' else gem 'delayed_job', '~> 4.1', require: false end + gem 'generator_spec' gem 'redis', '<= 4.8.0' gem 'resque', '< 2.0.0'