diff --git a/.github/workflows/legacy.yml b/.github/workflows/legacy.yml index 67f2952..38dfe36 100644 --- a/.github/workflows/legacy.yml +++ b/.github/workflows/legacy.yml @@ -22,7 +22,7 @@ concurrency: jobs: test: - name: Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }} + name: Ruby ${{ matrix.ruby }} and ${{ matrix.appraisal }} ${{ matrix.name_extra || '' }} if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')" env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile @@ -31,18 +31,64 @@ jobs: matrix: experimental: [false] rubygems: - - "2.7.11" + - "3.3.27" bundler: - none gemfile: - vanilla - ruby: - - "3.0" - - "2.7" - - "2.6" - - "2.5" - - "2.4" - - "2.3" + include: + - ruby: "3.0" + appraisal: "rails-7-1" + - ruby: "3.0" + appraisal: "rails-7-0" + - ruby: "3.0" + appraisal: "rails-6-1" + - ruby: "3.0" + appraisal: "rails-6-1" + - ruby: "2.7" + appraisal: "rails-7-1" + - ruby: "2.7" + appraisal: "rails-7-0" + - ruby: "2.7" + appraisal: "rails-6-1" + - ruby: "2.7" + appraisal: "rails-6-0" + - ruby: "2.7" + appraisal: "rails-5-2" + - ruby: "2.6" + appraisal: "rails-6-1" + - ruby: "2.6" + appraisal: "rails-6-0" + - ruby: "2.6" + appraisal: "rails-5-2" + - ruby: "2.5" + appraisal: "rails-6-1" + - ruby: "2.5" + appraisal: "rails-6-0" + - ruby: "2.5" + appraisal: "rails-5-2" + - ruby: "2.5" + appraisal: "rails-5-1" + - ruby: "2.4" + appraisal: "rails-5-2" + - ruby: "2.4" + appraisal: "rails-5-1" + - ruby: "2.4" + appraisal: "rails-5-0" + - ruby: "2.4" + appraisal: "rails-4-2" + - ruby: "2.3" + appraisal: "rails-5-2" + - ruby: "2.3" + appraisal: "rails-5-1" + - ruby: "2.3" + appraisal: "rails-5-0" + - ruby: "2.3" + appraisal: "rails-4-2" + - ruby: "2.3" + appraisal: "rails-4-1" + - ruby: "2.3" + appraisal: "rails-4-0" runs-on: ubuntu-20.04 continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }} steps: @@ -54,6 +100,10 @@ jobs: ruby-version: ${{ matrix.ruby }} rubygems: ${{ matrix.rubygems }} bundler: ${{ matrix.bundler }} - bundler-cache: true - - name: Run tests - run: bundle exec rake test + bundler-cache: false + - name: Bundle for Appraisal ${{ matrix.appraisal }} + run: bundle + - name: Install Appraisal ${{ matrix.appraisal }} dependencies + run: bundle exec appraisal ${{ matrix.appraisal }} bundle + - name: Run tests ${{ matrix.appraisal }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec rake test diff --git a/.github/workflows/supported.yml b/.github/workflows/supported.yml index 1ad6841..a16d6d4 100644 --- a/.github/workflows/supported.yml +++ b/.github/workflows/supported.yml @@ -41,24 +41,38 @@ jobs: - latest gemfile: - vanilla - ruby: + include: + - ruby: "3.3" + appraisal: "rails-7-1" + - ruby: "3.3" + appraisal: "rails-7-0" + - ruby: "3.2" + appraisal: "rails-7-1" + - ruby: "3.2" + appraisal: "rails-7-0" #- '3.1' - 3.1 tests are run by coverage.yml - - '3.2' - - '3.3' - - truffleruby - - jruby - + - ruby: "truffleruby" + appraisal: "rails-7-1" + - ruby: "jruby" + appraisal: "rails-7-1" steps: - name: Checkout uses: actions/checkout@v4 - + - uses: actions/cache@v4 + id: cache + with: + path: path/to/dependencies + key: ${{ runner.os }}-${{matrix.ruby}}-${{matrix.appraisal}}-${{ hashFiles('gemfiles/*.gemfile.lock') }} - name: Setup Ruby & Bundle uses: ruby/setup-ruby@v1 with: ruby-version: "${{ matrix.ruby }}" rubygems: "${{ matrix.rubygems }}" bundler: "${{ matrix.bundler }}" - bundler-cache: true - - - name: Run tests - run: bundle exec rake test + bundler-cache: false + - name: Bundle for Appraisal ${{ matrix.appraisal }} + run: bundle + - name: Install Appraisal ${{ matrix.appraisal }} dependencies + run: bundle exec appraisal ${{ matrix.appraisal }} bundle + - name: Run tests ${{ matrix.appraisal }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec rake test diff --git a/.tool-versions b/.tool-versions index c1c77c3..59511e1 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 3.2.3 +ruby 2.7.8 diff --git a/Appraisals b/Appraisals index 4c87d81..0231768 100644 --- a/Appraisals +++ b/Appraisals @@ -1,29 +1,102 @@ # frozen_string_literal: true +# NOTE(2024-04-24): Current release of rake v13 supports Ruby >= 2.3 +# NOTE(2024-04-24): Current release of json v2 supports Ruby >= 2.3 + +# Compat: Ruby >= 1.9.3 +# Test Matrix: +# - Ruby 2.3 +appraise "rails-4-0" do + gem "actionmailer", "~> 4.0.13" + gem "railties", "~> 4.0.13" +end + +# Compat: Ruby >= 1.9.3 +# Test Matrix: +# - Ruby 2.3 +appraise "rails-4-1" do + gem "actionmailer", "~> 4.1.16" + gem "railties", "~> 4.1.16" +end + +# Compat: Ruby >= 1.9.3 +# Test Matrix: +# - Ruby 2.3 +# - Ruby 2.4 appraise "rails-4-2" do - gem "actionmailer", "~> 4.2.0" - gem "railties", "~> 4.2.0" - gem "json", "~> 2.0" - gem "rake", "~> 11.0" + gem "actionmailer", "~> 4.2.11.3" + gem "railties", "~> 4.2.11.3" end +# Compat: Ruby >= 2.2.2 +# Test Matrix: +# - Ruby 2.3 +# - Ruby 2.4 appraise "rails-5-0" do - gem "actionmailer", "~> 5.0.0" - gem "railties", "~> 5.0.0" - gem "json", "~> 2.0" - gem "rake", "~> 12.0" + gem "actionmailer", "~> 5.0.7.2" + gem "railties", "~> 5.0.7.2" end +# Compat: Ruby >= 2.2.2 +# Test Matrix: +# - Ruby 2.3 +# - Ruby 2.4 +# - Ruby 2.5 appraise "rails-5-1" do - gem "actionmailer", "~> 5.1.0" - gem "railties", "~> 5.1.0" - gem "json", "~> 2.0" - gem "rake", "~> 12.0" + gem "actionmailer", "~> 5.1.7" + gem "railties", "~> 5.1.7" end +# Compat: Ruby >= 2.2.2 +# Test Matrix: +# - Ruby 2.3 +# - Ruby 2.4 +# - Ruby 2.5 +# - Ruby 2.6 +# - Ruby 2.7 appraise "rails-5-2" do - gem "actionmailer", "~> 5.2.0" - gem "railties", "~> 5.2.0" - gem "json", "~> 2.0" - gem "rake", "~> 12.0" + gem "actionmailer", "~> 5.2.8.1" + gem "railties", "~> 5.2.8.1" +end + +# Compat: Ruby >= 2.5 +# Test Matrix: +# - Ruby 2.5 +# - Ruby 2.6 +# - Ruby 2.7 +appraise "rails-6-0" do + gem "actionmailer", "~> 6.0.6.1" + gem "railties", "~> 6.0.6.1" +end + +# Compat: Ruby >= 2.5 +# Test Matrix: +# - Ruby 2.5 +# - Ruby 2.6 +# - Ruby 2.7 +# - Ruby 3.0 +appraise "rails-6-1" do + gem "actionmailer", "~> 6.1.7.7" + gem "railties", "~> 6.1.7.7" +end + +# Compat: Ruby >= 2.7 +# Test Matrix: +# - Ruby 2.7 +# - Ruby 3.0 +# - Ruby 3.1 +appraise "rails-7-0" do + gem "actionmailer", "~> 7.0.8.1" + gem "railties", "~> 7.0.8.1" +end + +# Compat: Ruby >= 2.7 +# Test Matrix: +# - Ruby 2.7 +# - Ruby 3.0 +# - Ruby 3.1 +# - Ruby 3.2 +appraise "rails-7-1" do + gem "actionmailer", "~> 7.1.3.2" + gem "railties", "~> 7.1.3.2" end diff --git a/Gemfile b/Gemfile index 1e7c8c2..9a2cfa0 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,13 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } # Specify your gem's dependencies in sanitize_email.gemspec gemspec +# Appraisals is having a *rough* time upgrading to Ruby 3, and worse upgrading past bundler v2.3. +# Changes in Bundler 2.4 and/or 2.5 are causing many issues, and that's why we use git, +# as some of the issues are fixed there. +# See - https://github.com/thoughtbot/appraisal/issues/214 +# See - https://github.com/thoughtbot/appraisal/issues/218 +gem "appraisal", "~> 2", github: "thoughtbot/appraisal" + platform :mri do # Debugging gem "byebug", ">= 11" diff --git a/Gemfile.lock b/Gemfile.lock index 555e7b2..e3a7f2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,12 @@ +GIT + remote: https://github.com/thoughtbot/appraisal + revision: f5e31c48a1dda036a2c13663fad1b657a0953f5d + specs: + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + PATH remote: . specs: @@ -83,10 +92,6 @@ GEM mutex_m tzinfo (~> 2.0) ansi (1.5.0) - appraisal (2.5.0) - bundler - rake - thor (>= 0.14.0) ast (2.4.2) base64 (0.2.0) bigdecimal (3.1.7) @@ -158,6 +163,7 @@ GEM net-smtp marcel (1.0.4) mini_mime (1.1.5) + mini_portile2 (2.8.6) minitest (5.22.3) mutex_m (0.2.0) net-imap (0.4.10) @@ -170,18 +176,11 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.1) - nokogiri (1.16.4-aarch64-linux) - racc (~> 1.4) - nokogiri (1.16.4-arm-linux) + nokogiri (1.16.4) + mini_portile2 (~> 2.8.2) racc (~> 1.4) nokogiri (1.16.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86-linux) - racc (~> 1.4) - nokogiri (1.16.4-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) - racc (~> 1.4) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -236,7 +235,7 @@ GEM rainbow (>= 2.0, < 4.0) rexml (~> 3.1) regexp_parser (2.9.0) - reline (0.5.2) + reline (0.5.3) io-console (~> 0.5) rexml (3.2.6) rspec (3.13.0) @@ -365,17 +364,14 @@ GEM zeitwerk (2.6.13) PLATFORMS - aarch64-linux - arm-linux - arm64-darwin - x86-linux - x86_64-darwin - x86_64-linux + arm64-darwin-23 + ruby DEPENDENCIES actionmailer (>= 3) - appraisal (~> 2) + appraisal (~> 2)! byebug (>= 11) + json (~> 2.7) kettle-soup-cover (~> 1.0, >= 1.0.2) rails (>= 3.0, <= 8) rake (>= 12) diff --git a/lib/sanitize_email/engine_v6.rb b/lib/sanitize_email/engine_v6.rb index adba025..90df307 100644 --- a/lib/sanitize_email/engine_v6.rb +++ b/lib/sanitize_email/engine_v6.rb @@ -5,11 +5,11 @@ module SanitizeEmail # For Rails >= 6.0 - class EngineV5 < ::Rails::Engine - config.to_prepare do + class EngineV6 < ::Rails::Engine + config.to_prepare do |app| # For the reasoning behind the difference between v5 and v6 engines, # - see: https://github.com/rails/rails/issues/36546#issuecomment-850888284 - config.action_mailer.register_interceptor(SanitizeEmail::Bleach) + Rails.application.config.action_mailer.register_interceptor(SanitizeEmail::Bleach) end end end diff --git a/sanitize_email.gemspec b/sanitize_email.gemspec index 22742a0..cd2be06 100644 --- a/sanitize_email.gemspec +++ b/sanitize_email.gemspec @@ -58,6 +58,7 @@ Gem::Specification.new do |spec| # Development Dependencies spec.add_development_dependency("actionmailer", ">= 3") spec.add_development_dependency("appraisal", "~> 2") + spec.add_development_dependency("json", "~> 2.7") spec.add_development_dependency("rails", ">= 3.0", "<= 8") spec.add_development_dependency("rake", ">= 12") spec.add_development_dependency("rdoc", ">= 3.12")