Skip to content

Commit

Permalink
👷 Setup Appraisal
Browse files Browse the repository at this point in the history
  • Loading branch information
pboling committed Apr 24, 2024
1 parent 9b4524a commit 11c1652
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 64 deletions.
74 changes: 62 additions & 12 deletions .github/workflows/legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
36 changes: 25 additions & 11 deletions .github/workflows/supported.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.2.3
ruby 2.7.8
105 changes: 89 additions & 16 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
38 changes: 17 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/sanitize_email/engine_v6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 12 in lib/sanitize_email/engine_v6.rb

View check run for this annotation

Codecov / codecov/patch

lib/sanitize_email/engine_v6.rb#L12

Added line #L12 was not covered by tests
end
end
end
1 change: 1 addition & 0 deletions sanitize_email.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 11c1652

Please sign in to comment.