Skip to content

Commit

Permalink
Merge branch 'expand-ruby-ci-matrix'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Jan 16, 2025
2 parents 48c2542 + cdda6da commit 18929ac
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 57 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ jobs:
fail-fast: false
matrix:
include:
- { ruby: 2.6 }
- { ruby: 2.7 }
- { ruby: '3.0' }
- { ruby: 3.1 }
- { ruby: 3.2 }

steps:
- uses: actions/checkout@v2
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ on: [pull_request]

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
BUNDLE_ONLY: rubocop
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7

- name: Run RuboCop linter
uses: reviewdog/action-rubocop@v1
uses: reviewdog/action-rubocop@v2
with:
github_token: ${{ secrets.github_token }}
rubocop_version: 1.10.0
reporter: github-pr-review
rubocop_version: gemfile
rubocop_extensions: rubocop-performance:gemfile rubocop-rspec:gemfile
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AllCops:
- 'bin/rubocop'
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7

Metrics/BlockLength:
Exclude:
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source 'https://rubygems.org'
gemspec

gem 'pry'
gem 'rake'
gem 'rspec'
gem 'rubocop', require: false
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.12.0', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rspec', require: false
gem 'webmock'
97 changes: 51 additions & 46 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,60 @@ PATH
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
bigdecimal (3.1.9)
coderay (1.1.3)
crack (0.4.5)
crack (1.0.0)
bigdecimal
rexml
diff-lcs (1.4.4)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
hashdiff (1.0.1)
diff-lcs (1.5.1)
domain_name (0.6.20240107)
hashdiff (1.1.2)
http-accept (1.7.0)
http-cookie (1.0.3)
http-cookie (1.0.8)
domain_name (~> 0.5)
json (2.5.1)
method_source (1.0.0)
mime-types (3.3.1)
logger (1.6.5)
method_source (1.1.0)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
mime-types-data (3.2025.0107)
netrc (0.11.0)
parallel (1.20.1)
parser (3.0.0.0)
parallel (1.26.3)
parser (3.3.7.0)
ast (~> 2.4.1)
pry (0.14.0)
racc
pry (0.15.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.6)
rainbow (3.0.0)
rake (13.0.3)
regexp_parser (2.1.1)
public_suffix (5.1.1)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.10.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.4)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rexml (3.4.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.11.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rubocop (1.12.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -65,21 +70,18 @@ GEM
rubocop-ast (>= 1.2.0, < 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.10.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rspec (2.2.0)
rubocop-rspec (2.4.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (2.0.0)
webmock (3.12.1)
addressable (>= 2.3.6)
ruby-progressbar (1.13.0)
unicode-display_width (2.6.0)
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

Expand All @@ -89,9 +91,12 @@ PLATFORMS
DEPENDENCIES
infreemation!
pry
rake
rspec
rubocop
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.12.0)
rubocop-performance
rubocop-rspec
webmock

BUNDLED WITH
2.3.26
114 changes: 114 additions & 0 deletions bin/bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'bundle' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "rubygems"

m = Module.new do
module_function

def invoked_as_script?
File.expand_path($0) == File.expand_path(__FILE__)
end

def env_var_version
ENV["BUNDLER_VERSION"]
end

def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
bundler_version = nil
update_index = nil
ARGV.each_with_index do |a, i|
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
bundler_version = a
end
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
bundler_version = $1
update_index = i
end
bundler_version
end

def gemfile
gemfile = ENV["BUNDLE_GEMFILE"]
return gemfile if gemfile && !gemfile.empty?

File.expand_path("../../Gemfile", __FILE__)
end

def lockfile
lockfile =
case File.basename(gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
else "#{gemfile}.lock"
end
File.expand_path(lockfile)
end

def lockfile_version
return unless File.file?(lockfile)
lockfile_contents = File.read(lockfile)
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
Regexp.last_match(1)
end

def bundler_version
@bundler_version ||=
env_var_version || cli_arg_version ||
lockfile_version
end

def bundler_requirement
return "#{Gem::Requirement.default}.a" unless bundler_version

bundler_gem_version = Gem::Version.new(bundler_version)

requirement = bundler_gem_version.approximate_recommendation

return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")

requirement += ".a" if bundler_gem_version.prerelease?

requirement
end

def load_bundler!
ENV["BUNDLE_GEMFILE"] ||= gemfile

activate_bundler
end

def activate_bundler
gem_error = activation_error_handling do
gem "bundler", bundler_requirement
end
return if gem_error.nil?
require_error = activation_error_handling do
require "bundler/version"
end
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
exit 42
end

def activation_error_handling
yield
nil
rescue StandardError, LoadError => e
e
end
end

m.load_bundler!

if m.invoked_as_script?
load Gem.bin_path("bundler", "bundle")
end
29 changes: 29 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rake", "rake")
29 changes: 29 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rspec-core", "rspec")
Loading

0 comments on commit 18929ac

Please sign in to comment.