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:
Peter Goldstein 2022-01-14 12:08:08 -08:00 committed by GitHub
parent 893eb67bbb
commit b7eb4db87c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 58 additions and 25 deletions

View File

@ -13,6 +13,7 @@ jobs:
ruby:
- jruby-9.2.16.0
- truffleruby
- "3.1"
- "3.0"
- "2.7"
- "2.6"
@ -23,25 +24,41 @@ jobs:
- "5.2"
- "6.0"
- "6.1"
- "7.0"
- main
exclude:
- ruby: 2.5
rails: "7.0"
- ruby: 2.5
rails: main
- ruby: 2.6
rails: "7.0"
- ruby: 2.6
rails: main
- ruby: jruby-9.2.16.0
rails: "7.0"
- ruby: jruby-9.2.16.0
rails: main
- ruby: 3.0
- ruby: "3.0"
rails: "5.0"
- ruby: 3.0
- ruby: "3.0"
rails: "5.1"
- ruby: 3.0
- ruby: "3.0"
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'
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
RUBYOPT: "--disable-error_highlight"
steps:
- uses: actions/checkout@v2

1
.standard.yml Normal file
View File

@ -0,0 +1 @@
ruby_version: "2.5"

View File

@ -28,6 +28,12 @@ appraise "6.1" do
gem "sqlite3", platforms: [:ruby]
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
gem "activerecord", git: "https://github.com/rails/rails.git", branch: "main"
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]

View File

@ -72,17 +72,17 @@ GEM
middleware (0.1.0)
minitest (5.14.3)
multi_test (0.1.2)
parallel (1.20.1)
parser (3.0.0.0)
parallel (1.21.0)
parser (3.1.0.0)
ast (~> 2.4.1)
protobuf-cucumber (3.10.8)
activesupport (>= 3.2)
middleware
thor
thread_safe
rainbow (3.0.0)
rainbow (3.1.1)
rake (13.0.3)
regexp_parser (2.0.3)
regexp_parser (2.2.0)
rexml (3.2.5)
rspec (3.10.0)
rspec-core (~> 3.10.0)
@ -100,19 +100,19 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.10.0)
rubocop (1.24.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-performance (1.9.2)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
rubocop-performance (1.13.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.11.0)
simplecov (0.21.2)
@ -122,16 +122,16 @@ GEM
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
sqlite3 (1.4.2)
standard (0.13.0)
rubocop (= 1.10.0)
rubocop-performance (= 1.9.2)
standard (1.6.0)
rubocop (= 1.24.1)
rubocop-performance (= 1.13.1)
sys-uname (1.2.2)
ffi (~> 1.1)
thor (1.1.0)
thread_safe (0.3.6)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0)
unicode-display_width (2.1.0)
yard (0.9.26)
zeitwerk (2.4.2)

9
gemfiles/7.0.gemfile Normal file
View File

@ -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: "../"

View File

@ -17,7 +17,7 @@ module FactoryBot
end
RUBY
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)
end

View File

@ -88,7 +88,7 @@ module FactoryBot
# end
#
# 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
if association_options.nil?

View File

@ -35,7 +35,7 @@ module FactoryBot
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)
@instance.send(method_name, *args, &block)
else

View File

@ -167,7 +167,7 @@ describe "defaulting `created_at`" do
it "allows overriding created_at for objects with created_at" do
created_at = 3.days.ago
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
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
past_time = 3.days.ago
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
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
past_time = 3.days.ago
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
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
past_time = 3.days.ago
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
it "behaves the same as a non-stubbed updated_at" do

View File

@ -67,7 +67,7 @@ describe FactoryBot::Definition do
it "exposes a non-default create strategy when one is provided by the user" do
definition = described_class.new(:name)
block = proc { nil }
block = proc {}
definition.to_create(&block)
expect(definition.to_create).to eq block