-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
Add ruby-loco mingw and mswin #24
Conversation
MSP-Greg
commented
Feb 18, 2020
- Add ruby-loco mingw and mswin
- Adjust workflow for mswin - 'ridk version' & 'c extension' steps
- Allow head, mingw, & mswin to be used without ruby prefix
- win_names.yml_ tests the above, fails on some non Windows jobs deliberately
Thank you, I'll review this tomorrow. |
No hurry. I'm thinking about the package action... |
Here is how I did packages in rack. It's not that great but it works. I think I prefer something simpler where possible, e.g.
|
I thought a generic 'packages' might be helpful, but I doubt many packages have a universal name. Using your rack example, maybe something like:
Normal Windows Ruby (mingw) has MSYS2 packages and MinGW packages, so for example, a generic package input wouldn't detail whether openssl was the openssl MSYS2 package, or the mingw-w64-x86_64-openssl MinGW package... |
A little off topic, but... One of the issues here and with custom actions is determining what the environment is, whether it be OS, image version, Ruby version/platform, etc. See actions/runner-images#407 (comment) An ENV variable EDIT: after looking over some comments, the issue for it is also tagged 'macOS', so that may be added as a value, don't know... |
It would be best to keep the packages discussion in one place: #21 Sorry, I got too busy today, will review it when I get some time. |
.github/workflows/test.yml
Outdated
shell: cmd | ||
if: endsWith(matrix.ruby, 'mswin') | ||
run: | | ||
call "C:\Program Files (x86)\Microsoft Visual Studio\${{ matrix.vs }}\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems quite inconvenient to have to use this long line before installing any C extension.
Is this something the action could setup once and for all? Or it has to be done in each shell session?
I think very few Rubyists expect having to anything extra before being able to install C extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is mess. I've defined the string as an ENV variable in actions-ruby.
The vcvars*.bat
files are needed when using msvc from the command line, as the scripts set up the environment. So, if one needs the tools in multiple steps (which isolate the ENV from user script changes), one needs to run the script in each one until there's a better solution. I am looking into one.
Some of this is made messier by Actions image options. I haven't checked recently, but they announced that they were removing the Window-2016 image. They are still updating the code for it.
So, although they've stated that they'll only have one Windows image, that will likely change when they release another version of Windows Server. That's the image side, then there is the Visual Studio ('VS') side. There's only one version of VS in each image, but that may also change. So, again, I may see if I can get answers about the singular/multiple issues, as that effects the code and needed inputs in custom actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If https://github.com/MSP-Greg/actions-ruby/blob/164cd7048c050264a0360510c572e1d4472b4bfb/index.js#L139 is enough to let gem install json
work with mswin builds, I think we should do that in this action too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'll set it up assuming 'singular' (as does actions-ruby) and hope we can keep an eye on Actions images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. The Actions job runs it both in a cmd shell and the default PowerShell shell. A little different. I've got a bunch of issues to open re the Actions runner, one will be about adding the setting in VCVARS to the env with an action...
index.js
Outdated
@@ -7,6 +7,10 @@ async function run() { | |||
const platform = getVirtualEnvironmentName() | |||
const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version')) | |||
|
|||
if (!platform.startsWith('windows') && version.match(/(mingw|mswin)$/)) { | |||
throw new Error(`ruby-${version} is only available on windows`) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary, getAvailableVersions + validateRubyEngineAndVersion will already check that below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine. I thought a specific message might be helpful, I'll remove.
windows.js
Outdated
@@ -46,6 +48,25 @@ export async function install(platform, ruby) { | |||
return rubyPrefix | |||
} | |||
|
|||
// all standard msvc OpenSSL builds use C:\Program Files\Common Files\SSL | |||
// as per openssl/openssl | |||
function mswinSSL(hostedRuby) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just set SSL_CERT_FILE
instead like it's done for 2.2 and 2.3 above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With 2.2. and 2.3, the reason for using the ENV settings is that the OpenSSL package used pointed to a folder specific to the system the builder used.
The path for normal Windows OpenSSL builds is actually in the openssl/openssl code. MSYS2 changes it to reference the location of the exe using OpenSSL. Actions should have the files located there, but I don't want to assume that.
So, I'd prefer to set up OpenSSL as expected, and consider the 2.2 and 2.3 builds the exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think creating an empty C:\\Program Files\\Common Files\\SSL\\certs
directory has no effect, so I would just skip that and only check the cert.pem.
I'd prefer to simplify and just check C:\\Program Files\\Common Files\\SSL\\cert.pem
exists and otherwise throw.
If the cert.pem file was missing, would the ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(1024) }'
check file? If so, I think we can use that as our check of "OpenSSL works and can check certificates", without any extra code in windows.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the cert.pem file was missing, would the ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(1024) }'
It fails. Just tried locally after renaming my cert file in 'C:\Program Files\Common Files\SSL`.
C:\Program Files\Common Files\SSL\certs
It is a correctly set up OpenSSL, and people may not check for its existence...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the check in the workflow is enough then.
If people rely on a directory being in the image, that's their responsibility.
setup-ruby
should care about providing a working Ruby, including a working OpenSSL C extension, but not try to "lint" the whole system. There might be exceptions if we know something that is particularly unreliable, but for now I think the open-uri check above is good enough for testing OpenSSL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern was more about having all the Ruby builds setup the same. If some correctly connect a cert file, all should. Same for the directory. I'll check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
X509::DEFAULT_CERT_DIR exists on all builds, see:
https://github.com/MSP-Greg/ruby-setup-ruby-info/runs/460598415
head builds are failing, due to an issue with ruby/openssl. Fixed there, not pushed to ruby/ruby yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it just fails if we don't setup those files: https://github.com/ruby/setup-ruby/runs/465758532
I thought C:\\Program Files\\Common Files\\SSL\\cert.pem
would already exist but apparently not.
windows-versions.js
Outdated
@@ -24,5 +24,6 @@ export const versions = { | |||
"2.6.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.4-1/rubyinstaller-2.6.4-1-x64.7z", | |||
"2.6.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x64.7z", | |||
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z", | |||
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z" | |||
"head": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit hesitant to switch from rubyinstaller-head to ruby-loco here, because all release Windows builds are from RubyInstaller, so it creates some inconsistency.
Maybe we should allow both?
How about having head
refer to rubyinstaller-head and mingw
+ mswin
refer to ruby-loco builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Ref: #22 |
1. Add ruby-loco mingw and mswin 2. Split workflow jobs into common and specials 3. Adjust workflow for mswin - 'ridk version' & 'c extension' steps
0c63d83
to
eabdf80
Compare
So I did a force push and nothing ran... Not my day. |
I can trigger actions on |
cfg: | ||
- { ruby: rubinius, os: ubuntu-18.04 } | ||
- { ruby: mingw , os: windows-latest } | ||
- { ruby: mswin , os: windows-latest } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting syntax, that's cool :)
It's unfortunate we have to copy the steps, but I guess there is no other way.
There was a problem hiding this 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, I'll merge this.
Released as https://github.com/ruby/setup-ruby/releases/tag/v1.20.0 and |
Thanks. On to the package stuff.
I think that's clear, but we (along with most people in the ruby org) know about them. Maybe something like: It needs to be short, but hopefully it explains the builds for someone who knows nothing about Ruby on Windows... I'll defer to your judgement. IMO, the people that need to know what |
Officially supported and soon to be improved. |
@MSP-Greg Excellent! I wonder if we could merge again the test steps to avoid duplication with the new semantics for |
It does take one to two weeks...
|
I didn't notice this change, but I like it! Now all interesting Windows Ruby versions are available through one action - great work! |