Skip to content

Add mswin release builds as mswin-X.Y and mswin-head - #979

Merged
hsbt merged 3 commits into
masterfrom
claude/unruffled-montalcini-d4ed93
Nov 25, 2026
Merged

hsbt merged 3 commits into
masterfrom
claude/unruffled-montalcini-d4ed93

Conversation

@hsbt

@hsbt hsbt commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

This adds the release builds split out of #971. cache.ruby-lang.org publishes mswin builds of the 3.4 and 4.0 releases, so mswin-3.4 installs the latest 3.4.x and mswin-head the master build.

- uses: ruby/setup-ruby@v1
  with:
    ruby-version: mswin-3.4

Nothing changes for existing users, as mswin and ruby-mswin still install the master build. larskanis suggested in #972 (comment) that mswin should install the latest release. I'll do that in a follow-up, after sending PRs that move the public workflows testing master with mswin to mswin-head. I'll take care of the ruby org repositories like ruby/openssl.

The README now says when to pick mswin over the default RubyInstaller builds. I build and publish the mswin packages in ruby/actions and will maintain their support here.

mswin is CRuby built with MSVC, not another implementation, so it stays the ruby engine and goes through every CRuby rule. A flag only selects the mswin builds and keeps them apart from the RubyInstaller builds of the same versions in the tool cache and the bundler-cache key.

I ran the built dist/index.js on my x64 and arm64 Windows machines. mswin, ruby-mswin and mswin-head installed the master build, mswin-3.4 installed 3.4.12, and the mswin steps of test.yml passed.

Generated with Claude Code

@hsbt
hsbt requested review from larskanis and ntkme November 18, 2026 05:46
@hsbt
hsbt force-pushed the claude/unruffled-montalcini-d4ed93 branch from 14493a1 to c82cc17 Compare November 18, 2026 10:26
@hsbt hsbt changed the title Add mswin release builds as ruby-version: mswin-X.Y Add mswin release builds as mswin-X.Y and mswin-head Nov 18, 2026
Comment thread README.md
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 4.1.0-preview1, head, debug, mingw, ucrt |
| `jruby` | 9.1.17.0 - 10.1.3.0, head |
| `truffleruby` | 19.3.0 - 40.0.0, head |
| `truffleruby+graalvm` | 21.2.0 - 40.0.0, head |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It might be easier to understand, if we add another row to the table naming mswin and a rough overview of the available versions, instead of most of the text below. Technically mswin is the same cruby interpreter, but it has a very different ecosystem.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd like to explore the idea I posted in the earlier and see what's everyone's thought: #971 (comment)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd keep mswin here, as it selects a platform build of CRuby rather than a VM variant like GraalVM. A common syntax for CRuby variants would also rename ruby-asan and ruby-debug, so I think it fits better in a separate issue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I shortened the paragraph and moved the version overview into its first sentence. I kept mswin out of the table, since its rows are interpreters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd keep mswin here, as it selects a platform build of CRuby rather than a VM variant like GraalVM. A common syntax for CRuby variants would also rename ruby-asan and ruby-debug, so I think it fits better in a separate issue.

It's also a variant, using a different toolchain. I do think it'd be nice to generalize the concept of variants, for example we have asan-release currently and it's not so nice, ruby+asan/ruby+asan-head seems better.

We kind of need to decide this now, because it decides whether it's ruby+mswin-3.4 or mswin-3.4.
Though maybe the ruby+ prefix could be implicit, like ruby- currently, not sure how easy/hard that is though.

@ntkme
ntkme requested a review from eregon November 20, 2026 18:04
ntkme and others added 3 commits November 24, 2026 10:34
cache.ruby-lang.org publishes mswin builds of the 3.4 and 4.0 releases, so `mswin-X.Y` installs them and `mswin-head` the master build. `mswin` and `ruby-mswin` keep installing master until their known users move to `mswin-head`. 3.3 and older are left out because their mkmf ignores ENV['PKG_CONFIG'] and would not use the vcpkg pkgconf.

mswin is CRuby built with MSVC, so it stays the ruby engine and the CRuby rules apply. `common.inputs.mswin` only selects the builds and keeps them out of the tool cache, where runners hold RubyInstaller builds of the same versions, and in their own bundler-cache key.

Co-authored-by: なつき <i@ntk.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README said what mswin is but not when to use it, which leaves users unsure which of the two Windows builds to choose. The available versions move into the first sentence of the paragraph, and mswin stays out of the table, whose rows are interpreters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the claude/unruffled-montalcini-d4ed93 branch from e4e8704 to 00746e6 Compare November 24, 2026 01:35
@hsbt
hsbt merged commit 1452439 into master Nov 25, 2026
486 checks passed
@hsbt
hsbt deleted the claude/unruffled-montalcini-d4ed93 branch November 25, 2026 23:09
@hsbt

hsbt commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Thanks @larskanis and @ntkme for the reviews. I'll work on moving the repositories whose workflows use mswin to mswin-head.

@eregon

eregon commented Nov 27, 2026

Copy link
Copy Markdown
Member

This should not have been merged before my review, I think that's stated clearly in https://github.com/ruby/setup-ruby/blob/master/CONTRIBUTING.md#maintainers.
I know I haven't been super fast to review this but this needs a fair amount of thought, time to review and think of the best ways to integrate it, and shouldn't be rushed.
I understand you might want to test the new builds ASAP, but mswin/mswin-head should be enough for that, no?

@hsbt

hsbt commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

You're right, I should have waited for your approval as CONTRIBUTING.md says, sorry. mswin-head alone isn't enough, because gems moving to rb_len_t need a fallback for 4.0, which has no rb_len_t, and that fallback has to be tested on mswin too, where long is 32-bit. Ruby 4.1 ships in less than a month, so those gems need releases that work on both before then.

date, zlib, digest, resolv and pathname already test mswin-4.0. If you see something to change, I'll do it in a follow-up PR, and I'll wait for your approval before changing what mswin installs.

@eregon eregon left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code changes themselves look good, it's not invasive and does not use mswin as a different engine.
The naming choice mswin-X.Y is not necessarily something we want to keep for the future (but is a natural choice for now).
For example if we require ruby+mswin-X.Y/head then we would also be safe to have ruby+mswin pick the latest release, while mswin could stay head forever.

Comment thread common.js

export function shouldUseToolCache(engine, version) {
return (engine === 'ruby' && !isHeadVersion(version)) || isSelfHostedRunner()
// The tool cache of runners holds RubyInstaller builds under the same Ruby/<version> names as mswin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand this comment, especially the as mswin part.
The code clearly says no toolcache for mswin, so it seems to contradict the comment.
Probably best to just remove the comment.

@eregon

eregon commented Nov 27, 2026

Copy link
Copy Markdown
Member

Ruby 4.1 ships in less than a month, so those gems need releases that work on both before then.

I see, please add this context here and/or ping me on Slack in such a case of needing a review more urgently, I didn't know that.
For future mswin PRs please wait for my review, unless it's pure bug fixes (then any maintainer's review is enough as documented).

Comment thread index.js
const mswin = engine === 'mswin' || rubyVersion === 'ruby-mswin'
if (mswin) {
engine = 'ruby'
// mswin and ruby-mswin keep installing the master build until their known users move to mswin-head

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is reasonable & pragmatic, once we have made PRs to all public repos using mswin (it's only a few) to switch to mswin-head.
Variants could avoid this breaking change but I think it's small enough here that we don't need to wait for it.

@eregon

eregon commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Fable found 2 relevant issues with the PR:

1. mswin/mswin-head now install the latest Bundler instead of using the one shipped with master

Before this PR the parsed version for mswin was 'mswin', so this condition in bundler.js was false and the Bundler shipped with Ruby was used:

if (common.windows && engine === 'ruby' && (common.isStableVersion(engine, rubyVersion) || rubyVersion === 'head')) {
  // https://github.com/ruby/setup-ruby/issues/371
  bundlerVersion = 'latest'

Now the version is 'head', so mswin, ruby-mswin and mswin-head all do gem install bundler (latest release). That is a behavior change for existing mswin users, and it means jobs testing master on mswin no longer exercise the Bundler bundled with master. mingw and ucrt still use the shipped Bundler.

For the mswin release builds, installing the latest Bundler is expected (same as the RubyInstaller releases). The concern is only the master build.

I guess this is also why the matrix.ruby != 'mswin' exclusion for which -a bundle (#658) could be removed in test.yml.

Might be fine if intentional, is it?

2. Nonexistent patch versions silently resolve to a different release

validateRubyEngineAndVersion falls back to v.startsWith(parsedVersion), and the mswin list starts at 3.4.11 / 4.0.7, so:

  • mswin-3.4.1 installs 3.4.13
  • mswin-4.0.1 installs 4.0.10

instead of failing with "Unknown version".

The matching logic itself is not new, but for CRuby it was not reachable in practice, because RubyInstaller and ruby-builder have the early patch releases of each series (so 3.4.1 is an exact match, and e.g. 4.0.8 on Windows correctly errors). It does already happen for JRuby: jruby-9.4.1 resolves to 9.4.16.0 rather than 9.4.1.0, and jruby-9.3.1 to 9.3.15.0.

Matching on parsedVersion + '.' after the exact-match check would fix both: jruby-9.4.1 would resolve to 9.4.1.0 and mswin-3.4.1 would error.

@hsbt

hsbt commented Nov 28, 2026

Copy link
Copy Markdown
Member Author

It wasn't intended, but I'd keep it. The bin/bundle shipped in the mswin master build has no shebang, so bash cannot run it (#658), and installing Bundler writes one that it can, the same reason #371 does this for head. bundle still runs the Bundler shipped with master, because RubyGems activates the newest one.

The patch version matching is fixed in #988, and the common.js comment is removed in #987.

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.

4 participants