Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with all supported Rails versions #53 #115

Merged
merged 12 commits into from
Nov 26, 2024
93 changes: 56 additions & 37 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,82 @@
name: Ruby

on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- master
- '**'
pull_request:
branches:
- master
- '**'

jobs:
build:
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby_version: [3.1, "3.0", 2.7, 2.6, jruby]
gemfile:
[
Gemfile,
gemfiles/rails_5.gemfile,
gemfiles/rails_6.gemfile,
gemfiles/rails_7.gemfile,
]
exclude:
# Ruby 3.1 is not supported by Rails 5.2.x
- ruby_version: 3.1
gemfile: gemfiles/rails_5.gemfile,
ruby:
- '3.3'
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- jruby
rails:
- rails_7.2
- rails_7.1
- rails_7.0
- rails_6.1
- rails_6.0
- rails_5.2
- rails_5.1
- rails_5.0

# Ruby 3.x is not supported by Rails 5.2.x
- ruby_version: 3.0
gemfile: gemfiles/rails_5.gemfile,
exclude:
- ruby: '2.7'
rails: 'rails_7.2'

# Ruby 2.6.x is not supported by Rails 7.0.x
- ruby_version: 2.6
gemfile: gemfiles/rails_7.gemfile
- ruby: '3.0'
rails: 'rails_5.0'
- ruby: '3.0'
rails: 'rails_5.1'
- ruby: '3.0'
rails: 'rails_5.2'
- ruby: '3.0'
rails: 'rails_7.2'

# Ruby 2.6.x is not supported by this Gemfile
- ruby_version: 2.6
gemfile: Gemfile
- ruby: '3.1'
rails: 'rails_5.0'
- ruby: '3.1'
rails: 'rails_5.1'
- ruby: '3.1'
rails: 'rails_5.2'

# JRuby is not supported by Rails 7.0.x
- ruby_version: jruby
gemfile: gemfiles/rails_7.gemfile
- ruby: '3.2'
rails: 'rails_5.0'
- ruby: '3.2'
rails: 'rails_5.1'
- ruby: '3.2'
rails: 'rails_5.2'

# JRuby is not supported by this Gemfile
- ruby_version: jruby
gemfile: Gemfile
- ruby: '3.3'
rails: 'rails_5.0'
- ruby: '3.3'
rails: 'rails_5.1'
- ruby: '3.3'
rails: 'rails_5.2'

runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true # 'bundle install' and cache
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Build and test with Rake
run: bundle exec rake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tmp/
gemfiles/*.lock
gemfiles/vendor
stdout
.DS_Store
32 changes: 28 additions & 4 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
appraise 'rails-4' do
gem 'rails', '~> 4'
appraise 'rails_5.0' do
gem 'rails', '~> 5.0.0'
end

appraise 'rails-5' do
gem 'rails', '~> 5'
appraise 'rails_5.1' do
gem 'rails', '~> 5.1.0'
end

appraise 'rails_5.2' do
gem 'rails', '~> 5.2.0'
end

appraise 'rails_6.0' do
gem 'rails', '~> 6.0.0'
end

appraise 'rails_6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'rails_7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails_7.1' do
gem 'rails', '~> 7.1.0'
end

appraise 'rails_7.2' do
gem 'rails', '~> 7.2.0'
end
31 changes: 5 additions & 26 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
source "https://rubygems.org"
gemspec

# if ::File.directory?(gem_path = "../redis-store")
# gem "redis-store", [">= 1.2.0", "< 1.4"], path: gem_path
# end

# if ::File.directory?(gem_path = "../redis-rack")
# gem "redis-rack", "~> 2.0.0.pre", path: gem_path
# end

# if ::File.directory?(gem_path = "../redis-activesupport")
# gem "redis-activesupport", '>= 4.0.0', '< 5.1', path: gem_path
# end

# if ::File.directory?(gem_path = "../redis-actionpack")
# gem "redis-actionpack", ">= 4.0.0", '< 5.1', path: gem_path
# end

version = ENV["RAILS_VERSION"] || '7'

rails = case version
when "master"
{:github => "rails/rails"}
else
"~> #{version}.0"
end

gem "rails", rails
gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git'
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem 'rake', '>= 12.3.3'
gem "redis-store-testing"
12 changes: 12 additions & 0 deletions gemfiles/rails_5.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 5.0.0"

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

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 5.1.0"

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

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 5.2.0"

gemspec path: "../"
7 changes: 0 additions & 7 deletions gemfiles/rails_5.gemfile

This file was deleted.

12 changes: 12 additions & 0 deletions gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 6.0.0"

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

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 6.1.0"

gemspec path: "../"
7 changes: 0 additions & 7 deletions gemfiles/rails_6.gemfile

This file was deleted.

12 changes: 12 additions & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 7.0.0"

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

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 7.1.0"

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

source "https://rubygems.org"

gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
gem "minitest", [">= 4.2", "< 6"]
gem "mocha", "~> 0.14.0"
gem "rake", ">= 12.3.3"
gem "redis-store-testing"
gem "rails", "~> 7.2.0"

gemspec path: "../"
7 changes: 0 additions & 7 deletions gemfiles/rails_7.gemfile

This file was deleted.

16 changes: 3 additions & 13 deletions redis-rails.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "redis-rails/version"

require_relative "lib/redis-rails/version"

Gem::Specification.new do |s|
s.name = "redis-rails"
Expand All @@ -12,18 +12,8 @@ Gem::Specification.new do |s|
s.description = %q{Redis for Ruby on Rails}
s.license = 'MIT'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.files = `git ls-files`.split("\n")

s.add_dependency "redis-activesupport", [">= 3.0", "< 8"]
s.add_dependency "redis-actionpack", [">= 3.0", "< 8"]

s.add_development_dependency 'rake', '>= 12.3.3'
s.add_development_dependency "bundler", "~> 2"
s.add_development_dependency "mocha", "~> 0.14.0"
s.add_development_dependency "minitest", [">= 4.2", "< 6"]
s.add_development_dependency "redis-store-testing"
s.add_development_dependency 'appraisal'
end