ruby / setup-ruby

An action to download a prebuilt Ruby and add it to the PATH in 5 seconds
https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
MIT License
804 stars 263 forks source link

Windows 2019 + Ruby 3.0 + libyaml fails to install psych #641

Closed halostatue closed 2 months ago

halostatue commented 2 months ago

Ensure the following before filing this issue

Are you running on a GitHub-hosted runner or a self-hosted runner?

GitHub-hosted runner

Link to the failed workflow job (must be a public workflow job, so the necessary information is available)

https://github.com/halostatue/diff-lcs/actions/runs/10803766140/job/29969029880

Any other notes?

This is not a workflow issue as the same workflow succeeds on Ruby 2.6, 2.7, 3.1, 3.2, and 3.3. But Ruby 3.0 fails on installing Psych on Windows 2019

MSP-Greg commented 2 months ago

@halostatue

I'll see if I can look at what the issue is. None of the other Ruby versions that use MinGW on Windows 2019 (Ruby 3.0 and earlier) seem to be installing psych, but Ruby 3.0 is. The code in setup-ruby that handles MSYS2 (build tools and packages) is different for Windows 2019 vs Windows 2022.

Bottom line is the MSY2 MinGW libyaml package is not installed on Windows 2019, and it is needed to compile Psych.

halostatue commented 2 months ago

Given that all of the other versions succeed, I am for the moment ignoring that particular failure, and I can take it out of the test loop as required, but I wanted to report it.

MSP-Greg commented 2 months ago

@halostatue

I could come up with a workaround, but your solution is fine by me. Could you maybe edit the issue title to include something about Window 2019 image & libyaml?

JFYI, one solution would be to use setup-ruby-pkgs with a conditional to install libyaml only on Window 2019 and Ruby 3.0 or lower.

The Windows 2019 image contains a partial MSYS2 MinGW install which has some of the packages needed to build Ruby, but not all. Ruby 3.1 and later use MSYS2 UCRT, so setup-ruby installs the full set of build tools/packages.

The Windows 2022 image only contains a partial MSY2 install, so setup-ruby installs all the build tools/packages needed, and selects MinGW or UCRT depending on the Ruby version. These operations are shown in the setup-ruby logs.

halostatue commented 2 months ago

Done and done in my workflow. It's good to know about setup-ruby-pkgs, but given that everything else just works, I’ve disabled Ruby 3.0 on Windows 2019 for this. Is this issue worth keeping open?

MSP-Greg commented 2 months ago

given that everything else just works

That is the intent, but the Actions Windows 2019 image is much different than the Windows 2022 image.

I think I'll propose adding something to the README file that makes clear that all packages required to build Ruby are included when using Windows 2022, but that Windows 2019 does not include all of them, and may require installing package(s), which can be done with setup-ruby-pkgs or via MSYS2's pacman.

setup-ruby-pkgs is cross-platform and is often used by gems that require a package that is not used to build Ruby. Nokogiri would be an example, it's used five times in the ci workflow.

EDIT: I'll do a PR for the Readme, and have it close this issue.