From d97e8f360a9bc2aff31f8f016d6e2e4d2ac2647a Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 5 Nov 2024 09:07:07 -0500 Subject: [PATCH 1/3] Use BUNDLE_GEMFILE directly intead of appraisal binary appraisal binary appears to be incompatible with bundler 2.4+ that set BUNDLER_SETUP environment variable. In some cases developers are already using BUNDLE_GEMFILE manually to invoke appraisal configurations, probably those using ruby 3.3 and newer. This commit changes the rakefile to always use BUNDLE_GEMFILE approach, making it work for all Ruby versions, and adds documentation stating that appraisal binary does not work and to use the BUNDLE_GEMFILE manual approach. --- Rakefile | 3 ++- docs/DevelopmentGuide.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 652e5c245bd..cac0831d4ec 100644 --- a/Rakefile +++ b/Rakefile @@ -59,7 +59,8 @@ namespace :test do command = if appraisal_group.empty? "bundle exec rake #{spec_task}" else - "bundle exec appraisal #{ruby_runtime}-#{appraisal_group} rake #{spec_task}" + gemfile = File.join(File.dirname(__FILE__), "gemfiles", "#{ruby_runtime}-#{appraisal_group}.gemfile".tr('-', '_')) + "env BUNDLE_GEMFILE=#{gemfile} bundle exec rake #{spec_task}" end command += "'[#{spec_arguments}]'" if spec_arguments diff --git a/docs/DevelopmentGuide.md b/docs/DevelopmentGuide.md index 458f2883536..6b21fa33902 100644 --- a/docs/DevelopmentGuide.md +++ b/docs/DevelopmentGuide.md @@ -105,6 +105,24 @@ TEST_METADATA = { } ``` +**Using appraisal** + +`appraisal` command should only be used to update gemfiles in `gemfiles/` +and install dependencies. It should not be used to run tests, since it does not +work in all configurations. To run the tests, use: + +```sh +env BUNDLE_GEMFILE=gemfiles/#{ruby_runtime}_#{appraisal_group}.gemfile rake #{spec_task} +``` + +Note that the file names use underscores while appraisal group and +configuration definitions use dashes. The conversion could be performed as +follows: + +```sh +env BUNDLE_GEMFILE=gemfiles/#{ruby_runtime.tr('-', '_')}_#{appraisal_group.tr('-', '_')}.gemfile rake #{spec_task} +``` + **Working with appraisal groups** Checkout [Apppraisal](https://github.com/thoughtbot/appraisal) to learn the basics. From 637b943cd364ae1c7537056d071d70e313751a86 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 5 Nov 2024 09:14:05 -0500 Subject: [PATCH 2/3] rubocop --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index cac0831d4ec..aa67152a835 100644 --- a/Rakefile +++ b/Rakefile @@ -59,7 +59,7 @@ namespace :test do command = if appraisal_group.empty? "bundle exec rake #{spec_task}" else - gemfile = File.join(File.dirname(__FILE__), "gemfiles", "#{ruby_runtime}-#{appraisal_group}.gemfile".tr('-', '_')) + gemfile = File.join(File.dirname(__FILE__), 'gemfiles', "#{ruby_runtime}-#{appraisal_group}.gemfile".tr('-', '_')) "env BUNDLE_GEMFILE=#{gemfile} bundle exec rake #{spec_task}" end From 8b138b3904b0c3e29003eacfc42616c5058019da Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 5 Nov 2024 11:47:23 -0500 Subject: [PATCH 3/3] run ci again