From d25c51bbfd594e35fe9630893979b06e853530a0 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 12 Jun 2022 16:45:20 +0100 Subject: [PATCH] Adapt existing Haskell Stack example for Windows The default `STACK_ROOT` is `~/.stack` only on Unix-like operating systems. On Windows, the default is `%APPDATA%/stack` (usually `%HOME%\AppData\Roaming\stack`). On Unix-like OSs, Stack stores GHC and other tools in a `programs` directory in the `STACK_ROOT`. On Windows, Stack stores those tools and MSYS2 in `%LOCALAPPDATA%\Programs\stack` (usually `%HOME%\AppData\Local\Programs\stack`). --- examples.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/examples.md b/examples.md index 47c2b22..d9c4499 100644 --- a/examples.md +++ b/examples.md @@ -223,6 +223,8 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba ## Haskell - Stack +### Linux or macOS + ```yaml - uses: actions/cache@v3 name: Cache ~/.stack @@ -240,6 +242,27 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba ${{ runner.os }}-stack-work- ``` +### Windows + +```yaml +- uses: actions/cache@v3 + name: Cache %APPDATA%\stack %LOCALAPPDATA%\Programs\stack + with: + path: | + ~\AppData\Roaming\stack + ~\AppData\Local\Programs\stack + key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} + restore-keys: | + ${{ runner.os }}-stack-global- +- uses: actions/cache@v3 + name: Cache .stack-work + with: + path: .stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }} + restore-keys: | + ${{ runner.os }}-stack-work- +``` + ## Java - Gradle >Note: Ensure no Gradle daemons are running anymore when your workflow completes. Creating the cache package might fail due to locks being held by Gradle. Refer to the [Gradle Daemon documentation](https://docs.gradle.org/current/userguide/gradle_daemon.html) on how to disable or stop the Gradle Daemons.