Skip to content

Add a test using setup-ruby twice in the same job - #958

Open
NopeCharon wants to merge 1 commit into
ruby:masterfrom
NopeCharon:test-setup-ruby-twice
Open

NopeCharon wants to merge 1 commit into
ruby:masterfrom
NopeCharon:test-setup-ruby-twice

Conversation

@NopeCharon

Copy link
Copy Markdown

This adds a CI job using setup-ruby twice in the same job, the scenario from #444:

  1. A first setup-ruby step uses Bundler 1 with gemfiles/bundler1.gemfile (passed as a step-level BUNDLE_GEMFILE).
  2. A second setup-ruby step uses the root Gemfile, and must use Bundler 2.4 (the latest Bundler for Ruby 2.7), both for its own bundle install and for later steps.

The job runs on ubuntu-24.04 because Ruby 2.7 is not available on ubuntu-26.04, which ubuntu-latest is moving to.

I checked it by running the job's steps locally in an ubuntu:24.04 container, applying $GITHUB_ENV/$GITHUB_PATH between steps the same way the runner does:

Using setup-ruby twice in the same job (e.g. for multiple Gemfiles in a
monorepo) was not tested, which let ruby#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 ruby#445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test for using setup-ruby twice in the same workflow

1 participant