Skip to content

Commit 27b1e41

Browse files
swiknabamohammed-ioMatjazKavcic
authored
Ruby 3.x, Rails 7, Rails 8, use Appraisals for tests (#143)
* Uses Appraisals to simplify testing against multiple Rails versions. * Adds tests for Rails 7 and Rails 8. * Custom fix of concurrent-ruby for Rails 6 due to ruby-concurrency/concurrent-ruby@d7ce956 * ⚠️ drop support for Ruby 2 (tests weren't run against it anymore as well) * Adds support for Ruby 3.2, 3.3., 3.4, head * Drop simple cov (high LOC coverage lulls you into a false sense of security; you want semantic coverage) closes #142 closes #137 closes #122 Thanks to co-authors @mohammed-io & @MatjazKavcic 🙇 --------- Co-authored-by: Mohammed Abdulkareem <[email protected]> Co-authored-by: Matjaz Kavcic <[email protected]>
1 parent b25a3bd commit 27b1e41

File tree

15 files changed

+140
-109
lines changed

15 files changed

+140
-109
lines changed

.github/workflows/test.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,39 @@ on:
77
pull_request:
88

99
jobs:
10-
rspec:
10+
tests:
11+
name: "RSpec @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
1112
runs-on: ubuntu-latest
13+
continue-on-error: true
14+
env:
15+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
1216
strategy:
1317
matrix:
1418
ruby:
15-
- "3.0.7"
16-
- "3.1.5"
19+
- "3.1"
20+
- "3.2"
21+
- "3.3"
22+
- "3.4"
23+
- "head"
24+
rails:
25+
- "6.1"
26+
- "7.2"
27+
- "8.0"
28+
exclude:
29+
- ruby: "3.2"
30+
rails: "6.1"
31+
- ruby: "3.3"
32+
rails: "6.1"
33+
- ruby: "3.4"
34+
rails: "6.1"
35+
- ruby: "head"
36+
rails: "6.1"
37+
- ruby: "3.1"
38+
rails: "7.2"
39+
- ruby: "3.1"
40+
rails: "8.0"
1741
steps:
18-
- uses: actions/checkout@v2
42+
- uses: actions/checkout@v4
1943
- name: Set up Ruby
2044
uses: ruby/setup-ruby@v1
2145
with:
@@ -24,15 +48,20 @@ jobs:
2448
- name: Run rspec
2549
run: bundle exec rake test
2650

27-
rubocop:
51+
linters:
52+
name: "Rubocop @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
2853
runs-on: ubuntu-latest
54+
continue-on-error: true
55+
env:
56+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
2957
strategy:
3058
matrix:
3159
ruby:
32-
- "3.0.7"
33-
- "3.1.5"
60+
- "3.4"
61+
rails:
62+
- "7.2"
3463
steps:
35-
- uses: actions/checkout@v2
64+
- uses: actions/checkout@v4
3665
- name: Set up Ruby
3766
uses: ruby/setup-ruby@v1
3867
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
/tmp/
99
Gemfile.lock
1010
*.gem
11+
.ruby-version
12+
gemfiles/*.lock

.rubocop.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AllCops:
22
NewCops: enable
3-
TargetRubyVersion: 2.6
3+
TargetRubyVersion: 3.0
44

55
Style/ClassAndModuleChildren:
66
Exclude:
@@ -23,10 +23,6 @@ Style/TrailingCommaInHashLiteral:
2323
EnforcedStyleForMultiline: consistent_comma
2424
Style/AccessorGrouping:
2525
EnforcedStyle: separated
26-
Style/OpenStructUse:
27-
Exclude:
28-
- test/*_test.rb
29-
- test/**/*_test.rb
3026

3127
Layout/LineLength:
3228
Exclude:

Appraisals

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
SUPPORTED_RAILS_VERSIONS = %w[
4+
6.1
5+
7.1
6+
7.2
7+
8.0
8+
].freeze
9+
10+
SUPPORTED_RAILS_VERSIONS.each do |version|
11+
appraise "rails-#{version}" do
12+
gem 'rails', "~> #{version}"
13+
end
14+
end

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ source 'https://rubygems.org'
55
# Specify your gem's dependencies in diffcrypt.gemspec
66
gemspec
77

8+
gem 'appraisal'
89
gem 'minitest', '~> 5.0'
910
gem 'minitest-reporters', '~> 1.6.0'
1011
gem 'rake', '~> 13.2'
1112
gem 'rubocop', '~> 1.25.1'
12-
gem 'simplecov', '~> 0.22.0', require: false # CodeClimate not compatible with 0.18+ yet - https://github.com/codeclimate/test-reporter/issues/413
13-
gem 'simplecov-lcov', '< 0.9'

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ end
1111
task default: :test
1212

1313
path = File.expand_path(__dir__)
14-
Dir.glob("#{path}/lib/diffcrypt/tasks/**/*.rake").sort.each { |f| load f }
14+
Dir.glob("#{path}/lib/diffcrypt/tasks/**/*.rake").each { load(_1) }

diffcrypt.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
1212
spec.description = 'Diffable encrypted configuration files that can be safely committed into a git repository'
1313
spec.homepage = 'https://github.com/diffcrypt/diffcrypt-ruby'
1414
spec.license = 'MIT'
15-
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
15+
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
1616

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

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

32-
spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 7.2'
32+
spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 9.0'
3333
spec.add_runtime_dependency 'thor', '>= 0.20', '< 2'
3434
spec.metadata['rubygems_mfa_required'] = 'true'
3535
end

gemfiles/rails_6.1.gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
# This file was generated by Appraisal
4+
5+
source 'https://rubygems.org'
6+
7+
gem 'appraisal'
8+
gem 'concurrent-ruby', '1.3.4' # 1.3.5. breaks with Rails < 7, see https://github.com/ruby-concurrency/concurrent-ruby/commit/d7ce956dacd0b772273d39b8ed31a30cff7ecf38
9+
gem 'minitest', '~> 5.0'
10+
gem 'minitest-reporters', '~> 1.6.0'
11+
gem 'rails', '~> 6.1'
12+
gem 'rake', '~> 13.2'
13+
gem 'rubocop', '~> 1.25.1'
14+
15+
gemspec path: '../'

gemfiles/rails_7.2.gemfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
# This file was generated by Appraisal
4+
5+
source 'https://rubygems.org'
6+
7+
gem 'appraisal'
8+
gem 'minitest', '~> 5.0'
9+
gem 'minitest-reporters', '~> 1.6.0'
10+
gem 'rails', '~> 7.2'
11+
gem 'rake', '~> 13.2'
12+
gem 'rubocop', '~> 1.25.1'
13+
14+
gemspec path: '../'

gemfiles/rails_8.0.gemfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
# This file was generated by Appraisal
4+
5+
source 'https://rubygems.org'
6+
7+
gem 'appraisal'
8+
gem 'minitest', '~> 5.0'
9+
gem 'minitest-reporters', '~> 1.6.0'
10+
gem 'rails', '~> 8.0'
11+
gem 'rake', '~> 13.2'
12+
gem 'rubocop', '~> 1.25.1'
13+
14+
gemspec path: '../'

0 commit comments

Comments
 (0)