Skip to content

Commit 73f14a3

Browse files
authored
Merge pull request #6024 from commercialhaskell/ci-fix
Fix the GitHub Actions CI
2 parents 33f0711 + 922f7ea commit 73f14a3

File tree

2 files changed

+68
-39
lines changed

2 files changed

+68
-39
lines changed

.github/workflows/integration-tests.yml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,20 @@ jobs:
5050
~\AppData\Roaming\stack
5151
~\AppData\Local\Programs\stack
5252
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}-${{ matrix.cache-bust }}
53-
- name: Update PATH on Windows
54-
if: startsWith(runner.os, 'Windows')
55-
run: |
56-
# On Windows, `stack upgrade` fails to overwrite the Stack executable at
57-
# C:\hostedtoolcache\windows\stack\2.9.1\x64\, so add location of
58-
# upgraded Stack executable to the PATH for subsequent steps:
59-
"C:\Users\runneradmin\AppData\Roaming\local\bin" >> $env:GITHUB_PATH
6053

61-
- name: Install deps and run checks
54+
# Separating out Unix-like OS from Windows because of the problem of
55+
# upgrading GitHub-supplied Stack 2.9.1 to 2.9.3 on Windows
56+
- name: Install deps and run checks on Unix-like OS
57+
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
6258
shell: bash
6359
run: |
6460
set -ex
6561
66-
# Stack 2.9.3 is required to build Stack. In the bash shell on the
67-
# Windows runner, this may report that the Stack executable is not on
68-
# the PATH. That appears to be due to some latency somewhere.
62+
# Stack 2.9.3 is required to build Stack.
6963
stack upgrade
7064
71-
# Introduce a short pause, otherwise, in the bash shell on the Windows
72-
# runner, the following `which` command does not recognise that
73-
# `stack.exe` has been copied to a directory on the PATH.
74-
sleep 1
75-
76-
# Check location(s) of Stack executable(s)
77-
which -a stack
65+
# Check the Stack version
66+
stack --version
7867
7968
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]
8069
then
@@ -113,6 +102,35 @@ jobs:
113102
114103
set +ex
115104
105+
# Separating out Windows because of the problem of upgrading GitHub-supplied
106+
# Stack 2.9.1 to 2.9.3 on Windows
107+
- name: Install deps and run checks on Windows
108+
if: startsWith(runner.os, 'Windows')
109+
shell: bash
110+
run: |
111+
set -ex
112+
113+
# Stack 2.9.3 is required to build Stack. The --local-bin-path is
114+
# required to allow Stack (effectively) to overwrite the currently
115+
# running Stack executable. The should be fixed in later versions of
116+
# Stack that reflect
117+
# https://github.com/commercialhaskell/stack/pull/6023
118+
stack --local-bin-path /c/hostedtoolcache/windows/stack/2.9.1/x64 upgrade
119+
120+
# Check the Stack version
121+
stack --version
122+
123+
# In case GHCup hooks have been created, remove them
124+
if [ -d $(stack path --stack-root)/hooks ]
125+
then
126+
rm -Rf $(stack path --stack-root)/hooks
127+
fi
128+
129+
# Do this in the same step as installing deps to get relevant env var modifications
130+
stack etc/scripts/release.hs check ${{ matrix.release-args }}
131+
132+
set +ex
133+
116134
- name: Build bindist
117135
shell: bash
118136
run: |

.github/workflows/unit-tests.yml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,20 @@ jobs:
6868
~\AppData\Roaming\stack
6969
~\AppData\Local\Programs\stack
7070
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}-${{ matrix.extra-suffix }}
71-
- name: Update PATH on Windows
72-
if: startsWith(runner.os, 'Windows')
73-
run: |
74-
# On Windows, `stack upgrade` fails to overwrite the stack executable at
75-
# C:\hostedtoolcache\windows\stack\2.9.1\x64\, so add location of
76-
# upgraded Stack executable to the PATH for subsequent steps:
77-
"C:\Users\runneradmin\AppData\Roaming\local\bin" >> $env:GITHUB_PATH
78-
- name: Run tests
71+
72+
# Separating out Unix-like OS from Windows because of the problem of
73+
# upgrading GitHub-supplied Stack 2.9.1 to 2.9.3 on Windows
74+
- name: Run tests on Unix-like OS
75+
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
7976
shell: bash
8077
run: |
8178
set -ex
8279
83-
# Stack 2.9.3 is required to build Stack. In the bash shell on the
84-
# Windows runner, this may report that the Stack executable is not on
85-
# the PATH. That appears to be due to some latency somewhere.
80+
# Stack 2.9.3 is required to build Stack.
8681
stack upgrade
8782
88-
# Introduce a short pause, otherwise, in the bash shell on the Windows
89-
# runner, the following `which` command does not recognise that
90-
# `stack.exe` has been copied to a directory on the PATH.
91-
sleep 1
92-
93-
# Check location(s) of Stack executable(s)
94-
which -a stack
83+
# Check the Stack version
84+
stack --version
9585
9686
if [[ "${{ matrix.extra-suffix }}" == "alpine" ]]
9787
then
@@ -112,9 +102,6 @@ jobs:
112102
if [[ "${{ matrix.os }}" == "macos-latest" ]]
113103
then
114104
echo "Skipping ldd check on Mac"
115-
elif [[ "${{ matrix.os }}" == "windows-latest" ]]
116-
then
117-
echo "Skipping ldd check on Windows"
118105
elif [[ "${{ matrix.extra-suffix }}" == "alpine" ]]
119106
then
120107
# ldd returns exit code 1 if it's static, so failure is success
@@ -124,3 +111,27 @@ jobs:
124111
fi
125112
126113
./bin/stack --version
114+
115+
# Separating out Windows because of the problem of upgrading GitHub-supplied
116+
# Stack 2.9.1 to 2.9.3 on Windows
117+
- name: Run tests on Windows
118+
if: startsWith(runner.os, 'Windows')
119+
shell: bash
120+
run: |
121+
set -ex
122+
123+
# Stack 2.9.3 is required to build Stack. The --local-bin-path is
124+
# required to allow Stack (effectively) to overwrite the currently
125+
# running Stack executable. The should be fixed in later versions of
126+
# Stack that reflect
127+
# https://github.com/commercialhaskell/stack/pull/6023
128+
stack --local-bin-path /c/hostedtoolcache/windows/stack/2.9.1/x64 upgrade
129+
130+
# Check the Stack version
131+
stack --version
132+
133+
stack test ${{ matrix.stack-args }} --haddock --no-haddock-deps --ghc-options="-Werror -O0" --copy-bins --local-bin-path bin
134+
135+
echo "Skipping ldd check on Windows"
136+
137+
./bin/stack --version

0 commit comments

Comments
 (0)