Skip to content

Commit

Permalink
Support rails.7.2 & update CI to run on Ruby 3 x Rails 6 & 7 (#2)
Browse files Browse the repository at this point in the history
* Support Rails 7.2

* Bumped ruby version requirement to 3.0.0

* Rubocop Ruby target as well

* remove redundant sort

* Update Rakefile

* Update test/rails_test.rb

* chore: update CI to run on Ruby 3 x Rails 6 & 7 (#3)

* chore: add appraisal

* update CI to run on ruby/rails matrix

* continue on error

* no need for dark magic rails test?

* Fixed rubocop

* don't use deprecated OpenStruct

* exclude ruby head / rails 6.1

---------

Co-authored-by: Lud <[email protected]>
  • Loading branch information
mohammed-io and swiknaba authored Oct 11, 2024
1 parent b25a3bd commit 8b854c2
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 87 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,29 @@ on:
pull_request:

jobs:
rspec:
tests:
name: "RSpec @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
runs-on: ubuntu-latest
continue-on-error: true
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
strategy:
matrix:
ruby:
- "3.0.7"
- "3.1.5"
- "3.1"
- "3.3"
- "head"
rails:
- "6.1"
- "7.1"
- "7.2"
exclude:
- ruby: "3.3"
rails: "6.1"
- ruby: "head"
rails: "6.1"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -24,15 +38,20 @@ jobs:
- name: Run rspec
run: bundle exec rake test

rubocop:
linters:
name: "Rubocop @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
runs-on: ubuntu-latest
continue-on-error: true
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
strategy:
matrix:
ruby:
- "3.0.7"
- "3.1.5"
- "head"
rails:
- "7.2"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
/tmp/
Gemfile.lock
*.gem
.ruby-version
gemfiles/*.lock
6 changes: 1 addition & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.6
TargetRubyVersion: 3.0

Style/ClassAndModuleChildren:
Exclude:
Expand All @@ -23,10 +23,6 @@ Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Style/AccessorGrouping:
EnforcedStyle: separated
Style/OpenStructUse:
Exclude:
- test/*_test.rb
- test/**/*_test.rb

Layout/LineLength:
Exclude:
Expand Down
13 changes: 13 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

SUPPORTED_RAILS_VERSIONS = %w[
6.1
7.1
7.2
].freeze

SUPPORTED_RAILS_VERSIONS.each do |version|
appraise "rails-#{version}" do
gem 'rails', "~> #{version}"
end
end
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in diffcrypt.gemspec
gemspec

gem 'appraisal'
gem 'minitest', '~> 5.0'
gem 'minitest-reporters', '~> 1.6.0'
gem 'rake', '~> 13.2'
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ end
task default: :test

path = File.expand_path(__dir__)
Dir.glob("#{path}/lib/diffcrypt/tasks/**/*.rake").sort.each { |f| load f }
Dir.glob("#{path}/lib/diffcrypt/tasks/**/*.rake").each { load(_1) }
4 changes: 2 additions & 2 deletions diffcrypt.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
spec.description = 'Diffable encrypted configuration files that can be safely committed into a git repository'
spec.homepage = 'https://github.com/diffcrypt/diffcrypt-ruby'
spec.license = 'MIT'
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')

# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"

Expand All @@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
spec.executables = %w[diffcrypt]
spec.require_paths = ['lib']

spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 7.2'
spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 7.3'
spec.add_runtime_dependency 'thor', '>= 0.20', '< 2'
spec.metadata['rubygems_mfa_required'] = 'true'
end
16 changes: 16 additions & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'

gem 'appraisal'
gem 'minitest', '~> 5.0'
gem 'minitest-reporters', '~> 1.6.0'
gem 'rails', '~> 6.1'
gem 'rake', '~> 13.2'
gem 'rubocop', '~> 1.25.1'
gem 'simplecov', '~> 0.22.0', require: false
gem 'simplecov-lcov', '< 0.9'

gemspec path: '../'
16 changes: 16 additions & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'

gem 'appraisal'
gem 'minitest', '~> 5.0'
gem 'minitest-reporters', '~> 1.6.0'
gem 'rails', '~> 7.1'
gem 'rake', '~> 13.2'
gem 'rubocop', '~> 1.25.1'
gem 'simplecov', '~> 0.22.0', require: false
gem 'simplecov-lcov', '< 0.9'

gemspec path: '../'
16 changes: 16 additions & 0 deletions gemfiles/rails_7.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source 'https://rubygems.org'

gem 'appraisal'
gem 'minitest', '~> 5.0'
gem 'minitest-reporters', '~> 1.6.0'
gem 'rails', '~> 7.2'
gem 'rake', '~> 13.2'
gem 'rubocop', '~> 1.25.1'
gem 'simplecov', '~> 0.22.0', require: false
gem 'simplecov-lcov', '< 0.9'

gemspec path: '../'
6 changes: 3 additions & 3 deletions test/diffcrypt/rails/application_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
class MockApplication
include Diffcrypt::Rails::ApplicationHelper

Config = Struct.new(:require_master_key)

def config
OpenStruct.new(
require_master_key: true,
)
Config.new(true)
end
end

Expand Down
68 changes: 0 additions & 68 deletions test/rails_test.rb

This file was deleted.

0 comments on commit 8b854c2

Please sign in to comment.