Skip to content

Commit d244592

Browse files
committed
[ ci ] Remove hardcoded Stack root on Unix
1 parent aaaad2f commit d244592

File tree

2 files changed

+79
-41
lines changed

2 files changed

+79
-41
lines changed

.github/workflows/test-unix.yaml

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
name: CI (Unix)
44

5+
defaults:
6+
run:
7+
shell: bash
8+
59
on:
610
push:
711
branches: [master, ci-*, ci]
@@ -22,16 +26,30 @@ jobs:
2226
- name: 📥 Checkout repository
2327
uses: actions/checkout@v4
2428

25-
- name: 🏗 Install yq
29+
- name: 🏗 Install yq (Windows)
30+
if: runner.os == 'Windows'
2631
uses: frenck/action-setup-yq@v1
2732

28-
- name: 🔍 Determine stack resolver & GHC
33+
- name: 🔍 Determine Stack resolver & GHC version
2934
run: |
30-
STACK_ROOT="$(stack path --stack-root)"
3135
STACK_RESOLVER=$(yq .resolver stack.yaml)
3236
GHC_VERSION=$(echo $(yq .compiler stack.yaml) | cut -c 5-)
3337
echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
34-
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
38+
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
39+
40+
- name: 🏗 Setup Haskell
41+
if : runner.os == 'macOS'
42+
uses: haskell-actions/setup@v2
43+
id: setup-haskell
44+
with:
45+
ghc-version: ${{ env.GHC_VERSION }}
46+
enable-stack: true
47+
stack-version: 'latest'
48+
49+
- name: 🔍 Determine Stack root
50+
run: |
51+
STACK_ROOT="$(stack path --stack-root)"
52+
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
3553
3654
# things to be restored:
3755
# Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.
@@ -60,19 +78,27 @@ jobs:
6078
run: |
6179
echo PKG_CONFIG_PATH="$(brew --prefix)/opt/icu4c/lib/pkgconfig" >> "${GITHUB_ENV}"
6280
63-
- name: ⏬ Setup Haskell
64-
uses: haskell-actions/setup@v2
65-
id: setup-haskell
66-
with:
67-
ghc-version: ${{ env.GHC_VERSION }}
68-
enable-stack: true
69-
stack-version: 'latest'
81+
# - name: ⏬ Setup Haskell
82+
# uses: haskell-actions/setup@v2
83+
# id: setup-haskell
84+
# with:
85+
# ghc-version: ${{ env.GHC_VERSION }}
86+
# enable-stack: true
87+
# stack-version: 'latest'
88+
89+
- name: 📸 Build Snapshot
90+
run: |
91+
stack build --no-terminal --only-snapshot -j1
92+
93+
- name: 🧰 Build Dependencies
94+
run: |
95+
stack build --no-terminal --only-dependencies
7096
71-
- name: 🔨 Build
72-
run: stack build
97+
# - name: 🔨 Build
98+
# run: stack build
7399

74-
- name: 🧪 Run tests
75-
run: stack test
100+
# - name: 🧪 Run tests
101+
# run: stack test
76102

77103
# things to be cached
78104

@@ -215,10 +241,13 @@ jobs:
215241
mv zip/als-macos.zip .
216242
fi
217243
218-
- name: 🔨 Build and run tests
219-
run: |
244+
- name: 🧪 Run tests
245+
run: stack test --ta --als-path=zip/als
246+
247+
# - name: 🔨 Build and run tests
248+
# run: |
220249

221-
stack test --ta --als-path=zip/als
250+
# stack test --ta --als-path=zip/als
222251

223252
# release (optional)
224253
- name: 🚢 Release Artifacts

.github/workflows/test-windows.yaml

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,30 @@ jobs:
2222
- name: 📥 Checkout repository
2323
uses: actions/checkout@v4
2424

25-
- name: 🏗 Install yq
25+
- name: 🏗 Install yq (Windows)
26+
if: runner.os == 'Windows'
2627
uses: frenck/action-setup-yq@v1
2728

28-
- name: 🔍 Determine stack root and resolver and GHC
29+
- name: 🔍 Determine Stack resolver & GHC version
2930
run: |
30-
STACK_ROOT="$(stack path --stack-root)"
3131
STACK_RESOLVER=$(yq .resolver stack.yaml)
3232
GHC_VERSION=$(echo $(yq .compiler stack.yaml) | cut -c 5-)
33-
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
3433
echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
35-
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
36-
# run: |
37-
# STACK_ROOT="$(stack --system-ghc --no-install-ghc path --stack-root || echo "C:/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows")"
38-
# echo "STACK_ROOT = ${STACK_ROOT}"
39-
# echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
40-
# What about C:/Users/runneradmin/AppData/Roaming/stack ?
34+
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
35+
36+
- name: 🏗 Setup Haskell
37+
if : runner.os == 'macOS'
38+
uses: haskell-actions/setup@v2
39+
id: setup-haskell
40+
with:
41+
ghc-version: ${{ env.GHC_VERSION }}
42+
enable-stack: true
43+
stack-version: 'latest'
44+
45+
- name: 🔍 Determine Stack root
46+
run: |
47+
STACK_ROOT="$(stack path --stack-root)"
48+
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
4149
4250
# things to be restored:
4351
# Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.
@@ -65,23 +73,20 @@ jobs:
6573
run: |
6674
stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf
6775
68-
# - name: 📸 Build Snapshot
69-
# run: |
70-
# stack build --no-terminal --only-snapshot -j1
76+
- name: 📸 Build Snapshot
77+
run: |
78+
stack build --no-terminal --only-snapshot -j1
7179
72-
# - name: 🧰 Build Dependencies
73-
# run: |
74-
# stack build --no-terminal --only-dependencies
80+
- name: 🧰 Build Dependencies
81+
run: |
82+
stack build --no-terminal --only-dependencies
7583
76-
# - name: 🔨 Build and run tests
77-
# run: |
78-
# stack test
7984
80-
- name: 🔨 Build
81-
run: stack build
85+
# - name: 🔨 Build
86+
# run: stack build
8287

83-
- name: 🧪 Run tests
84-
run: stack test
88+
# - name: 🧪 Run tests
89+
# run: stack test
8590

8691
# things to be cached
8792

@@ -131,6 +136,10 @@ jobs:
131136
cd ..
132137
mv zip/als-windows.zip .
133138
139+
- name: 🧪 Run tests
140+
run: stack test --ta --als-path=zip/als.exe
141+
142+
134143
# release (optional)
135144
- name: 🚢 Release Artifacts
136145
if: startsWith(github.ref, 'refs/tags/v') # so that only commits with a git tag would upload artifacts

0 commit comments

Comments
 (0)