8000 Add support for Windows builds by paulo-ferraz-oliveira · Pull Request #49 · erlef/setup-beam · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for Windows builds #49

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

Merged
merged 4 commits into from
Jun 24, 2021
Merged

Add support for Windows builds #49

merged 4 commits into from
Jun 24, 2021

Conversation

paulo-ferraz-oliveira
Copy link
Collaborator
@paulo-ferraz-oliveira paulo-ferraz-oliveira commented Jun 22, 2021

Opening as draft.

As-is, stuff appears to be working (and you're Ok to review, since I don't expect this to change much) but a couple of questions reside. I'll comment on the code later.

Closes #12.
Closes #44.

Edit: one big question for me is "Should we open an exception to the Windows installation script in order to support an even further past"?

@@ -0,0 +1,5 @@
Write-Output "Installer for Elixir for Windows not available"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

He/she/it who comes after is more than welcome to take a stab at this. For the time being I preferred to be explicit in saying Elixir is not available.

Copy link
Member

Choose a reason for hiding this comment

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

It's also not clear whether the elixir web installer can do unattended installs to boot.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought the main selling point of Elixir web installer was that it would install OTP for you as well. Which is not what we want as we want more control into particular OTP versions.

I think we could treat Elixir tarball similar to Erlang tarballs, we unpack it somewhere and add bin/ to path. Elixir ships with Windows scripts (https://github.com/elixir-lang/elixir/tree/master/bin). I don't know if it is relevant but it looks like it only has .ps1 for mix and not others.

THat being said, probably out of the scope of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Ahh yeah, that makes sense. I've never installed elixir on windows, but yeah I would think the precompiled tarball should "just work" ™️

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

THat being said, probably out of the scope of this PR.

If it very simple to add (ie.I have instructions or pointers) I don't mind doing it - in that sense it's not out-of-scope because Elixir was part of the mix already, but I don't have an easy way to do it, since I might miss something. With Erlang/OTP I knew exactly what I was looking for.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That said, can any of you give me pointers as to how this could be achieved?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

we should of course download from repo.hex.pm, same as we do for Linux, because we want to grab Elixir compiled against a matching OTP version.

in fact, do we even need install-elixir.ps1? perhaps it's easier to do everything in JS because it is supposed to work cross-platform, all we need to do is unzip and add the bin/ directory to $GITHUB_PATH. Again I'm not well versed to comment on the implementation, pick whatever is the simplest and most maintainable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, the other day I was wondering why some stuff was written as Shell script vs JavaScript, myself. I think it should only be so when execution is needed in the target platform (e.g. I want to get the Elixir version from Elixir to make sure the installation process was Ok) - but most other stuff could be converted to JS... anyway, I've linked this to the newer issue, so your comments will be ported over also. Thanks for the help.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

Comments done. CI passing. Moving to Ready for review.

@paulo-ferraz-oliveira paulo-ferraz-oliveira marked this pull request as ready for review June 22, 2021 17:50
@paulo-ferraz-oliveira
Copy link
Collaborator Author

@wojtekmach, I'd like to invite you as a reviewer, but the UI won't let me.

Copy link
Collaborator
@wojtekmach wojtekmach left a comment

Choose a reason for hiding this comment

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

This is fantastic <3 I was able to test it on a an example project and it works flawlessly.

I'm not well versed in JS or windows scripting, so I focused on the outside behaviour and not the implementation.

@@ -2,10 +2,12 @@
name: test
Copy link
Collaborator

Choose a reason for hiding this comment

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

out of the scope of this PR, but out of curiosity what's the difference between ci and test workflows? they have the same "on". should they be different jobs in the same workflow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, they could be different jobs, sure. I never bothered to change this since they were already separated from the beginning. I guess it's for semantics purposes 🤷‍♂️.

As I see it (but this is me only, I guess) ci will do the "unit tests". test will do something else. (and before these changes one of the two could actually be launched by pressing a button on the UI - it's those _dispatch options).

I can join them. @starbelly, do you feel it's better if these go to the same file now that they're dispatched in the same conditions?

Pre-release integration tests
(Windows ${{matrix.combo.os}},
Erlang/OTP ${{matrix.combo.otp-version}},
rebar3 ${{matrix.combo.rebar3-version}})
Copy link
Collaborator

Choose a reason for hiding this comment

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

here's how it looks like:

image

(https://github.com/erlef/setup-beam/pull/49/checks?check_run_id=2887537132)

How about:

Test (${{matrix.combo.os}}, Erlang/OTP ${{matrix.combo.otp-version}}, rebar3 ${{matrix.combo.rebar3-version}})

so that at least some part of the matrix shows up in the sidebar?

I'm not sure why rebar3-version didn't show up in the screenshot above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This looks better. Let me just get @starbelly's input on the previous question then I'll handle them at the same time.

I'm not sure why rebar3-version didn't show up in the screenshot above.

Me neither: checking... well, in that case we didn't choose a rebar3 on purpose, and I couldn't figure out how to have conditional titles, so that's the best I could do. We could just remove that info and put it in the step name, for example (not tested yet).

@@ -4698,6 +4726,12 @@ async function maybeInstallElixir(elixirSpec, otpVersion) {
return true
}

if (shouldMixHex) {
console.log(
"hex will not be installed (overriding default) since Elixir wasn't either",
Copy link
Collaborator

Choose a reason for hiding this comment

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

(overriding default)

what's the default?

I'm a little bit confused about this log message, I'm not sure what it's saying or if it's relevant to people not interested in using Elixir. If the idea was to say that it is possible to install Elixir here, how about something more generic: "no elixir-version specified, skipping Elixir installation"? Remember how we were surprised that ubuntu runtime had it's own rebar3? For that, I think a similar: "no rebar3-version specified, using system provided rebar3" might make sense though I'd leave that for a separate PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah, I guess this is related to #49 (comment)?

so someone set install-hex: true but left elixir-version out? to me that should be an error: "cannot set install-hex: true without specifying elixir-version" or something.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, makes no sense to have one without the other.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so someone set install-hex: true but left elixir-version out?

The fact is it was a "no-choice". install-hex is true by default (I think it's been like this for a while - didn't check). I can:

  1. improve the warning/error messages, or
  2. make it default in the code, not as an input.

Whatever choice I agree this could do with some tweaking for clarity. Let me open a new issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#50

Copy link
Collaborator

Choose a reason for hiding this comment

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

ohhhh, install-hex is true by default, that makes sense. in that case i would honestly silently ignore this and call it a day.

@starbelly
Copy link
Member

@paulo-ferraz-oliveira Did an initial first pass, looks solid! Amazing stuff 🚀 Will review in anger later this evening.

@jclem
Copy link
Contributor
jclem commented Jun 22, 2021

Just dropping by to say how happy I am to see PRs like this. I would not have had the time or probably the expertise personally to get this done (even with outside contributors) while I was maintaining this action under the official Actions org. Thanks again for agreeing to take this on, Erlef folks and thanks for the PR @paulo-ferraz-oliveira!

@starbelly
Copy link
Member

@paulo-ferraz-oliveira approved, bu CEB7 t I don't understand this question :

Should we open an exception to the Windows installation script in order to support an even further past?

paulo-ferraz-oliveira and others added 2 commits June 23, 2021 10:20
Co-authored-by: Wojtek Mach <wojtekmach@users.noreply.github.com>
Co-authored-by: Wojtek Mach <wojtekmach@users.noreply.github.com>
@paulo-ferraz-oliveira
Copy link
Collaborator Author

@starbelly

Should we open an exception to the Windows installation script in order to support an even further past?

We're only going down to 23, but there's installers for previous versions. The thing is those don't follow the same pattern for the "C:\Program Files" path (which, mind you, could also break in the future, since it's not controlled by us). As long as I could be sure that erl.exe was there and I could do a *nix-style find we could support more versions (as per the compatibility list - I'm sure people'll always try to use in what they need first). I'll keep this in the backlog and implement if I can find an easy solution. (it was too late in the evening when I did the first implementation - which had no rebar3 yet, and I was too tired to look for anything else)

@paulo-ferraz-oliveira
Copy link
Collaborator Author
paulo-ferraz-oliveira commented Jun 23, 2021

I'll wait for your comments on the Unresolved conversations, but have started a new issue for a follow-up PR, lest we cram everything here in a single commit 🤣: #51

@paulo-ferraz-oliveira
Copy link
Collaborator Author

I'm merging this to start working on #51. This is usable as-is, in any case. Feel free to comment further here or in #51 and I'll do my best to approach your suggestions.

@paulo-ferraz-oliveira paulo-ferraz-oliveira merged commit 82b4475 into erlef:main Jun 24, 2021
@paulo-ferraz-oliveira paulo-ferraz-oliveira deleted the feature/erlang-windows-builds branch June 24, 2021 20:59
@paulo-ferraz-oliveira paulo-ferraz-oliveira changed the title Add Windows to the mix Add support for Windows builds Jul 8, 2021
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.

With .../ubuntu-20.04/builds.txt 503'ing error message is out of scope Have the action work on Windows builds (from setup-erlang)
4 participants
0