Skip to content

Commit

Permalink
Add ruby-head to CI matrix and simplify maintenance task (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbrictson committed Jul 12, 2023
1 parent e37d204 commit 6940e11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["3.0", "3.1", "3.2"]
ruby: ["3.0", "3.1", "3.2", "head"]
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
Expand All @@ -26,5 +26,5 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "3.2"
ruby-version: "ruby"
- run: bundle exec rubocop
20 changes: 8 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ namespace :bump do
end

task :ruby do
replace_in_file "tomo-plugin-nvm.gemspec", /ruby_version = .*">= (.*)"/ => RubyVersions.lowest_supported
replace_in_file ".rubocop.yml", /TargetRubyVersion: (.*)/ => RubyVersions.lowest_supported
replace_in_file ".github/workflows/ci.yml", /ruby-version: "([\d.]+)"/ => RubyVersions.latest
replace_in_file ".github/workflows/ci.yml", /ruby: (\[.+\])/ => RubyVersions.all_supported.inspect
replace_in_file "tomo-plugin-nvm.gemspec", /ruby_version = .*">= (.*)"/ => RubyVersions.lowest
replace_in_file ".rubocop.yml", /TargetRubyVersion: (.*)/ => RubyVersions.lowest
replace_in_file ".github/workflows/ci.yml", /ruby: (\[.+\])/ => RubyVersions.all.inspect
end

task :year do
Expand Down Expand Up @@ -87,17 +86,14 @@ end

module RubyVersions
class << self
def lowest_supported
all_supported.first[/\d+\.\d+/]
def lowest
all.first
end

def latest
all_supported.last
end

def all_supported
def all
patches = versions.values_at(:stable, :security_maintenance).compact.flatten
patches.map { |p| p[/\d+\.\d+/] }.sort_by(&:to_f)
sorted_minor_versions = patches.map { |p| p[/\d+\.\d+/] }.sort_by(&:to_f)
[*sorted_minor_versions, "head"]
end

private
Expand Down

0 comments on commit 6940e11

Please sign in to comment.