haskell / actions

Github actions for Haskell CI
146 stars 54 forks source link

Install of Cabal 3.8 fails (missing `--allow-downgrade` or `--force`) #264

Closed wenkokke closed 1 year ago

wenkokke commented 1 year ago

I'm having trouble with the setup workflow, installing Cabal 3.8 on Windows:

  Attempting to install cabal 3.8.1.0 using chocolatey
  ::stop-commands::***
  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe choco install cabal --version 3.8.1.0 -m --no-progress -r
  Installing the following packages:
  cabal
  By installing, you accept licenses for the packages.
  A newer version of cabal (v3.10.1.1) is already installed.
   Use --allow-downgrade or --force to attempt to install older versions.

  Chocolatey installed 0/1 packages. 1 packages failed.
   See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

  Failures
   - cabal - A newer version of cabal (v3.10.1.1) is already installed.
   Use --allow-downgrade or --force to attempt to install older versions.
  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe choco install cabal --version 3.8.1.0 -m --no-progress -r --pre
  Installing the following packages:
  cabal
  By installing, you accept licenses for the packages.
  A newer version of cabal (v3.10.1.1) is already installed.
   Use --allow-downgrade or --force to attempt to install older versions.

  Chocolatey installed 0/1 packages. 1 packages failed.
   See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

  Failures
   - cabal - A newer version of cabal (v3.10.1.1) is already installed.
   Use --allow-downgrade or --force to attempt to install older versions.
  ::***::

This is possibly an upstream issue, where the Chocolatey package is missing --allow-downgrade or --force?

andreasabel commented 1 year ago

Is this chocolatey 2.x? As @Mistuke alerted me, side-by-side installs would be removed in 2.x, so this could where it hits us:

But I am not sure this is the problem.

Please provide more information:

wenkokke commented 1 year ago

Here's the failed workflow: https://github.com/wenkokke/setup-agda/actions/runs/5227663394/jobs/9439463602#step:3:117

I actually realised that this is using haskell/actions/setup@v2.0.4, so this may be outdated.

ulysses4ever commented 1 year ago

The workflow run says that installed software of its image can be found here: https://github.com/actions/runner-images/blob/win22/20230606.1/images/win/Windows2022-Readme.md and indeed it's Choco 2.0.

andreasabel commented 1 year ago

One can try to add the suggested flags to the invocation of choco: https://github.com/haskell/actions/blob/d6a7b316f66cd8a730ed619cdc80c276df942196/setup/src/installer.ts#L285-L301 Maybe first add a test to CI that reproduces the error.

wenkokke commented 1 year ago

Here's another example: https://github.com/plfa/plfa.github.io/actions/runs/5247954011/jobs/9478802271#step:3:1

This uses haskell/actions/setup@v2.3.3.

wenkokke commented 1 year ago

Therefore, I'm guessing any test that tries to install an older cabal on Windows would work?

andreasabel commented 1 year ago

This uses haskell/actions/setup@v2.3.3.

Sorry, you need at least 2.3.7 to get Cabal 3.10.1.0 correctly with choco.

Actually, what is the point of pinning to a patch version of the setup action? Why not at least @v2.3 (if not @v2 which I'd recommend)?

P.S.: To elaborate: Pinning an action does not really work since there is no way to pin the underlying runner, so pinning does not guarantee that things continue to function. So, imo, the most sensible choice is to always use the latest version of the action.

Mistuke commented 1 year ago

Wasn't the allow multiple versions only needes because of the dependencies? Have you tried just installing cabal first. As long as that cabal is compatible choco won't change it.

That is you can't like use cabal 3.2 with ghc 9.6 for instance because they don't work together, but you can use it find with say 8.8

andreasabel commented 1 year ago

I suppose the questions have been answered in the meantime. Please reopen if unclarities remain.