88 pull_request :
99 branches : [master]
1010
11+ defaults :
12+ run :
13+ shell : bash
14+
1115jobs :
1216 build :
1317 runs-on : windows-latest
1418 steps :
1519
20+ - name : Determine stack root
21+ run : |
22+ STACK_ROOT="$(stack --system-ghc --no-install-ghc path --stack-root || echo "C:/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows")"
23+ echo "STACK_ROOT = ${STACK_ROOT}"
24+ echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
25+
1626 - name : 📥 Checkout repository
1727 uses : actions/checkout@v4
1828
@@ -22,21 +32,10 @@ jobs:
2232 id : stack-global
2333 uses : actions/cache/restore@v3
2434 with :
25- path : C:\Users\runneradmin\AppData\Roaming\stack\
26- key : ${{ runner.os }}-appdata-roaming-stack-${{ hashFiles('**.yaml') }}
27- restore-keys : |
28- ${{ runner.os }}-appdata-roaming-stack
29-
30- - name : 💾 Restore cached stack-installed programs in ~/.local/bin
31- id : stack-programs
32- uses : actions/cache/restore@v3
33- with :
34- path : C:\Users\runneradmin\AppData\Local\Programs\stack\
35- # which files signal a change in stack's global db ?
36- # **.yaml includes */package.yaml and stack.yaml* (too many), and hopefully no other changing yamls
37- key : ${{ runner.os }}-appdata-local-programs-stack-${{ hashFiles('**.yaml') }}
35+ path : ${{ env.STACK_ROOT }}
36+ key : ${{ runner.os }}-stack-global-${{ hashFiles('**.yaml') }}
3837 restore-keys : |
39- ${{ runner.os }}-appdata-local-programs- stack
38+ ${{ runner.os }}-stack-global
4039
4140 - name : 💾 Restore cached .stack-work
4241 id : stack-work
@@ -50,56 +49,47 @@ jobs:
5049 # actions
5150
5251 - name : ⏬ Install stack
52+ # # Stack is preinstalled on GHA runners.
53+ #
5354 # if: steps.stack-programs-dir.outputs.cache-hit != 'true'
5455 # this step is needed to get stack.exe into PATH, for now
56+ # curl -sL https://get.haskellstack.org/stable/windows-x86_64.zip -o stack.zip
57+ # 7z x stack.zip stack.exe
5558 run : |
56- curl -sL https://get.haskellstack.org/stable/windows-x86_64.zip -o stack.zip
57- 7z x stack.zip stack.exe
5859 which stack
5960 stack --version
60- which ./stack
61- ./stack --version
62- # must avoid GHC versions broken on windows such as 8.8.3 with https://gitlab.haskell.org/ghc/ghc/issues/17926
63- # current default stack.yaml uses GHC 8.8.4 which hopefully is ok
6461
6562 - name : ⏬ Install GHC
6663 # if: steps.stack-programs-dir.outputs.cache-hit != 'true'
6764 # set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH%
6865 run : |
69- ./ stack --no-terminal setup --install-ghc
66+ stack --no-terminal setup --install-ghc
7067
7168 - name : Install the icu library
7269 run : |
73- ./ stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
70+ stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
7471
7572 - name : 📸 Build Snapshot
7673 run : |
77- ./ stack build --no-terminal --only-snapshot -j1
74+ stack build --no-terminal --only-snapshot -j1
7875
7976 - name : 🧰 Build Dependencies
8077 run : |
81- ./ stack build --no-terminal --only-dependencies
78+ stack build --no-terminal --only-dependencies
8279
8380 - name : 🔨 Build and run tests
8481 run : |
85- ./ stack test
82+ stack test
8683
8784 # things to be cached
8885
8986 - name : 💾 Cache stack global package db
9087 if : always() && steps.stack-global.outputs.cache-hit != 'true'
9188 uses : actions/cache/save@v3
9289 with :
93- path : ~/.stack
90+ path : ${{ env.STACK_ROOT }}
9491 key : ${{ steps.stack-global.outputs.cache-primary-key }}
9592
96- - name : 💾 Cache stack-installed programs in ~/.local/bin
97- if : always() && steps.stack-programs.outputs.cache-hit != 'true'
98- uses : actions/cache/save@v3
99- with :
100- path : ~/.local/bin
101- key : ${{ steps.stack-programs.outputs.cache-primary-key }}
102-
10393 - name : 💾 Cache .stack-work
10494 if : always() && steps.stack-work.outputs.cache-hit != 'true'
10595 uses : actions/cache/save@v3
@@ -111,6 +101,7 @@ jobs:
111101 # artifacts:
112102
113103 - name : 📦 Compress executable and data files
104+ shell : pwsh
114105 run : |
115106 # locate the data-dir
116107 $snapshot = (stack path --snapshot-install-root)
0 commit comments