Skip to content

Commit

Permalink
Rails 7 support and migrating away from Travis (#61)
Browse files Browse the repository at this point in the history
* Update maintenance policy and dummy gemfiles

* Update check changelog

* First Github CI commit

* Fix missing net/smtp error

```
Error:
LayoutsTest#test_no_layout:
LoadError: cannot load such file -- net/smtp
    activesupport (6.1.6) lib/active_support/dependencies.rb:332:in `require'
    activesupport (6.1.6) lib/active_support/dependencies.rb:332:in `block in require'
    activesupport (6.1.6) lib/active_support/dependencies.rb:299:in `load_dependency'
    activesupport (6.1.6) lib/active_support/dependencies.rb:332:in `require'
    mail (2.7.1) lib/mail.rb:9:in `<module:Mail>'
```

https://stackoverflow.com/questions/70500220/rails-7-ruby-3-1-loaderror-cannot-load-such-file-net-smtp

* Patch for Rails 7

Documented in #59. This class was removed from Rails 7.

This causes an error on this line when trying to alias a method that does not exist https://github.com/zombocom/maildown/blob/cbf5b51e0867eab1ec945d38b5335f42139b0322/lib/maildown/ext/action_view.rb#L7.

The solution presented was to re-add the method. However simply doing this with a `defined?(OptimizedFileSystemResolver)` causes a load via zeitwork and also results in a crash.

The presence of this code appears to do nothing in Rails 7. It's basically a no-op that allows us to boot without erroring.
  • Loading branch information
schneems authored Jul 31, 2022
1 parent cbf5b51 commit 5de471a
Show file tree
Hide file tree
Showing 21 changed files with 812 additions and 612 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
name: Check Changelog

on:
pull_request:
types: [opened, reopened, edited, synchronize]
pull_request:
types: [opened, reopened, edited, labeled, unlabeled, synchronize]

jobs:
build:
check-changelog:
runs-on: ubuntu-latest
if: |
!contains(github.event.pull_request.body, '[skip changelog]') &&
!contains(github.event.pull_request.body, '[changelog skip]') &&
!contains(github.event.pull_request.body, '[skip ci]') &&
!contains(github.event.pull_request.labels.*.name, 'skip changelog') &&
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
!contains(github.event.pull_request.labels.*.name, 'automation')
steps:
- uses: actions/checkout@v1
- name: Check that CHANGELOG is touched
run: |
cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
- uses: actions/checkout@v3
- name: Check that CHANGELOG is touched
run: |
git fetch origin ${{ github.base_ref }} --depth 1 && \
git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
- push
- pull_request

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- '2.7'
- '3.0'
- '3.1'
# - 'head'
gemfile:
- gemfiles/rails_6_0.gemfile
- gemfiles/rails_6_1.gemfile
- gemfiles/rails_7_0.gemfile
# - gemfile: gemfiles/rails_head.gemfile
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run test
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
run: bundle exec rake test
28 changes: 16 additions & 12 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
appraise "rails-5" do
gem "rails", "5.0.7.2"
gem "sqlite3", "~> 1.3.6"
appraise "rails_5_2" do
gem "rails", "5.2.3"
gem "sqlite3", "~> 1.4"
gem 'net-smtp', require: false
end

appraise "rails-51" do
gem "rails", "5.1.7"
gem "sqlite3", "~> 1.3.6"
appraise "rails_6_0" do
gem "rails", "6.0.5"
gem "sqlite3", "~> 1.4"
gem 'net-smtp', require: false
end

appraise "rails-52" do
gem "rails", "5.2.3"
gem "sqlite3", "~> 1.3.6"
appraise "rails_6_1" do
gem "rails", "6.1.6"
gem "sqlite3", "~> 1.4"
gem 'net-smtp', require: false
end

appraise "rails-6" do
gem "rails", "6.0.0"
appraise "rails_7_0" do
gem "rails", "7.0.3"
gem "sqlite3", "~> 1.4"
end

appraise "rails-head" do
appraise "rails_head" do
gem "rails", git: "https://github.com/rails/rails.git"
gem "railties", git: "https://github.com/rails/rails.git"
gem "sqlite3", "~> 1.4"
end
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## HEAD (Unreleased)

- Add support for Rails 7 (https://github.com/zombocom/maildown/pull/61)

## 3.3.0

- Delay loading of ActionMailer to fix support for `delivery_job` config (https://github.com/codetriage/maildown/pull/56)
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Maildown

[Markdown](http://daringfireball.net/projects/markdown/syntax) for your ActionMailer-generated emails. Supports Rails 5.0+
[Markdown](http://daringfireball.net/projects/markdown/syntax) for your ActionMailer-generated emails.

Also due to the way it's implemented it extends markdown support for any other view you want to look for. It could be called `markdown-rails` or something, but this is what I named the gem and I'm sticking with it.

[![Build Status](https://travis-ci.org/codetriage/maildown.svg?branch=schneems%2F2.0.0)](https://travis-ci.org/schneems/maildown)
[![Help Contribute to Open Source](https://www.codetriage.com/schneems/maildown/badges/users.svg)](https://www.codetriage.com/schneems/maildown)

## Maintenance policy

Follows the Rails maintenance policy https://guides.rubyonrails.org/maintenance_policy.html under "Severe Security Issues". Versions of Rails still under maintenance for Severe Security Issues should be expected to work with Maildown.

## What?

- Fact: You should always send emails in `text/html` and `text/plain` at the same time
Expand Down Expand Up @@ -203,21 +207,22 @@ Features we have that they don't:
- Their gem is unmaintained, but honestly it's pretty simple and will keep working for some time.
- We have way more monkeypatches than they do 🙀.


## Test

We use the appraisal gem to generate Gemfiles. Install all dependencies with this:
We use the [appraisal gem](https://github.com/thoughtbot/appraisal) to generate Gemfiles. Install all dependencies with this:

```
$ appraisal install
$ bundle exec appraisal install
```

Run a specific suite like this:

```
$ BUNDLE_GEMFILE=gemfiles/rails_6.gemfile bundle exec rake test
$ BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rake test
```

To add a new test case modify the `Appraisals` file in root and then re-run `bundle exec appraisal install`.

## License

MIT
137 changes: 0 additions & 137 deletions gemfiles/rails_5.gemfile.lock

This file was deleted.

Loading

0 comments on commit 5de471a

Please sign in to comment.