Skip to content

Commit

Permalink
Merge pull request #5 from knu/rails-7.1
Browse files Browse the repository at this point in the history
Test with Rails 7.1 and Ruby up to 3.3
  • Loading branch information
jaynetics committed Jan 12, 2024
2 parents ae5edfd + 7f4ac6f commit 78082c5
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 21 deletions.
39 changes: 30 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,48 @@ jobs:

strategy:
matrix:
ruby: [ '2.6', '2.7', '3.0', 'ruby-head' ]
activerecord: [ '5.2.6', '6.1.4.1', '7.0.1' ]
exclude:
ruby: [ '3.0', '3.1', '3.2', '3.3', 'ruby-head' ]
activerecord: [ '6.1', '7.0', '7.1' ] # rails < 6 crashes on ruby 3 due to kwargs changes
include:
- ruby: '2.6'
activerecord: '5.2'
- ruby: '2.6'
activerecord: '7.0.1' # rails 7 requires ruby >= 2.7
- ruby: '3.0'
activerecord: '5.2.6' # rails < 6 crashes on ruby 3 due to kwargs changes
activerecord: '6.1'
# rails >= 7 requires ruby >= 2.7

- ruby: '2.7'
activerecord: '5.2'
- ruby: '2.7'
activerecord: '6.1'
- ruby: '2.7'
activerecord: '7.0'
- ruby: '2.7'
activerecord: '7.1'
exclude:
# rails < 7.1 crashes on ruby >= 3.4 due to the removal of mutex_m
- ruby: 'ruby-head'
activerecord: '6.1'
- ruby: 'ruby-head'
activerecord: '5.2.6' # rails < 6 crashes on ruby 3 due to kwargs changes
activerecord: '7.0'

steps:
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
- name: Update RubyGems for Ruby 2
run: |
gem install rubygems-update -v '< 3.5' && update_rubygems
if: matrix.ruby < '3.0'
- name: Update RubyGems for Ruby 3
run: |
gem update --system
if: matrix.ruby >= '3.0'
- name: Install dependencies
run: |
BUNDLE_GEMFILE=./gemfiles/activerecord_${{matrix.activerecord}}.gemfile bundle install --jobs 4
- name: Test with activerecord ${{matrix.activerecord}}
run: BUNDLE_GEMFILE=./gemfiles/activerecord_${{matrix.activerecord}}.gemfile bundle exec rake
- uses: codecov/codecov-action@v3
if: matrix.ruby == '3.0'
if: matrix.ruby >= '3.0'
12 changes: 7 additions & 5 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# after changes, run `bundle exec appraisal install`
%w[
5.2.6
6.1.4.1
7.0.1
5.2
6.1
7.0
7.1
].each do |version|
constraint = [">= #{version}", "< #{version.sub(/\d+\z/, &:succ)}"]
appraise "activerecord-#{version}" do
gem 'activerecord', version
gem 'activerecord', constraint

group :development, :test do
gem 'rails', version
gem 'rails', constraint
remove_gem 'appraisal'
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "activerecord", "5.2.6"
gem "activerecord", [">= 5.2", "< 5.3"]

group :development, :test do
gem "rails", "5.2.6"
gem "rails", [">= 5.2", "< 5.3"]
end

gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "activerecord", "6.1.4.1"
gem "activerecord", [">= 6.1", "< 6.2"]

group :development, :test do
gem "rails", "6.1.4.1"
gem "rails", [">= 6.1", "< 6.2"]
end

gemspec path: "../"
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "activerecord", "7.0.1"
gem "activerecord", [">= 7.0", "< 7.1"]

group :development, :test do
gem "rails", "7.0.1"
gem "rails", [">= 7.0", "< 7.1"]
end

gemspec path: "../"
11 changes: 11 additions & 0 deletions gemfiles/activerecord_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", [">= 7.1", "< 7.2"]

group :development, :test do
gem "rails", [">= 7.1", "< 7.2"]
end

gemspec path: "../"
4 changes: 3 additions & 1 deletion spec/dummy_rails_app/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ module DummyRailsApp
class Application < Rails::Application
# silence warning on rails 7
if (Rails::VERSION::MAJOR >= 7 rescue false)
config.active_record.legacy_connection_handling = false
if Rails::VERSION::MINOR == 0
config.active_record.legacy_connection_handling = false
end
end
end
end

0 comments on commit 78082c5

Please sign in to comment.