Add Ruby 3.1 and Rails 7 to CI (#1526)
This PR adds the Ruby 3.1 and Rails 7 elements to the CI matrix. To support those changes a number of other changes were required: - Adding a basic Rails 7 Gemfile and updating `Appraisals` - Quoting 3.0 in the `.github/workflows/build.yml` file so that this entry pulls Ruby 3.0.x and not Ruby 3.1 - Adding the "--disable-error_highlight" value for RUBYOPT in the build environment to disable Ruby 3.1 error highlighting - Bumping the version of `standard` and configuring it to run against our oldest supported version
This commit is contained in:
parent
893eb67bbb
commit
b7eb4db87c
|
@ -13,6 +13,7 @@ jobs:
|
||||||
ruby:
|
ruby:
|
||||||
- jruby-9.2.16.0
|
- jruby-9.2.16.0
|
||||||
- truffleruby
|
- truffleruby
|
||||||
|
- "3.1"
|
||||||
- "3.0"
|
- "3.0"
|
||||||
- "2.7"
|
- "2.7"
|
||||||
- "2.6"
|
- "2.6"
|
||||||
|
@ -23,25 +24,41 @@ jobs:
|
||||||
- "5.2"
|
- "5.2"
|
||||||
- "6.0"
|
- "6.0"
|
||||||
- "6.1"
|
- "6.1"
|
||||||
|
- "7.0"
|
||||||
- main
|
- main
|
||||||
exclude:
|
exclude:
|
||||||
|
- ruby: 2.5
|
||||||
|
rails: "7.0"
|
||||||
- ruby: 2.5
|
- ruby: 2.5
|
||||||
rails: main
|
rails: main
|
||||||
|
- ruby: 2.6
|
||||||
|
rails: "7.0"
|
||||||
- ruby: 2.6
|
- ruby: 2.6
|
||||||
rails: main
|
rails: main
|
||||||
|
- ruby: jruby-9.2.16.0
|
||||||
|
rails: "7.0"
|
||||||
- ruby: jruby-9.2.16.0
|
- ruby: jruby-9.2.16.0
|
||||||
rails: main
|
rails: main
|
||||||
- ruby: 3.0
|
- ruby: "3.0"
|
||||||
rails: "5.0"
|
rails: "5.0"
|
||||||
- ruby: 3.0
|
- ruby: "3.0"
|
||||||
rails: "5.1"
|
rails: "5.1"
|
||||||
- ruby: 3.0
|
- ruby: "3.0"
|
||||||
rails: "5.2"
|
rails: "5.2"
|
||||||
|
- ruby: "3.1"
|
||||||
|
rails: "5.0"
|
||||||
|
- ruby: "3.1"
|
||||||
|
rails: "5.1"
|
||||||
|
- ruby: "3.1"
|
||||||
|
rails: "5.2"
|
||||||
|
- ruby: "3.1"
|
||||||
|
rails: "6.0"
|
||||||
|
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
|
||||||
|
RUBYOPT: "--disable-error_highlight"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ruby_version: "2.5"
|
|
@ -28,6 +28,12 @@ appraise "6.1" do
|
||||||
gem "sqlite3", platforms: [:ruby]
|
gem "sqlite3", platforms: [:ruby]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
appraise "7.0" do
|
||||||
|
gem "activerecord", "~> 7.0.0"
|
||||||
|
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
|
||||||
|
gem "sqlite3", platforms: [:ruby]
|
||||||
|
end
|
||||||
|
|
||||||
appraise "main" do
|
appraise "main" do
|
||||||
gem "activerecord", git: "https://github.com/rails/rails.git", branch: "main"
|
gem "activerecord", git: "https://github.com/rails/rails.git", branch: "main"
|
||||||
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
|
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
|
||||||
|
|
28
Gemfile.lock
28
Gemfile.lock
|
@ -72,17 +72,17 @@ GEM
|
||||||
middleware (0.1.0)
|
middleware (0.1.0)
|
||||||
minitest (5.14.3)
|
minitest (5.14.3)
|
||||||
multi_test (0.1.2)
|
multi_test (0.1.2)
|
||||||
parallel (1.20.1)
|
parallel (1.21.0)
|
||||||
parser (3.0.0.0)
|
parser (3.1.0.0)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
protobuf-cucumber (3.10.8)
|
protobuf-cucumber (3.10.8)
|
||||||
activesupport (>= 3.2)
|
activesupport (>= 3.2)
|
||||||
middleware
|
middleware
|
||||||
thor
|
thor
|
||||||
thread_safe
|
thread_safe
|
||||||
rainbow (3.0.0)
|
rainbow (3.1.1)
|
||||||
rake (13.0.3)
|
rake (13.0.3)
|
||||||
regexp_parser (2.0.3)
|
regexp_parser (2.2.0)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rspec (3.10.0)
|
rspec (3.10.0)
|
||||||
rspec-core (~> 3.10.0)
|
rspec-core (~> 3.10.0)
|
||||||
|
@ -100,19 +100,19 @@ GEM
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.10.0)
|
rspec-support (~> 3.10.0)
|
||||||
rspec-support (3.10.2)
|
rspec-support (3.10.2)
|
||||||
rubocop (1.10.0)
|
rubocop (1.24.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.0.0.0)
|
parser (>= 3.0.0.0)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.8, < 3.0)
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
rexml
|
rexml
|
||||||
rubocop-ast (>= 1.2.0, < 2.0)
|
rubocop-ast (>= 1.15.1, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 3.0)
|
unicode-display_width (>= 1.4.0, < 3.0)
|
||||||
rubocop-ast (1.4.1)
|
rubocop-ast (1.15.1)
|
||||||
parser (>= 2.7.1.5)
|
parser (>= 3.0.1.1)
|
||||||
rubocop-performance (1.9.2)
|
rubocop-performance (1.13.1)
|
||||||
rubocop (>= 0.90.0, < 2.0)
|
rubocop (>= 1.7.0, < 2.0)
|
||||||
rubocop-ast (>= 0.4.0)
|
rubocop-ast (>= 0.4.0)
|
||||||
ruby-progressbar (1.11.0)
|
ruby-progressbar (1.11.0)
|
||||||
simplecov (0.21.2)
|
simplecov (0.21.2)
|
||||||
|
@ -122,16 +122,16 @@ GEM
|
||||||
simplecov-html (0.12.3)
|
simplecov-html (0.12.3)
|
||||||
simplecov_json_formatter (0.1.2)
|
simplecov_json_formatter (0.1.2)
|
||||||
sqlite3 (1.4.2)
|
sqlite3 (1.4.2)
|
||||||
standard (0.13.0)
|
standard (1.6.0)
|
||||||
rubocop (= 1.10.0)
|
rubocop (= 1.24.1)
|
||||||
rubocop-performance (= 1.9.2)
|
rubocop-performance (= 1.13.1)
|
||||||
sys-uname (1.2.2)
|
sys-uname (1.2.2)
|
||||||
ffi (~> 1.1)
|
ffi (~> 1.1)
|
||||||
thor (1.1.0)
|
thor (1.1.0)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tzinfo (2.0.4)
|
tzinfo (2.0.4)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
unicode-display_width (2.0.0)
|
unicode-display_width (2.1.0)
|
||||||
yard (0.9.26)
|
yard (0.9.26)
|
||||||
zeitwerk (2.4.2)
|
zeitwerk (2.4.2)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
# This file was generated by Appraisal
|
||||||
|
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
|
||||||
|
gem "sqlite3", platforms: [:ruby]
|
||||||
|
gem "activerecord", "~> 7.0.0"
|
||||||
|
|
||||||
|
gemspec name: "factory_bot", path: "../"
|
|
@ -17,7 +17,7 @@ module FactoryBot
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
else
|
else
|
||||||
def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
|
||||||
@component.send(name, *args, &block)
|
@component.send(name, *args, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ module FactoryBot
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# are equivalent.
|
# are equivalent.
|
||||||
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing, Style/MethodMissingSuper
|
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
|
||||||
association_options = args.first
|
association_options = args.first
|
||||||
|
|
||||||
if association_options.nil?
|
if association_options.nil?
|
||||||
|
|
|
@ -35,7 +35,7 @@ module FactoryBot
|
||||||
|
|
||||||
attr_accessor :instance
|
attr_accessor :instance
|
||||||
|
|
||||||
def method_missing(method_name, *args, &block) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
|
def method_missing(method_name, *args, &block)
|
||||||
if @instance.respond_to?(method_name)
|
if @instance.respond_to?(method_name)
|
||||||
@instance.send(method_name, *args, &block)
|
@instance.send(method_name, *args, &block)
|
||||||
else
|
else
|
||||||
|
|
|
@ -167,7 +167,7 @@ describe "defaulting `created_at`" do
|
||||||
it "allows overriding created_at for objects with created_at" do
|
it "allows overriding created_at for objects with created_at" do
|
||||||
created_at = 3.days.ago
|
created_at = 3.days.ago
|
||||||
stubbed = build_stubbed(:thing_with_timestamp, created_at: created_at)
|
stubbed = build_stubbed(:thing_with_timestamp, created_at: created_at)
|
||||||
expect(stubbed.created_at).to eq created_at
|
expect(stubbed.created_at).to be_within(1.second).of created_at
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't allow setting created_at on an object that doesn't define it" do
|
it "doesn't allow setting created_at on an object that doesn't define it" do
|
||||||
|
@ -180,7 +180,7 @@ describe "defaulting `created_at`" do
|
||||||
expect(stub.created_at).to be_about_now
|
expect(stub.created_at).to be_about_now
|
||||||
past_time = 3.days.ago
|
past_time = 3.days.ago
|
||||||
stub.created_at = past_time
|
stub.created_at = past_time
|
||||||
expect(stub.created_at).to eq past_time
|
expect(stub.created_at).to be_within(1.second).of past_time
|
||||||
end
|
end
|
||||||
|
|
||||||
it "behaves the same as a non-stubbed created_at" do
|
it "behaves the same as a non-stubbed created_at" do
|
||||||
|
@ -231,7 +231,7 @@ describe "defaulting `updated_at`" do
|
||||||
it "allows overriding updated_at for objects with updated_at" do
|
it "allows overriding updated_at for objects with updated_at" do
|
||||||
past_time = 3.days.ago
|
past_time = 3.days.ago
|
||||||
stubbed = build_stubbed(:thing_with_timestamp, updated_at: past_time)
|
stubbed = build_stubbed(:thing_with_timestamp, updated_at: past_time)
|
||||||
expect(stubbed.updated_at).to eq past_time
|
expect(stubbed.updated_at).to be_within(1.second).of past_time
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't allow setting updated_at on an object that doesn't define it" do
|
it "doesn't allow setting updated_at on an object that doesn't define it" do
|
||||||
|
@ -245,7 +245,7 @@ describe "defaulting `updated_at`" do
|
||||||
expect(stub.updated_at).to be_about_now
|
expect(stub.updated_at).to be_about_now
|
||||||
past_time = 3.days.ago
|
past_time = 3.days.ago
|
||||||
stub.updated_at = past_time
|
stub.updated_at = past_time
|
||||||
expect(stub.updated_at).to eq past_time
|
expect(stub.updated_at).to be_within(1.second).of past_time
|
||||||
end
|
end
|
||||||
|
|
||||||
it "behaves the same as a non-stubbed updated_at" do
|
it "behaves the same as a non-stubbed updated_at" do
|
||||||
|
|
|
@ -67,7 +67,7 @@ describe FactoryBot::Definition do
|
||||||
|
|
||||||
it "exposes a non-default create strategy when one is provided by the user" do
|
it "exposes a non-default create strategy when one is provided by the user" do
|
||||||
definition = described_class.new(:name)
|
definition = described_class.new(:name)
|
||||||
block = proc { nil }
|
block = proc {}
|
||||||
definition.to_create(&block)
|
definition.to_create(&block)
|
||||||
|
|
||||||
expect(definition.to_create).to eq block
|
expect(definition.to_create).to eq block
|
||||||
|
|
Loading…
Reference in New Issue