From 76475e950075d526c53049e3cde7824002ca83d1 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Fri, 16 Feb 2024 07:45:58 -0800 Subject: [PATCH] Update tested ruby matrix to support 3.3.x (#6) * 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 --- .github/workflows/main.yml | 6 +++++- spec/bundler/compose_spec.rb | 34 +++++++++++++++++----------------- spec/support/platforms.rb | 20 +++++++++++++++++--- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a7889aa..8ffcc98 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 diff --git a/spec/bundler/compose_spec.rb b/spec/bundler/compose_spec.rb index bea1aa3..6aae270 100644 --- a/spec/bundler/compose_spec.rb +++ b/spec/bundler/compose_spec.rb @@ -70,7 +70,7 @@ specs: PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES @@ -94,7 +94,7 @@ # Platforms found in the lockfile ################################################################################ - platform("#{local_platform}") {} + #{gemfile_platforms} ################################################################################ # Global sources from gemfile @@ -131,7 +131,7 @@ rake (13.0.1) PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES rails @@ -172,7 +172,7 @@ specs: PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES @@ -232,7 +232,7 @@ specs: PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES @@ -264,7 +264,7 @@ # Platforms found in the lockfile ################################################################################ - platform("#{local_platform}") {} + #{gemfile_platforms} ################################################################################ # Global sources from gemfile @@ -288,7 +288,7 @@ rack PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES thin! @@ -325,7 +325,7 @@ specs: PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES @@ -349,7 +349,7 @@ # Platforms found in the lockfile ################################################################################ - platform("#{local_platform}") {} + #{gemfile_platforms} ################################################################################ # Global sources from gemfile @@ -390,7 +390,7 @@ rake (13.0.1) PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES rack-obama (= 1) @@ -450,7 +450,7 @@ rspec (1.2.7) PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES rails (~> 2.2) @@ -476,7 +476,7 @@ # Platforms found in the lockfile ################################################################################ - platform("#{local_platform}") {} + #{gemfile_platforms} ################################################################################ # Global sources from gemfile @@ -536,7 +536,7 @@ rspec (1.2.7) PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES actionmailer (= 2.3.2)! @@ -606,7 +606,7 @@ rspec (1.2.7) PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES rack! @@ -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 @@ -633,7 +633,7 @@ # Platforms found in the lockfile ################################################################################ - platform("#{local_platform}") {} + #{gemfile_platforms} ################################################################################ # Global sources from gemfile @@ -700,7 +700,7 @@ rspec (1.2.7) PLATFORMS - #{local_platform} + #{lockfile_platforms} DEPENDENCIES actionmailer (= 2.3.2)! diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb index 2a73ea4..9930c3d 100644 --- a/spec/support/platforms.rb +++ b/spec/support/platforms.rb @@ -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