Skip to content

Commit

Permalink
Update tested ruby matrix to support 3.3.x (#6)
Browse files Browse the repository at this point in the history
* Update tested ruby matrix to support 3.3.x

* Specs passing on ruby 3.3

* Test against ruby 3.2.3

* Run rubocop

* Disable fail-fast

* Try re-installing bundler

* Specs working across bundler versions
  • Loading branch information
segiddins authored Feb 16, 2024
1 parent 6579ea7 commit 76475e9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
fail-fast: false
matrix:
ruby:
- "3.2.1"
- "3.2.3"
- "3.3.0"

steps:
- uses: actions/checkout@v3
Expand All @@ -23,6 +25,8 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler: none
- name: Install bundler
run: gem install bundler:$(bundle --version | cut -d' ' -f3-)
- name: Install deps
run: bin/rake spec:deps
- name: Run default task
Expand Down
34 changes: 17 additions & 17 deletions spec/bundler/compose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
specs:
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
Expand All @@ -94,7 +94,7 @@
# Platforms found in the lockfile
################################################################################
platform("#{local_platform}") {}
#{gemfile_platforms}
################################################################################
# Global sources from gemfile
Expand Down Expand Up @@ -131,7 +131,7 @@
rake (13.0.1)
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
rails
Expand Down Expand Up @@ -172,7 +172,7 @@
specs:
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
Expand Down Expand Up @@ -232,7 +232,7 @@
specs:
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
Expand Down Expand Up @@ -264,7 +264,7 @@
# Platforms found in the lockfile
################################################################################
platform("#{local_platform}") {}
#{gemfile_platforms}
################################################################################
# Global sources from gemfile
Expand All @@ -288,7 +288,7 @@
rack
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
thin!
Expand Down Expand Up @@ -325,7 +325,7 @@
specs:
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
Expand All @@ -349,7 +349,7 @@
# Platforms found in the lockfile
################################################################################
platform("#{local_platform}") {}
#{gemfile_platforms}
################################################################################
# Global sources from gemfile
Expand Down Expand Up @@ -390,7 +390,7 @@
rake (13.0.1)
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
rack-obama (= 1)
Expand Down Expand Up @@ -450,7 +450,7 @@
rspec (1.2.7)
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
rails (~> 2.2)
Expand All @@ -476,7 +476,7 @@
# Platforms found in the lockfile
################################################################################
platform("#{local_platform}") {}
#{gemfile_platforms}
################################################################################
# Global sources from gemfile
Expand Down Expand Up @@ -536,7 +536,7 @@
rspec (1.2.7)
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
actionmailer (= 2.3.2)!
Expand Down Expand Up @@ -606,7 +606,7 @@
rspec (1.2.7)
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
rack!
Expand All @@ -621,7 +621,7 @@
# compose

bundle "compose gems rails", verbose: true
expect(last_command.stdout).to eq("2.3.2")
expect(last_command.stdout.lines).to end_with("2.3.2")

# diff

Expand All @@ -633,7 +633,7 @@
# Platforms found in the lockfile
################################################################################
platform("#{local_platform}") {}
#{gemfile_platforms}
################################################################################
# Global sources from gemfile
Expand Down Expand Up @@ -700,7 +700,7 @@
rspec (1.2.7)
PLATFORMS
#{local_platform}
#{lockfile_platforms}
DEPENDENCIES
actionmailer (= 2.3.2)!
Expand Down
20 changes: 17 additions & 3 deletions spec/support/platforms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,26 @@ def not_local_patchlevel
9999
end

def lockfile_platforms(*extra)
formatted_lockfile_platforms(local_platform, *extra)
def default_platform_list(*extra, defaults: default_locked_platforms)
defaults.concat(extra).uniq
end

def formatted_lockfile_platforms(*platforms)
def lockfile_platforms(*extra, defaults: default_locked_platforms)
platforms = default_platform_list(*extra, defaults:)
platforms.map(&:to_s).sort.join("\n ")
end

def gemfile_platforms(*extra, defaults: default_locked_platforms)
platforms = default_platform_list(*extra, defaults:)
platforms.map { |pl| "platform(#{pl.to_s.dump}) {}" }.sort.join("\n")
end

def default_locked_platforms
if Bundler::VERSION >= "2.5"
[local_platform, generic_local_platform]
else
[local_platform]
end
end
end
end

0 comments on commit 76475e9

Please sign in to comment.