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

Support macOS and/or Windows? #4

Open
spl opened this issue Aug 20, 2021 · 7 comments
Open

Support macOS and/or Windows? #4

spl opened this issue Aug 20, 2021 · 7 comments

Comments

@spl
Copy link

spl commented Aug 20, 2021

It's great to see this action! I was thinking about doing something similar myself.

I recently did some work getting SWI Prolog to install on macOS and Windows. Would you be willing to accept pull requests for these? Then I could use this action instead of my scripts.

@pmoura
Copy link
Contributor

pmoura commented Aug 20, 2021

That would be most welcome. But note that only installing on Windows is currently unsupported. Or did you found an issue with macOS install?

@spl
Copy link
Author

spl commented Aug 20, 2021

I didn't see where you were installing on macOS. Plus, there's this:

'@logtalk-actions/setup-swi-prolog only supports Ubuntu Linux at this time'

@pmoura
Copy link
Contributor

pmoura commented Aug 20, 2021

Indeed. I was looking into the wrong action! Sorry about that.

@spl
Copy link
Author

spl commented Aug 20, 2021

Looking into this more, it seems like the current approach of this action makes things a bit more complicated for macOS and Windows if you want to support the same flexibility.

You allow the user to select stable or devel and either the latest version or a selected version. This works fine for the PPA on Ubuntu, but it's not so easy on the other platforms.

Current status

macOS

I currently get swi-prolog from Homebrew, but the formula only provides the latest stable release. You cannot install a specific version. There is a flag, --HEAD, that you can pass to brew install swi-prolog to build and install from https://github.com/SWI-Prolog/swipl-devel, but (a) that is not a devel release and (b) it is probably inefficient to build the binary on every run of the action.

The package for a selected version can be installed from https://www.swi-prolog.org/download/devel/bin/ or https://www.swi-prolog.org/download/stable/bin/.

Windows

I currently get SWI-Prolog from Chocolatey. It appears that you can install previous stable versions, but there are no devel packages.

The package for a selected version can also be installed from https://www.swi-prolog.org/download/devel/bin/ or https://www.swi-prolog.org/download/stable/bin/.

Potential version/platform issue

I'm not sure if there are cases where the requested version might be different for different platforms. For example, one platform has a -1 and another has a -2.

Alternatives

MacPorts

MacPorts provides a stable port and a devel port for the latest releases, but I don't think you can install a specific version. It would be a bit of work to get MacPorts installed on the GitHub Action virtual environment; I don't know if it would be a slow process to install MacPorts and the chosen port.

Website scraping

We could scrape the SWI-Prolog downloads pages to determine the latest stable and devel released packages for macOS and Windows.

Ask for help

We could ask the SWI-Prolog maintainers to help by providing a link (say, on https://www.swi-prolog.org/) that is always updated to refer to the latest macOS and Windows stable and devel packages.

Simplify the action

We could simplify in different ways:

  1. Only install the latest stable. We can easily do this on all platforms with no problem. That's what I'm doing now.
  2. Support version only on Ubuntu and Windows. If the requested version is not available for a platform, the action will fail.
  3. Use brew install --HEAD swi-proglog for devel on macOS.

However the installation is done, I think it best to be consistent about the source. That is, I don't think it's a good idea, for example, to get the macOS stable from Homebrew and the version from a .dmg on https://www.swi-prolog.org/, since those are installed in different locations and with possibly different configurations.


What are your thoughts?

@pmoura
Copy link
Contributor

pmoura commented Aug 21, 2021

It seems that installing macOS packages (which would be downloaded from either https://www.swi-prolog.org/download/devel/bin/ or https://www.swi-prolog.org/download/stable/bin/) unattended is possible:

https://apple.stackexchange.com/questions/113489/unattended-installation-of-pkg-file#113498

Assuming the same is true for the Windows installers, this would give parity with the Ubuntu installation options ("devel" and "stable"). Still, at least in the case of macOS, this will also require updating the PATH environment variable to point to (by default) /Applications/SWI-Prolog.app/Contents/MacOS/ to make swiplavailable.

@spl
Copy link
Author

spl commented Aug 23, 2021

Thanks! I assumed that it was possible on macOS, because I know Homebrew does it with casks, and that it was possible on Windows, because Chocolatey does it, but I have not yet looked into the actual mechanism.

If you think the right way to go is to use the packaged releases from https://www.swi-prolog.org, how should we resolve which version to use for latest, stable, and devel? Should we ask the SWI-Prolog maintainers to provide some assistance on that?

@pmoura
Copy link
Contributor

pmoura commented Aug 23, 2021

The main reason to go for the packaged releases from https://www.swi-prolog.org would be to avoid compiling from sources, which could force us to deal with necessary dependencies that may or may not be installed. It should also provide better setup performance. As you mention, the main issue seems to be how to find which version (from stable or devel directories), is the latest. A possible solution would be for the bin directories to contain a latest.txt file with the sole contents being the latest version (e.g. 8.3.28-1) so that we could retrieve the file and with simple sting concatenation construct the name of the installer to download. Can you ask the SWI-Prolog developers if they are willing to add such file? Thanks.

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

No branches or pull requests

2 participants