diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07918f535..87df1392c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,22 +14,22 @@ jobs: - target_ruby: "3.3.6" arch: "x86-msvcrt" build_ruby: "3.1.6/x64" - run_mri_spec: v3_3_3 + run_mri_spec: v3_3_6 - target_ruby: "3.3.6" arch: "x64-ucrt" build_ruby: "3.1.6/x64" - run_mri_spec: v3_3_3 + run_mri_spec: v3_3_6 - target_ruby: "3.2.6" arch: "x86-msvcrt" build_ruby: "3.1.6/x64" - run_mri_spec: v3_2_4 + run_mri_spec: v3_2_6 - target_ruby: "3.2.6" arch: "x64-ucrt" build_ruby: "3.1.6/x64" - run_mri_spec: v3_2_4 + run_mri_spec: v3_2_6 - target_ruby: "3.1.6" arch: "x86-msvcrt" @@ -201,7 +201,9 @@ jobs: - name: Run all tests against the new installed Ruby shell: cmd - run: ridk exec rake test + run: | + chcp 437 + ridk exec rake test - name: Run upload to github (only on tag builds) shell: cmd diff --git a/Gemfile b/Gemfile index ddaad2337..b32edb956 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,4 @@ gemspec gem "octokit" gem "win32-process" +gem "uri", "~> 0.13" diff --git a/resources/files/operating_system.rb b/resources/files/operating_system.rb index c45ca4259..fa21d6f55 100644 --- a/resources/files/operating_system.rb +++ b/resources/files/operating_system.rb @@ -38,7 +38,7 @@ def operating_system_defaults RubyInstaller::Runtime.enable_msys_apps(for_gem_install: true) unless gem_installer.spec.extensions.empty? - if !gem_installer.options || !gem_installer.options[:ignore_dependencies] || gem_installer.options[:bundler_expected_checksum] + if !gem_installer.options || !gem_installer.options[:ignore_dependencies] || gem_installer.class.to_s.include?("Bundler") [['msys2_dependencies' , :install_packages ], ['msys2_mingw_dependencies', :install_mingw_packages]].each do |metakey, func| diff --git a/test/helper/testgem/Gemfile b/test/helper/testgem/Gemfile new file mode 100644 index 000000000..8033850c2 --- /dev/null +++ b/test/helper/testgem/Gemfile @@ -0,0 +1,2 @@ +source "https://dummy-url.nonexit" +gem "testgem", "1.0.0" diff --git a/test/test_gem_install.rb b/test/test_gem_install.rb index 141a67dfa..2c9187b71 100644 --- a/test/test_gem_install.rb +++ b/test/test_gem_install.rb @@ -3,12 +3,12 @@ class TestGemInstall < Minitest::Test # Remove installed packages per: - # pacman -R mingw-w64-ucrt-x86_64-libmowgli mingw-w64-ucrt-x86_64-libguess ed + # pacman -R %MINGW_PACKAGE_PREFIX%-libmowgli %MINGW_PACKAGE_PREFIX%-libguess ed def test_gem_install res = system <<-EOT.gsub("\n", "&") -cd test/helper/testgem -gem build testgem.gemspec -gem install testgem-1.0.0.gem --verbose + cd test/helper/testgem + gem build testgem.gemspec + gem install testgem-1.0.0.gem --verbose EOT assert res, "shell commands should succeed" @@ -27,6 +27,24 @@ def test_gem_install FileUtils.rm("test/helper/testgem/testgem-1.0.0.gem") end + def test_bundle_install + remove_pacman_packages_for_test + FileUtils.mkdir_p "test/helper/testgem/vendor/cache" + res = system <<-EOT.gsub("\n", "&") + cd test/helper/testgem + gem build testgem.gemspec + copy /b testgem-1.0.0.gem "vendor/cache/" + bundle install --local + EOT + assert res, "shell commands should succeed" + + out = IO.popen("bundle exec ruby -rtestgem -e \"puts Libguess.determine_encoding('abc', 'Greek')\"", chdir: "test/helper/testgem", &:read) + assert_match(/UTF-8/, out.scrub, "call the ruby API of the testgem") + + assert system("gem uninstall testgem --executables --force"), "uninstall testgem" + FileUtils.rm("test/helper/testgem/testgem-1.0.0.gem") + end + if RUBY_VERSION < "3.0" TESTUSER = "ritestuser" else @@ -64,6 +82,13 @@ def with_test_user(testname: nil) end end + private def remove_pacman_packages_for_test + RubyInstaller::Runtime.msys2_installation.with_msys_apps_enabled do + system("pacman -R --noconfirm %MINGW_PACKAGE_PREFIX%-libmowgli %MINGW_PACKAGE_PREFIX%-libguess ed") + end + end + + def test_user_gem_install unless ENV['USERNAME'] == TESTUSER RubyInstaller::Runtime.msys2_installation.with_msys_apps_enabled do @@ -74,9 +99,7 @@ def test_user_gem_install test_gem_install end unless ENV['USERNAME'] == TESTUSER - RubyInstaller::Runtime.msys2_installation.with_msys_apps_enabled do - system("pacman -R --noconfirm %MINGW_PACKAGE_PREFIX%-libmowgli %MINGW_PACKAGE_PREFIX%-libguess ed") - end + remove_pacman_packages_for_test end end