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
788 stars 255 forks source link

Add windows-toolchain input #563

Closed MSP-Greg closed 8 months ago

MSP-Greg commented 8 months ago

Adds a windows-toolchain input.

  1. Only affects Windows Rubies.
  2. Current PR allows only one optional setting, which is none.  It installs the selected Ruby and adds it to PATH. No build tools are installed/activated. Hence, no extension gems can be compiled/installed via bundler.

Closes #562

k0kubun commented 8 months ago

Thanks!

MSP-Greg commented 8 months ago

Changed input name to win-ruby-platform-override. Also updated the comments in action.yml.

MSP-Greg commented 8 months ago

I updated the test added to test.yml. I originally used a PowerShell script, but that's unclear for many people. Changed to a ruby command, and checked it in my fork (see https://github.com/MSP-Greg/setup-ruby/actions/runs/7560951646)

MSP-Greg commented 8 months ago

Although I don't recall people using Windows self-hosted runners, they may prefer to use win-ruby-platform-override: none if they have all 'build related files' pre-installed on their images...

eregon commented 8 months ago

I understand the functionality well know, thanks for your comments. The main thing left is finding a good name for this input.

MSP-Greg commented 8 months ago

Do you think the name windows-toolchain: default/none (and later adding mingw/ucrt/mswin if usefl) would make sense? i.e. is "toolchain" a meaningful term on Windows too and appropriate for this?

That's fine by me, could also be windows-toolchain-override, which makes clear that it's changing something.

Which would you prefer, windows-toolchain or windows-toolchain-override?

EDIT:

Re using the word devkit, that's always been about MSYS2 toolchains, some people might not even be aware of mswin...

I understand the functionality well now, thanks for your comments.

Glad that helped. Apologies in advance for Windows explanations. I wrote plenty of code on MSFT DOS, sometimes my Windows explanations are too brief, sometimes too thorough...

eregon commented 8 months ago

Let's go with windows-toolchain. I think the "override" part is implied by not using the input's default value.

MSP-Greg commented 8 months ago

Before I spin up a gazillion jobs, how's the below for action.yml?

  windows-toolchain:
    description: |
      This only affects Windows runners.
      The default setting ('default') installs a toolchain based on the installed/activated Ruby.
      This allows Windows platform setup to override the default toolchain setup.
      At present, the only allowed setting is 'none', which only adds Ruby to PATH.
      No build tools are installed, nor are any ENV setting changed to activate them.
    default: 'default'
eregon commented 8 months ago

Sounds good. I'm thinking to take this opportunity to document a bit better what the default does:

  windows-toolchain:
    description: |
      This input allows to override the default toolchain setup on Windows.
      The default setting ('default') installs a toolchain based on the selected Ruby.
      Specifically it installs MSYS2 if not already there and installs mingw/ucrt/mswin build tools.
      It also sets environment variables using ridk if that's shipped with that Ruby.
      At present, the only other setting than 'default' is 'none', which only adds Ruby to PATH.
      No build tools are installed, nor are any ENV setting changed to activate them.
    default: 'default'
eregon commented 8 months ago

It also sets environment variables using ridk if that's shipped with that Ruby.

Do you know when ridk is present, is it always there for RubyInstaller builds? And so it's not there for mingw/ucrt/mswin?

MSP-Greg commented 8 months ago

How about the following, I changed two things -

  1. 'mingw/ucrt/mswin build tools' to 'mingw/ucrt/mswin build tools and packages'
  2. 'ridk if that's shipped with that Ruby.' to ''ridk' or 'vcvars64.bat' based on the selected Ruby.'
  windows-toolchain:
    description: |
      This input allows to override the default toolchain setup on Windows.
      The default setting ('default') installs a toolchain based on the selected Ruby.
      Specifically, it installs MSYS2 if not already there and installs mingw/ucrt/mswin build tools and packages.
      It also sets environment variables using 'ridk' or 'vcvars64.bat' based on the selected Ruby.
      At present, the only other setting than 'default' is 'none', which only adds Ruby to PATH.
      No build tools are installed, nor are any ENV setting changed to activate them.
    default: 'default'

Thoughts? Note that it also uses an openssl package compatible with the selected Ruby.

MSP-Greg commented 8 months ago

Pushed the changes as above...

eregon commented 8 months ago

Released as https://github.com/ruby/setup-ruby/releases/tag/v1.169.0