Skip to content

Commit

Permalink
Merge pull request #5600 from heartcombo/rm-drop-support-to-old-rubie…
Browse files Browse the repository at this point in the history
…s-and-rails

Drop support to EOL rubies and Rails
  • Loading branch information
carlosantoniodasilva committed Oct 13, 2023
2 parents 4d18d81 + 63939c1 commit 5667cea
Show file tree
Hide file tree
Showing 36 changed files with 63 additions and 683 deletions.
140 changes: 1 addition & 139 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,176 +11,38 @@ jobs:
- gemfiles/Gemfile-rails-7-0
- gemfiles/Gemfile-rails-6-1
- gemfiles/Gemfile-rails-6-0
- gemfiles/Gemfile-rails-5-2
- gemfiles/Gemfile-rails-5-1
- gemfiles/Gemfile-rails-5-0
- gemfiles/Gemfile-rails-4-2
- gemfiles/Gemfile-rails-4-1
ruby:
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
- '2.4'
- '2.3'
- '2.2'
- '2.1'
env:
- DEVISE_ORM=active_record
- DEVISE_ORM=mongoid
exclude:
- gemfile: Gemfile
ruby: '2.6'
- gemfile: Gemfile
ruby: '2.5'
- gemfile: Gemfile
ruby: '2.4'
- gemfile: Gemfile
ruby: '2.3'
- gemfile: Gemfile
ruby: '2.2'
- gemfile: Gemfile
ruby: '2.1'
- gemfile: Gemfile
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.6'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.5'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.4'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.3'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.2'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.1'
- gemfile: gemfiles/Gemfile-rails-main
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-7-0
ruby: '2.6'
- gemfile: gemfiles/Gemfile-rails-7-0
ruby: '2.5'
- gemfile: gemfiles/Gemfile-rails-7-0
ruby: '2.4'
- gemfile: gemfiles/Gemfile-rails-7-0
ruby: '2.3'
- gemfile: gemfiles/Gemfile-rails-7-0
ruby: '2.2'
- gemfile: gemfiles/Gemfile-rails-7-0
ruby: '2.1'
- gemfile: gemfiles/Gemfile-rails-7-0
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-6-1
ruby: '2.4'
- gemfile: gemfiles/Gemfile-rails-6-1
ruby: '2.3'
- gemfile: gemfiles/Gemfile-rails-6-1
ruby: '2.2'
- gemfile: gemfiles/Gemfile-rails-6-1
ruby: '2.1'
- gemfile: gemfiles/Gemfile-rails-6-1
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-6-0
ruby: '3.2'
- gemfile: gemfiles/Gemfile-rails-6-0
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-6-0
ruby: '2.4'
- gemfile: gemfiles/Gemfile-rails-6-0
ruby: '2.3'
- gemfile: gemfiles/Gemfile-rails-6-0
ruby: '2.2'
- gemfile: gemfiles/Gemfile-rails-6-0
ruby: '2.1'
- gemfile: gemfiles/Gemfile-rails-6-0
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-5-2
ruby: '3.2'
- gemfile: gemfiles/Gemfile-rails-5-2
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-5-2
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-5-2
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-5-2
ruby: '2.2'
- gemfile: gemfiles/Gemfile-rails-5-2
ruby: '2.1'
- gemfile: gemfiles/Gemfile-rails-5-2
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-5-1
ruby: '3.2'
- gemfile: gemfiles/Gemfile-rails-5-1
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-5-1
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-5-1
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-5-1
ruby: '2.1'
- gemfile: gemfiles/Gemfile-rails-5-1
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-5-0
ruby: '3.2'
- gemfile: gemfiles/Gemfile-rails-5-0
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-5-0
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-5-0
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-5-0
ruby: '2.1'
- gemfile: gemfiles/Gemfile-rails-5-0
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-4-2
ruby: '3.2'
- gemfile: gemfiles/Gemfile-rails-4-2
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-4-2
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-4-2
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-4-2
ruby: '2.6'
- gemfile: gemfiles/Gemfile-rails-4-1
ruby: '3.2'
- gemfile: gemfiles/Gemfile-rails-4-1
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-4-1
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-4-1
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-4-1
ruby: '2.6'
- gemfile: gemfiles/Gemfile-rails-4-1
ruby: '2.5'
- gemfile: gemfiles/Gemfile-rails-4-1
ruby: '2.4'
# TODO: lock `ubunty-20.04` due to older Ruby version compatibility, change to `ubuntu-latest` again when dropping older Ruby support.
# https://github.com/ruby/setup-ruby/issues/496#issuecomment-1520662740
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v3
- name: Setup Bundler 1.x for Rails 4.x and Ruby <= 2.2
if: ${{ matrix.gemfile == 'gemfiles/Gemfile-rails-4-1' || matrix.gemfile == 'gemfiles/Gemfile-rails-4-2' || matrix.ruby <= '2.2' }}
run: echo "BUNDLER_VERSION=1.17.3" >> $GITHUB_ENV
- name: Setup Rubygems version as default for Ruby < 2.5
if: ${{ matrix.ruby < '2.5' }}
run: echo "RUBYGEMS_VERSION=default" >> $GITHUB_ENV
- name: Setup Rubygems version as 3.2.3 for Ruby 2.5
if: ${{ matrix.ruby == '2.5' }}
run: echo "RUBYGEMS_VERSION=3.2.3" >> $GITHUB_ENV
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs bundle install and caches installed gems automatically
bundler: ${{ env.BUNDLER_VERSION || 'default' }}
rubygems: ${{ env.RUBYGEMS_VERSION || 'latest' }}
- uses: supercharge/mongodb-github-action@1.9.0
if: ${{ matrix.env == 'DEVISE_ORM=mongoid' }}
- run: bundle exec rake
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### Unreleased

* Drop support to Ruby < 2.7
* Drop support to Rails < 6.0

* enhancements
* Removed deprecations warning output for `Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION` (@soartec-lab)

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
railties (>= 6.0.0)
responders
warden (~> 1.2.3)

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@ Please note that the command output will show the variable value being used.
### BUNDLE_GEMFILE
We can use this variable to tell bundler what Gemfile it should use (instead of the one in the current directory).
Inside the [gemfiles](https://github.com/heartcombo/devise/tree/main/gemfiles) directory, we have one for each version of Rails we support. When you send us a pull request, it may happen that the test suite breaks using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable.
For example, if the tests broke using Ruby 2.4.2 and Rails 4.1, you can do the following:
For example, if the tests broke using Ruby 3.0.0 and Rails 6.0, you can do the following:
```bash
rbenv shell 2.4.2 # or rvm use 2.4.2
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bin/test
rbenv shell 3.0.0 # or rvm use 3.0.0
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-6-0 bundle install
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-6-0 bin/test
```

You can also combine both of them if the tests broke for Mongoid:
```bash
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable DEVISE_ORM=mongoid bin/test
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-6-0 bundle install
BUNDLE_GEMFILE=gemfiles/Gemfile-rails-6-0 DEVISE_ORM=mongoid bin/test
```

### Running tests
Expand Down Expand Up @@ -172,7 +172,7 @@ Once you have solidified your understanding of Rails and authentication mechanis

## Getting started

Devise 4.0 works with Rails 4.1 onwards. Run:
Devise 4.0 works with Rails 6.0 onwards. Run:

```sh
bundle add devise
Expand Down Expand Up @@ -644,7 +644,7 @@ Unlike controller tests, integration tests do not need to supply the
`devise.mapping` `env` value, as the mapping can be inferred by the routes that
are executed in your tests.

You can read more about testing your Rails 3 - Rails 4 controllers with RSpec in the wiki:
You can read more about testing your Rails controllers with RSpec in the wiki:

* https://github.com/heartcombo/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)

Expand Down Expand Up @@ -691,9 +691,9 @@ Alternatively, you can simply run the Devise generator.

Keep in mind that those models will have completely different routes. They **do not** and **cannot** share the same controller for sign in, sign out and so on. In case you want to have different roles sharing the same actions, we recommend that you use a role-based approach, by either providing a role column or using a dedicated gem for authorization.

### ActiveJob Integration
### Active Job Integration

If you are using Rails 4.2 and ActiveJob to deliver ActionMailer messages in the
If you are using Active Job to deliver Action Mailer messages in the
background through a queuing back-end, you can send Devise emails through your
existing queue by overriding the `send_devise_notification` method in your model.

Expand Down
19 changes: 7 additions & 12 deletions bin/test
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#!/usr/bin/env ruby
$: << File.expand_path(File.expand_path('../../test', __FILE__))

# Remove this begin/rescue once Rails 4 support is removed.
begin
require 'bundler/setup'
require 'rails/test_unit/runner'
require 'rails/test_unit/reporter'
require 'rails/test_unit/line_filtering'
require 'bundler/setup'
require 'rails/test_unit/runner'
require 'rails/test_unit/reporter'
require 'rails/test_unit/line_filtering'

Rails::TestUnitReporter.executable = 'bin/test'
Rails::TestUnitReporter.executable = 'bin/test'

Rails::TestUnit::Runner.parse_options(ARGV)
Rails::TestUnit::Runner.run(ARGV)
rescue LoadError
exec 'rake'
end
Rails::TestUnit::Runner.parse_options(ARGV)
Rails::TestUnit::Runner.run(ARGV)
4 changes: 2 additions & 2 deletions devise.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Gem::Specification.new do |s|

s.files = Dir["{app,config,lib}/**/*", "CHANGELOG.md", "MIT-LICENSE", "README.md"]
s.require_paths = ["lib"]
s.required_ruby_version = '>= 2.1.0'
s.required_ruby_version = '>= 2.7.0'

s.add_dependency("warden", "~> 1.2.3")
s.add_dependency("orm_adapter", "~> 0.1")
s.add_dependency("bcrypt", "~> 3.0")
s.add_dependency("railties", ">= 4.1.0")
s.add_dependency("railties", ">= 6.0.0")
s.add_dependency("responders")

s.post_install_message = %q{
Expand Down
49 changes: 0 additions & 49 deletions gemfiles/Gemfile-rails-4-1

This file was deleted.

48 changes: 0 additions & 48 deletions gemfiles/Gemfile-rails-4-2

This file was deleted.

0 comments on commit 5667cea

Please sign in to comment.