From 7669612dd8eb36a82ca896411cc99cfff25915d0 Mon Sep 17 00:00:00 2001 From: Nikolai Ponomarev Date: Sat, 14 Sep 2024 15:33:50 +0300 Subject: [PATCH] Change caching logic On Unix OSes caching worked fine, but on Windows it cached the wrong folder and Windows always took too much time --- .github/workflows/build-and-test.yaml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index e61ba10..0836a12 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -11,6 +11,7 @@ jobs: - name: Setup Haskell with Stack uses: haskell-actions/setup@v2 + id: setup with: enable-stack: true stack-version: "latest" @@ -18,7 +19,7 @@ jobs: - name: Cache dependencies uses: actions/cache@v4 with: - path: ~/.stack + path: ${{ steps.setup.outputs.stack-root }} key: pedantic-${{ hashFiles('stack.yaml') }} restore-keys: | pedantic- @@ -45,25 +46,18 @@ jobs: - name: Setup Haskell with Stack uses: haskell-actions/setup@v2 + id: setup with: enable-stack: true stack-version: "latest" - - name: Cache dependencies on Unix-like OS - if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') - uses: actions/cache@v4 - with: - path: ~/.stack - key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} - - - name: Cache dependencies on Windows - if: startsWith(runner.os, 'Windows') + - name: Cache dependencies uses: actions/cache@v4 with: - path: | - ~\AppData\Roaming\stack - ~\AppData\Local\Programs\stack + path: ${{ steps.setup.outputs.stack-root }} key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} + restore-keys: | + ${{ runner.os }} - name: Install dependencies run: |