Skip to content
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

Added support to indicate node.js architecture on Windows (dcodeIO#8) #9

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

Conversation

javihernandez
Copy link

No description provided.

Copy link
Owner

@dcodeIO dcodeIO left a comment

Choose a reason for hiding this comment

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

Thanks, looking good to me! 👍 Just some minor comments.

index.js Outdated
Comment on lines 29 to 30
let arch = core.getInput("node-arch") || null;
runScript("powershell", ".\\install.ps1", version, mirror, arch);
Copy link
Owner

Choose a reason for hiding this comment

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

Won't this pass the string "null" on the command line? Perhaps just ""?

Copy link
Author

Choose a reason for hiding this comment

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

So true, I just updated it.

- name: Check
run: |
node -v
node -e 'console.log(process.arch)'
Copy link
Owner

Choose a reason for hiding this comment

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

Can we make this an equality check so the step fails if the value doesn't match the expectation?

Copy link
Author

Choose a reason for hiding this comment

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

Done, let me know if you prefer a different approach ;)

index.js Outdated
@@ -26,14 +26,16 @@ async function resolveVersion(version, mirror) {
let mirror = core.getInput("node-mirror") || "https://nodejs.org/dist/";
let version = await resolveVersion(core.getInput("node-version"), mirror);
if (process.platform == "win32") {
runScript("powershell", ".\\install.ps1", version, mirror);
let arch = core.getInput("node-arch") || "";
Copy link

Choose a reason for hiding this comment

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

should this throw if provided on a different platform?

Copy link
Author

Choose a reason for hiding this comment

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

Good question. In this particular case, node-arch is only being processed on Windows systems and I marked the input field as "Windows only" in the README file in an attempt to avoid any confusion between nvm and nvm-windows.

As an option, we can move this out of the platform check and indicate that node-arch has no effect on *nix systems when provided, but IMHO, throwing doesn't look like a good idea to me. But of course, I'm happy to hear your thoughts on this.

Copy link

Choose a reason for hiding this comment

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

I can see the benefit of silently ignoring it, when the user's intention is "only respect this on windows".

However, if the user's intention is "force this architecture", they might end up running non-windows tests on a different architecture than intended, which could mask a lot of problems.

Since it's impossible to know the user's intention, it seems to me like the safer approach is to throw rather than silently ignore the invalid option.

Copy link
Author

@javihernandez javihernandez Nov 13, 2020

Choose a reason for hiding this comment

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

Sure, I see your point, however, can you elaborate a bit more on:

if the user's intention is "force this architecture", they might end up running non-windows tests on a different architecture than intended, which could mask a lot of problems.

I'm not sure I follow you. How the users might end up doing such thing if the option is ignored on non-windows platforms?
I just want to understand this better, that's all.

Oh, and throwing on non-windows platforms should be as easy as adding a core.setFailed when node-arch has been provided, @dcodeIO would you be okay with it?

Copy link

Choose a reason for hiding this comment

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

If a user's intention is to ensure their project works on 32 bit and 64 bit machines, and in fact their non-windows tests are only running on 64 bit machines, then their 32-bit users on non-windows machines aren't being covered - the testing is a false positive.

@javihernandez
Copy link
Author

Ok, I checked that the action is properly throwing but it wasn't really rejecting to keep going (see a few different CI runs here)
Now the action won't keep going if any error is thrown.

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