-
Notifications
You must be signed in to change notification settings - Fork 54
Consider ghcup for windows #70
Comments
I think the windows images from GitHub still use chocolatey under the hood, so I would still default to that (for fastest setup time in the cloud), but I'm looking forward to being able to fall back to ghcup on Windows and possibly even switch to using it first if the action images start using ghcup for windows too. PRs are more than welcome for the functionality, but otherwise I'll try to get around to it when time permits over the next few weeks :) (Edit: in case it wasn't clear, I deeply appreciate the windows support in ghcup. It's something I've been looking forward to for a long time and I'm super stoked about it. Thanks for all your work in the Haskell tooling space!) |
Good point. I timed that and from my tests ghcup is twice as fast: https://github.com/hasufell/shortbytestring/runs/3487178253?check_suite_focus=true#step:3:1 Takes 2m5s and installs ghcup, cabal, ghc and msys2 Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false Takes 3m59s and installs cabal, ghc and msys2 choco install -y haskell-dev Does the haskell action do anything different that would make chocolatey faster? |
linux/macos uses the package manager (ppa/hvr) for ghc and ghcup for cabal, it seems the ghc installed by ghcup is bigger than the other one (???): # We are using apt-get to install ghc, not ghcup,
# because ghc installed through ghcup takes up too much disk space (2GB versus 1GB through apt-get) I think @maerwald will find that interesting 😉 |
I'm not sure how that's relevant to the windows discussion? (The reason is that the apt repository has debug symbols and documentation separate. The GHC build system doesn't allow that split. It has to be done manually.) |
Well if linux/macos already would use ghcup for ghc (even as fallback) it would be more appealing for gha unify all the three os's through ghcup |
In fact upstreaming the actual haskell actions ghc/cabal/stack setup logic to gha vms would be great by itself |
I don't understand. I thought |
hmm but yeah we can ignore upstream 🙂 |
Ah. I wasn't aware. Well, then my suggestion is to simply tell ghcup where the pre-installed msys2 is. Then the installation will take only a couple of seconds. |
Also it does not install all ghc versions, only |
So we can use the pre-installed msys2 via: Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false, $true, $true, $false, $false, $false, $false, C:\, "", C:\msys64, C:\cabal This takes 15 seconds to install ghcup: https://github.com/hasufell/shortbytestring/runs/3506845639?check_suite_focus=true#step:3:1 |
Also worth considering that Chocolatey is fairly unreliable. For example, I just witnessed this failure on Windows:
Reliability trumps installation speed in CI. |
yeah in hls we experienced that issue with choco lately 😕 |
So this has been merged upstream at
|
@hasufell How do I use the |
Hmm, maybe the PATH update didn't make it: actions/runner-images@a9ac553 GHCup on windows is installed usually at Furthermore, the script should have set |
I don't see those environment variables either. |
Can you try without haskell actions? |
It's the same without Haskell actions. |
Is there a way I can run |
I'll have to investigate |
@hasufell Thanks for the PR! |
ghcup is now pre-installed on windows machines as well and should be in PATH etc. |
This is amazing. Thanks! |
@jared-w : Do you think the time is ripe for switching to |
Some times choco had the new version before ghcup 😉 . I usually open an issue in Mistuke/GhcChoco#18 and usually @Mistuke adds it very quickly when it is not. But afaics 9.2.1 was added to chocolatey: https://community.chocolatey.org/packages/ghc |
Yes: https://gitlab.haskell.org/ghc/ghc/-/issues/21196 It seems you can get it to work when msys2 is in PATH though, but you might hit other problems. |
Yes it's coming. I'm just adding a workaround for the broken packaging. I tend to not like to push broken compilers :) |
Many GHC releases are defunct on one platform or another. E.g. M1 is broken on most GHC versions. I don't do downstream patching. |
That's fine :) I have routinely worked around broken packaging and will continue to do so. |
Hopefully that won't be required soon anymore, since GHC should have some dogfood tests as you suggested in the ticket. I've also offered my help of testing releases manually before they are announced via ghcup, since this is probably the 3rd time I've discovered such issues close after release. But GHC devs decided against human testing. |
yeah, given the complexity of ghc and how frequently minor version breaks things it should have rcs for minor versions, even with a smaller window time |
Btw... ghcup is pre-installed on all github environments, so this should work on all platforms without jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
ghc: ['8.0.2', '8.2.2', '8.4.4', '8.6.5', '8.8.4', '8.10.7', '9.0.2', '9.2.1']
cabal: ['3.6.2.0']
steps:
- name: Install ghc/cabal
run: |
ghcup install ghc --set ${{ matrix.ghc }}
ghcup install cabal ${{ matrix.cabal }}
shell: bash And in fact, that's what I do in filepath: https://github.com/haskell/filepath/blob/4638d2a6a375064c270fd0a3e249d922859b4f9b/.github/workflows/test.yaml#L58 So users who want ghcup release channels, can already do so and don't need this action... hence closing. |
I still think use ghcup in this action would make sense. You can also use chocolatey or hvr/ppa outside this action but it allows workflows abstract away from the concrete channels and the future changes in them. |
This CI does not demonstrate caching of dependencies. How do communicate the cabal store directory in a stable way without
|
I feel like |
Is there already a cabal issue for this? If not please report, linking here! |
It seems to me that the incoming An usual workaround is tell cabal use a specific store dir, changing the global config using However chocolatey already sets the store dir in C:\sr and ghcup in X:\cabal\store and the setup action gives it to you. |
I would actually suggest using https://github.com/haskell-works/cabal-cache ...it allows syncing to a directory (instead of S3). Then you would tell I can code up an example if I have a bit more time. |
Work on this is going on in a fork: main...wz1000:actions:wip/783 |
Right now, when I define
This will fail on windows only, because
8.10.7
isn't in choco yet. It's quite confusing, because different installers with different release schedules are used under the hood.I merged https://gitlab.haskell.org/haskell/ghcup-hs/-/merge_requests/159 which would allow the installation procedure on windows to be:
Leaving you with an msys2 installation (in
C:\ghcup\msys64
) and the ghcup binary (inC:\ghcup\bin
), nothing more.Installations of msys2 packages would be carried out via:
The text was updated successfully, but these errors were encountered: