Skip to content

Rewrite ruby/setup-msys2-gcc #762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Rewrite ruby/setup-msys2-gcc #762

wants to merge 3 commits into from

Conversation

ntkme
Copy link
Contributor

@ntkme ntkme commented May 4, 2025

This PR include a few changes for windows:

  • Fix the issue with gcc 15/14 and mingw-w64 r688/r720 by introducing flexible variants of toolchains.
  • Reduce friction with Rewrite setup-msys2-gcc#26.
  • Improves performance by install to fast disk and create junction link on slow disk.
    • Ruby is installed to $RUNNER_TEMP\$base and a junction link is created at original $rubyPrefix if $rubyPrefix is on the slow disk.
    • MSYS2 is installed to $RUNNER_TEMP\msys64 and a junction link is created at $rubyPrefix\msys64.
  • Improves the reliability of ridk enable step by using proper serialization.
  • Refactor and clean up tech debt.

Performance

Run to run improvement varies a lot due to different sizes of packages and the unstable performance of the slow disk.
However, in general this saves anywhere from 20s to 60s per run. Example of a performance improvement from 63.43s to 27.15s - or 36.38s in saving:

https://github.com/ruby/setup-ruby/actions/runs/14772696897/job/41475457782

Downloading Ruby
  https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.3-1/rubyinstaller-3.4.3-1-x64.7z
  Took   0.97 seconds
Extracting  Ruby
  Took  25.38 seconds
Modifying Path
Downloading msys2 build tools
  https://github.com/ruby/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z
  Took   0.73 seconds
Extracting  msys2 build tools
  Took  12.52 seconds
Downloading ucrt64-3.0 build tools
  https://github.com/ruby/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/ucrt64-3.0.7z
  Took   1.00 seconds
Extracting  ucrt64-3.0 build tools
  Took  22.83 seconds

https://github.com/ntkme/setup-ruby/actions/runs/14823150160/job/41612838924

Downloading Ruby
  https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.3-1/rubyinstaller-3.4.3-1-x64.7z
  Took   0.46 seconds
Extracting  Ruby
  Took   9.87 seconds
Modifying Path
Downloading msys2 build tools
  https://github.com/ntkme/setup-msys2-gcc/releases/latest/download/[email protected]
  Took   1.18 seconds
Extracting  msys2 build tools
  Took  15.64 seconds

Note regarding why use $rubyPrefix\msys64:

>=2.4.1 means $rubyPrefix\msys64 is supported by all currently available ruby installer versions that's linked with msys2, and it has higher priority than C:\msys64 so that we don’t need to touch the preinstalled C:\msys64 at all.

@ntkme ntkme force-pushed the dev branch 10 times, most recently from 42e2c97 to ad6e0db Compare May 8, 2025 01:51
@ntkme ntkme marked this pull request as ready for review May 8, 2025 02:37
@ntkme ntkme force-pushed the dev branch 3 times, most recently from 363de67 to a8d7546 Compare May 8, 2025 05:50
@ntkme ntkme mentioned this pull request May 8, 2025
@ntkme ntkme force-pushed the dev branch 8 times, most recently from 15a109c to 7168d8b Compare May 8, 2025 21:06
@MSP-Greg
Copy link
Collaborator

Curious, why the need for 'Revert back to use GITHUB_WORKSPACE to detect fast drive'?

@ntkme
Copy link
Contributor Author

ntkme commented May 12, 2025

Curious, why the need for 'Revert back to use GITHUB_WORKSPACE to detect fast drive'?

Sorry, was just testing something and pushed to the wrong branch.

@MSP-Greg
Copy link
Collaborator

@eregon

I've quickly looked as this, and everything seems ok. We're getting close to finalizing the changes to setup-msys2-gcc, so checking is this is okay. Once the new packages are created, this can be merged.

@eregon
Copy link
Member

eregon commented May 14, 2025

From the PR title I thought this was a ruby/setup-msys2-gcc PR 😅
I'll try to take a look soon.

@MSP-Greg
Copy link
Collaborator

Re setup-msys2-gcc:

Much of the Windows' code was written when GHA was using 2016 & 2019 images. There have been a lot of changes in the images since then.

The only MSYS compatibility issue came up with the upgrade from OpenSSL 1.1 to 3.0. At the time, that only effected Ruby major.minor versions.

I was thinking about how to restructure it, and I wanted to move to a more data/configuration centric setup (using yaml, json, etc) vs the current 'method centric' code.

Also, recently two updates to MSYS2 have made things messy, and they require resolving to the Ruby patch level.

Anyway, @ntkme grabbed it and updated the code, and we've been testing it and making small changes. Alot more information has moved to the workflow file, along with the build tools package info and Ruby version constraints moving to windows-toolchain.json.

It will make it much easier to quickly update things when MSYS2 issue arise. The information re which tool-chain to install has always been located in this repo, and now it's retrieved via a json file.

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you for your work on this!

I guess the order is merge ruby/setup-msys2-gcc#26, create the release & assets, then update this PR to use ruby/setup-msys2-gcc links, and merge this PR?

@ntkme
Copy link
Contributor Author

ntkme commented May 15, 2025

I guess the order is merge ruby/setup-msys2-gcc#26, create the release & assets, then update this PR to use ruby/setup-msys2-gcc links, and merge this PR?

Correct.

@MSP-Greg
Copy link
Collaborator

@eregon

I guess the order is merge ruby/setup-msys2-gcc#26, create the release & assets, then update this PR to use ruby/setup-msys2-gcc links, and merge this PR?

The PR has been merged in https://github.com/ruby/setup-msys2-gcc

@ntkme
Copy link
Contributor Author

ntkme commented May 15, 2025

@eregon Release artifacts have been uploaded and I've updated this PR to use ruby/setup-msys2-gcc. There is a truffleruby test that's failing but it's unrelated to my change.

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.

3 participants