From ed7da081560bcc0e067fe41db1f4a26c29b231d5 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Mon, 2 Sep 2024 15:43:22 -0700 Subject: [PATCH 1/2] Relax gemspec to allow Rails 8.0; add Rails main branch to CI Rails 8 does not have an alpha or beta rubygems release, but it sounds like a release is imminent (to coincide with Rails World in late September). To prepare for Rails 8, this PR relaxes the Rails requirement in the audited gemspec to allow "< 8.1" instead of "< 8.0". This will allow audited to be used with Rails 8.0 when it is released. To test that audited will work with Rails 8, I added a `rails-main` Gemfile to `Appraisals` that targets the Rails main branch, and included this in the CI matrix. --- .github/workflows/ci.yml | 15 +++++++++++++++ Appraisals | 7 +++++++ audited.gemspec | 6 +++--- gemfiles/rails_main.gemfile | 10 ++++++++++ spec/rails_app/config/application.rb | 4 ++++ 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 gemfiles/rails_main.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed0a8dc4..1296c6d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: - rails70 - rails71 - rails72 + - rails_main db: [POSTGRES, MYSQL, SQLITE] exclude: # MySQL has issues on Ruby 2.3 @@ -98,6 +99,20 @@ jobs: - appraisal: rails72 ruby: "3.0" + # Rails main supports Ruby 3.1+ + - appraisal: rails_main + ruby: "2.3" + - appraisal: rails_main + ruby: "2.4" + - appraisal: rails_main + ruby: "2.5" + - appraisal: rails_main + ruby: "2.6" + - appraisal: rails_main + ruby: "2.7" + - appraisal: rails_main + ruby: "3.0" + services: postgres: image: postgres diff --git a/Appraisals b/Appraisals index 6df14d46..17d2d81e 100644 --- a/Appraisals +++ b/Appraisals @@ -44,3 +44,10 @@ appraise "rails72" do gem "pg", "~> 1.1" gem "sqlite3", ">= 1.4" end + +appraise "rails_main" do + gem "rails", github: "rails/rails", branch: "main" + gem "mysql2", "~> 0.5" + gem "pg", "~> 1.1" + gem "sqlite3", ">= 2.0" +end diff --git a/audited.gemspec b/audited.gemspec index bc1b17ff..8257f8b2 100644 --- a/audited.gemspec +++ b/audited.gemspec @@ -16,11 +16,11 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.3.0" - gem.add_dependency "activerecord", ">= 5.2", "< 8.0" - gem.add_dependency "activesupport", ">= 5.2", "< 8.0" + gem.add_dependency "activerecord", ">= 5.2", "< 8.1" + gem.add_dependency "activesupport", ">= 5.2", "< 8.1" gem.add_development_dependency "appraisal" - gem.add_development_dependency "rails", ">= 5.2", "< 8.0" + gem.add_development_dependency "rails", ">= 5.2", "< 8.1" gem.add_development_dependency "rspec-rails" gem.add_development_dependency "standard" gem.add_development_dependency "single_cov" diff --git a/gemfiles/rails_main.gemfile b/gemfiles/rails_main.gemfile new file mode 100644 index 00000000..c0bd890a --- /dev/null +++ b/gemfiles/rails_main.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", github: "rails/rails", branch: "main" +gem "mysql2", "~> 0.5" +gem "pg", "~> 1.1" +gem "sqlite3", ">= 2.0" + +gemspec name: "audited", path: "../" diff --git a/spec/rails_app/config/application.rb b/spec/rails_app/config/application.rb index 6de73c8e..a485f848 100644 --- a/spec/rails_app/config/application.rb +++ b/spec/rails_app/config/application.rb @@ -33,6 +33,10 @@ class Application < Rails::Application if Rails.gem_version >= Gem::Version.new("7.1") config.active_support.cache_format_version = 7.1 end + + if Rails.gem_version >= Gem::Version.new("8.0.0.alpha") + config.active_support.to_time_preserves_timezone = :zone + end end end From 1a7b90959a0a068805dbd6460d5d2ebd25542e13 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Wed, 2 Oct 2024 08:25:45 -0700 Subject: [PATCH 2/2] Rails 8 has dropped support for Ruby 3.1 --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1296c6d3..7a208ce3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: - appraisal: rails72 ruby: "3.0" - # Rails main supports Ruby 3.1+ + # Rails main supports Ruby 3.2+ - appraisal: rails_main ruby: "2.3" - appraisal: rails_main @@ -112,6 +112,8 @@ jobs: ruby: "2.7" - appraisal: rails_main ruby: "3.0" + - appraisal: rails_main + ruby: "3.1" services: postgres: