Skip to content

Commit 58ae2da

Browse files
committed
Add a test using setup-ruby twice in the same job
Using setup-ruby twice in the same job (e.g. for multiple Gemfiles in a monorepo) was not tested, which let #444 slip through: BUNDLER_VERSION exported by a first setup-ruby step using Bundler 1 leaked into a second step, whose `bundle install` then failed with "You must use Bundler 2 or greater with this lockfile". The new job reproduces that scenario: a first step uses Bundler 1 via gemfiles/bundler1.gemfile, then a second step on the root Gemfile must use Bundler 2.4 (the latest Bundler for Ruby 2.7), both for the action's own `bundle install` and for later steps. It runs on ubuntu-24.04 since Ruby 2.7 is not available on ubuntu-26.04, which ubuntu-latest is moving to. Closes #445
1 parent 26e5b7d commit 58ae2da

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,30 @@ jobs:
358358
bundler-cache: true
359359
- run: bundle --version | grep -F "Bundler version 1."
360360

361+
# https://github.com/ruby/setup-ruby/issues/444
362+
testTwiceInSameJob:
363+
name: "Test using setup-ruby twice in the same job"
364+
runs-on: ubuntu-24.04
365+
steps:
366+
- uses: actions/checkout@v7
367+
- uses: ./
368+
env:
369+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/bundler1.gemfile
370+
with:
371+
ruby-version: '2.7'
372+
bundler: 1
373+
bundler-cache: true
374+
- run: bundle --version | grep -F "Bundler version 1."
375+
env:
376+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/bundler1.gemfile
377+
# The Bundler version used by the first setup-ruby step must not leak into the second one
378+
- uses: ./
379+
with:
380+
ruby-version: '2.7'
381+
bundler-cache: true
382+
- run: bundle --version | grep -P "Bundler version 2\.4\.\d+"
383+
- run: bundle exec rake --version
384+
361385
testGemfileMatrix:
362386
strategy:
363387
fail-fast: false

0 commit comments

Comments
 (0)