Skip to content

Commit

Permalink
deps: require Ruby 3.1 or higher (#337)
Browse files Browse the repository at this point in the history
Removes unsupported Ruby versions from the test runs and updates the
minimum required Ruby version to 3.1. Updates google-style and the
corresponding rubocop version.
  • Loading branch information
olavloite authored Dec 20, 2024
1 parent 41a2132 commit 3fbda54
Show file tree
Hide file tree
Showing 65 changed files with 217 additions and 181 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/acceptance-tests-on-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ jobs:
strategy:
max-parallel: 4
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
ruby: ["3.1", "3.2", "3.3"]
ar: ["~> 6.1.0", "~> 7.0.0", "~> 7.1.0", "~> 7.2.0"]
# Exclude combinations that are not supported.
exclude:
- ruby: "2.7"
ar: "~> 7.2.0"
- ruby: "3.0"
ar: "~> 7.2.0"
env:
AR_VERSION: ${{ matrix.ar }}
steps:
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ jobs:
strategy:
max-parallel: 4
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
ruby: ["3.1", "3.2", "3.3"]
ar: ["~> 6.1.0", "~> 7.0.0", "~> 7.1.0", "~> 7.2.0"]
# Exclude combinations that are not supported.
exclude:
- ruby: "2.7"
ar: "~> 7.2.0"
- ruby: "3.0"
ar: "~> 7.2.0"
env:
AR_VERSION: ${{ matrix.ar }}
steps:
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/nightly-acceptance-tests-on-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ jobs:
strategy:
max-parallel: 4
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
ruby: ["3.1", "3.2", "3.3"]
ar: ["~> 6.1.0", "~> 7.0.0", "~> 7.1.0", "~> 7.2.0"]
# Exclude combinations that are not supported.
exclude:
- ruby: "2.7"
ar: "~> 7.2.0"
- ruby: "3.0"
ar: "~> 7.2.0"
env:
AR_VERSION: ${{ matrix.ar }}
steps:
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/nightly-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ jobs:
max-parallel: 4
matrix:
# Run acceptance tests all supported combinations of Ruby and ActiveRecord.
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
ruby: ["3.1", "3.2", "3.3"]
ar: ["~> 6.1.0", "~> 7.0.0", "~> 7.1.0", "~> 7.2.0"]
# Exclude combinations that are not supported.
exclude:
- ruby: "2.7"
ar: "~> 7.2.0"
- ruby: "3.0"
ar: "~> 7.2.0"
env:
AR_VERSION: ${{ matrix.ar }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.3'
- name: cache gems
uses: actions/cache@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ AllCops:

Documentation:
Enabled: false
Layout/AlignHash:
Layout/HashAlignment:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Naming/RescuedExceptionsVariableName:
Enabled: false
Naming/UncommunicativeMethodParamName:
Naming/MethodParameterName:
Enabled: false
Style/EmptyMethod:
Enabled: false
Expand Down
4 changes: 2 additions & 2 deletions activerecord-spanner-adapter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.7"
spec.required_ruby_version = ">= 3.1"

spec.add_dependency "google-cloud-spanner", "~> 2.18"
# Pin gRPC to 1.64.3, as 1.65 and 1.66 cause test runs to hang randomly.
Expand All @@ -31,7 +31,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "autotest-suffix", "~> 1.1"
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "google-style", "~> 1.24.0"
spec.add_development_dependency "google-style", "~> 1.30.1"
spec.add_development_dependency "minitest", "~> 5.10"
spec.add_development_dependency "minitest-autotest", "~> 1.0"
spec.add_development_dependency "minitest-focus", "~> 1.1"
Expand Down
10 changes: 3 additions & 7 deletions benchmarks/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def self.run # rubocop:disable Metrics/AbcSize

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end

def self.execute_individual_benchmarks singer, client
Expand Down Expand Up @@ -120,9 +120,7 @@ def self.benchmark_select_one_singer singer, client
sql = "SELECT * FROM Singers WHERE id=@id"
params = { id: singer[:id] }
param_types = { id: :INT64 }
client.execute(sql, params: params, types: param_types).rows.each do |row|
return row
end
client.execute(sql, params: params, types: param_types).rows.first(1)
else
Singer.find singer.id
end
Expand All @@ -134,9 +132,7 @@ def self.benchmark_create_and_reload client
sql = "SELECT * FROM Singers WHERE id=@id"
params = { id: singer[:id] }
param_types = { id: :INT64 }
client.execute(sql, params: params, types: param_types).rows.each do |row|
return row
end
client.execute(sql, params: params, types: param_types).rows.first(1)
else
singer.reload
end
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/array-data-type/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self.run # rubocop:disable Metrics/AbcSize

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/bit-reversed-sequence/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end

def self.find_album singerid, albumid
Expand Down
4 changes: 2 additions & 2 deletions examples/snippets/bit-reversed-sequence/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"
require_relative "../models/album"

Expand All @@ -14,7 +14,7 @@
adjectives = %w[daily happy blue generous cooked bad open]
nouns = %w[windows potatoes bank street tree glass bottle]

# Note: We do not use mutations to insert these rows, because letting the database generate the primary key means that
# NOTE: We do not use mutations to insert these rows, because letting the database generate the primary key means that
# we rely on a `THEN RETURN id` clause in the insert statement. This is only supported for DML statements, and not for
# mutations.
ActiveRecord::Base.transaction do
Expand Down
4 changes: 2 additions & 2 deletions examples/snippets/bulk-insert/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.run # rubocop:disable Metrics/AbcSize
]
end
puts ""
puts "Created a batch of #{singers.length} singers and #{albums.length} "\
puts "Created a batch of #{singers.length} singers and #{albums.length} " \
"albums using a transaction with buffered mutations:"
singers.each do |s|
puts " Created singer #{s.first_name} #{s.last_name} with id #{s.id}"
Expand All @@ -57,7 +57,7 @@ def self.run # rubocop:disable Metrics/AbcSize

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/commit-timestamp/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.run # rubocop:disable Metrics/AbcSize

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/create-records/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/date-data-type/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/date-data-type/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
#
require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"

first_names = %w[Nelson Todd William Alex Dominique Adenoid Steve Nathan Beverly Annie Amy Norma Diana Regan Phyllis]
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/generated-column/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/generated-column/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"

first_names = %w[Pete Alice John Ethel Trudy Naomi Wendy Ruben Thomas Elly]
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/hints/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/hints/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"
require_relative "../models/album"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end

def self.find_singer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"
require_relative "../models/album"
require_relative "../models/track"
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/interleaved-tables/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end

def self.find_singer
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/interleaved-tables/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"
require_relative "../models/album"
require_relative "../models/track"
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/migrations/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
4 changes: 2 additions & 2 deletions examples/snippets/mutations/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def self.run # rubocop:disable Metrics/AbcSize
to_album = Album.where.not(id: from_album.id).sample

puts ""
puts "Transferring 10,000 marketing budget from #{from_album.title} (#{from_album.marketing_budget}) "\
puts "Transferring 10,000 marketing budget from #{from_album.title} (#{from_album.marketing_budget}) " \
"to #{to_album.title} (#{to_album.marketing_budget})"
from_album.update marketing_budget: from_album.marketing_budget - 10000
to_album.update marketing_budget: to_album.marketing_budget + 10000
Expand All @@ -40,7 +40,7 @@ def self.run # rubocop:disable Metrics/AbcSize

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/mutations/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"
require_relative "../models/album"

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/optimistic-locking/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/optimistic-locking/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"
require_relative "../models/album"

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/partitioned-dml/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def self.run

puts ""
puts "Press any key to end the application"
STDIN.getch
$stdin.getch
end
end

Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/partitioned-dml/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

require_relative "../../config/environment.rb"
require_relative "../../config/environment"
require_relative "../models/singer"
require_relative "../models/album"

Expand Down
Loading

0 comments on commit 3fbda54

Please sign in to comment.