gelisam / deploy-hint

Demonstrating that you don't need to install ghc in order to use the hint library.
11 stars 3 forks source link

test on MacOS and Windows #3

Open gelisam opened 5 years ago

gelisam commented 5 years ago

I heard Travis supports all three platforms now, could I use that?

gelisam commented 5 years ago

Hmm, I need to compile the assets on one machine and then copy them to another machine, but I think Travis will only allow me to run one build script on one machine. It's worth taking a look though!

polymorphicengine commented 3 years ago

Hey gelisam, have you thought about this some more? Do you think that we could maybe use github actions to get it to work on Mac and windows?

gelisam commented 3 years ago

Ooh, that's a good idea! It looks like GitHub Actions do support all the required pieces:

polymorphicengine commented 3 years ago

cool! I'm focusing on windows right now and I tried it here: https://github.com/onthepeakofnormal/tidal-deploy/runs/2865428623?check_suite_focus=true it can compile the simple test program but when executing (still on the machine with ghc) it gives the error that it can't find the mingw toolchain. I tried this on my old laptop with windows 10 aswell and it gives me the same error, so I think it might have something to do with hint?

gelisam commented 3 years ago

I'm not setup to develop on Windows so I can't easily test whether hint is broken on Windows, I hope not. I've seen reports of people successfully using hint on Windows in the past, so it should work. Does hint's test suite pass for you on Windows? Hopefully it's the fancy things we're doing in deploy-hint which breaks it, in which case we can make progress by identifying which step breaks it.

In any case, mingw is a linux-like environment in Windows which ghc uses, so it makes a lot of sense that hint would use it too. Perhaps ghc on Windows has a script which somehow makes mingw available to ghc when compiling, and we need to add something similar to wrap the deploy-hint executable?

gelisam commented 3 years ago

All but one of the hint tests pass on Windows, so while there is indeed a regression on Windows, it's not the symptom you've experienced. I thus conclude that the problem is specific to deploy-hint. I recommend comparing the two environments to see what's different between the passing tests in hint's CI and the failing tests in deploy-hint's.

yaxu commented 3 years ago

Yep it might be worth getting a linux build working on github actions first, there are probably other path issues as the haskell-libs subfolder needs to be in the current working directory (i.e you have to change to the my-program folder).

There's info about how windows finds mingw here: https://haskell-code-explorer.mfix.io/package/ghc-8.6.5/show/main/SysTools/BaseDir.hs#L57

There's some stuff about finding 'topdir' but I'm guessing (hoping) that hint sets this explicitly as haskell-libs. So probably mingw needs to be copied into the my-program folder too.

ghc 9.x will tell you where it's looking for mingw, which would be handy: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4517/diffs

Unfortunately we can't upgrade to ghc 9.x without losing the cabal sandbox functionality :/

polymorphicengine commented 3 years ago

For my machine the mingw folder is located under C:\tools\ghc-8.6.5\mingw, I tried what Alex suggested and copied it to the folder where I execute my-program.exe, and it seems to work. (ofcourse it gives me an error: Missing file: haskell-libs\settings, which was expected)

Edit: Just tried replacing the invocations of unsafeRunInterpreterWithArgsLibs with unsafeRunInterpreterWithArgs and that works

polymorphicengine commented 3 years ago

I have set up a workflow in github actions for a minimal example of distributing hint on windows here: https://github.com/onthepeakofnormal/tidal-deploy/actions