Closed andreasabel closed 1 year ago
Caching failure due to this problem in the wild:
path: /home/runner/.cabal/store
Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
Workaround: mkdir -p ~/.cabal
before running the setup action.
See e.g.: https://github.com/agda/agda/commit/c5f700c5dc009363820f99851cec8aff86ea943a :
steps:
- uses: actions/checkout@v3
- name: Switch off XDG directories for cabal (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
mkdir -p ~/.cabal
# The presence of ~/.cabal switches cabal 3.10 to not use the XDG layout.
- uses: haskell/actions/setup@v2
I believe setting CABAL_DIR=$HOME/.cabal
is the cleanest solution. CI tools don't benefit from the XDG split anyway, and perhaps ten years from now the backwards compatibility based on ~/.cabal
existing may be removed.
@athas wrote:
I believe setting
CABAL_DIR=$HOME/.cabal
is the cleanest solution.
Thanks!
@Mikolaj @ulysses4ever If I integrate CABAL_DIR=$HOME/.cabal
into the setup action, then we won't be able to CI the XDG feature for cabal. Opinions?
@Mikolaj @ulysses4ever If I integrate
CABAL_DIR=$HOME/.cabal
into the setup action, then we won't be able to CI the XDG feature for cabal. Opinions?
Please go ahead. When we want to switch to XDG, we'll find a way around, e.g., we'd empty the env variable.
This option was meant to be disruptive. (In the hindsight, https://github.com/haskell/cabal/issues/8577 perhaps had a good idea for managing some of the disruption.) In the interest of damage management, I'd say, forcing the old way in the CI sounds fine. Maybe a more principled solution would be to make another action parameter for whether or not to do what you suggest (and by default indeed do that). Although, not many users would be interested in such partner, perhaps, and it's a code that you need to maintain... All in all, it's your call. Erroring on the safe side is perhaps preferable.
e.g., we'd empty the env variable
Well, I'm afraid if the action explicitly set it, we won't be able to do anything. Except, as I do in haskell/cabal#8840, opt out of cabal update in the action altogether.
For now, I settled for the workaround that creates ~/.cabal
, because this fits more smoothly into the current code of the action.
If we need some parametrization, we can add it later. For now, I just worry to extinguish the wildfires.
Released as latest
and v2
(not yet as v2.3
or v2.3.6
).
Newly released
cabal 3.10.1.0
uses the XDG directory structure unless a~/.cabal
is already present. From https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.10.1.0.md#significant-changes:We likely need to adapt the
cabal-store
output to respect this change or make sure stuff lands in./~cabal
as it used to be: https://github.com/haskell/actions/blob/86bd3eda129ecad970079574dd4001961be531f8/setup/src/setup-haskell.ts#L61-L67Upstream issue: