Skip to content

Commit 12348be

Browse files
committed
CI validate: drop old GHCs < 7.10
Changes: - bump GHC_FOR_RELEASE to 9.4.8 - bump action versions - uniform quoting style - satisfy actionlint - fix order: setup Haskell before cache restore (uses setup.haskell-outputs) - use `--ignore-project` in `cabal install hackage-repo-tool` - closes #8858: deleted comment - closes #9858 by dropping container and use ghcup to setup ghcs
1 parent 8e971f5 commit 12348be

File tree

1 file changed

+80
-119
lines changed

1 file changed

+80
-119
lines changed

.github/workflows/validate.yml

+80-119
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ on:
4747
env:
4848
# We choose a stable ghc version across all os's
4949
# which will be used to do the next release
50-
GHC_FOR_RELEASE: '9.2.8'
50+
GHC_FOR_RELEASE: '9.4.8'
5151
# Ideally we should use the version about to be released for hackage tests and benchmarks
52-
GHC_FOR_SOLVER_BENCHMARKS: '9.2.8'
53-
GHC_FOR_COMPLETE_HACKAGE_TESTS: '9.2.8'
52+
GHC_FOR_SOLVER_BENCHMARKS: '9.4.8'
53+
GHC_FOR_COMPLETE_HACKAGE_TESTS: '9.4.8'
5454
COMMON_FLAGS: '-j 2 -v'
5555

5656
# See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions
@@ -66,27 +66,24 @@ jobs:
6666
GHC_FOR_RELEASE: ${{ format('["{0}"]', env.GHC_FOR_RELEASE) }}
6767
strategy:
6868
matrix:
69-
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
69+
os: [ubuntu-latest, macos-latest, windows-latest]
7070
# If you remove something from here.. then add it to the old-ghcs job.
71-
ghc: ["9.8.1", "9.6.3", "9.4.8", "9.2.8", "9.0.2", "8.10.7", "8.8.4", "8.6.5"]
71+
ghc: ['9.8.2', '9.6.4', '9.4.8', '9.2.8', '9.0.2', '8.10.7', '8.8.4', '8.6.5']
7272
exclude:
7373
# corrupts GHA cache or the fabric of reality itself, see https://github.com/haskell/cabal/issues/8356
74-
- os: "windows-latest"
75-
ghc: "8.10.7"
74+
- os: windows-latest
75+
ghc: '8.10.7'
7676
# lot of segfaults caused by ghc bugs
77-
- os: "windows-latest"
78-
ghc: "8.8.4"
79-
# it also throws segfaults randomly
80-
- os: "windows-latest"
81-
ghc: "8.4.4"
77+
- os: windows-latest
78+
ghc: '8.8.4'
8279
# it often randomly does "C:\Users\RUNNER~1\AppData\Local\Temp\ghcFEDE.c: DeleteFile "\\\\?\\C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\ghcFEDE.c": permission denied (Access is denied.)"
83-
- os: "windows-latest"
84-
ghc: "8.6.5"
80+
- os: windows-latest
81+
ghc: '8.6.5'
8582

8683
steps:
8784

8885
- name: Work around XDG directories existence (haskell-actions/setup#62)
89-
if: ${{ runner.os == 'macOS' }}
86+
if: runner.os == 'macOS'
9087
run: |
9188
rm -rf ~/.config/cabal
9289
rm -rf ~/.cache/cabal
@@ -95,14 +92,20 @@ jobs:
9592

9693
# See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions
9794
- name: Manually supplied constraints/allow-newer
98-
if: ${{ github.event_name == 'workflow_dispatch' }}
95+
if: github.event_name == 'workflow_dispatch'
9996
run: |
100-
echo 'allow-newer:' ${ALLOWNEWER} >> cabal.project.validate
101-
echo 'constraints:' ${CONSTRAINTS} >> cabal.project.validate
97+
echo "allow-newer: ${ALLOWNEWER}" >> cabal.project.validate
98+
echo "constraints: ${CONSTRAINTS}" >> cabal.project.validate
99+
100+
- uses: haskell-actions/setup@v2
101+
id: setup-haskell
102+
with:
103+
ghc-version: ${{ matrix.ghc }}
104+
cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133
102105

103106
# See the following link for a breakdown of the following step
104107
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
105-
- uses: actions/cache@v3
108+
- uses: actions/cache@v4
106109
with:
107110
# validate.sh uses a special build dir
108111
path: |
@@ -111,15 +114,8 @@ jobs:
111114
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
112115
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
113116

114-
- uses: haskell-actions/setup@v2
115-
id: setup-haskell
116-
with:
117-
ghc-version: ${{ matrix.ghc }}
118-
cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133
119-
120117
- name: Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546)
121-
run: |
122-
git config --global protocol.file.allow always
118+
run: git config --global protocol.file.allow always
123119

124120
# The tool is not essential to the rest of the test suite. If
125121
# hackage-repo-tool is not present, any test that requires it will
@@ -128,26 +124,23 @@ jobs:
128124
# hackage-repo-tool breaks or fails to support a newer GHC version.
129125
- name: Install hackage-repo-tool
130126
continue-on-error: true
131-
run: |
132-
cd $(mktemp -d)
133-
cabal install hackage-repo-tool
127+
run: cabal install --ignore-project hackage-repo-tool
134128

135129
# Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs
136130
- name: Install Autotools
137131
if: runner.os == 'macOS'
138-
run: |
139-
brew install automake
132+
run: brew install automake
140133

141134
- name: Set validate inputs
142135
run: |
143136
FLAGS="${{ env.COMMON_FLAGS }}"
144-
if [[ ${{ matrix.ghc }} == ${{ env.GHC_FOR_SOLVER_BENCHMARKS }} ]]; then
137+
if [[ "${{ matrix.ghc }}" == "${{ env.GHC_FOR_SOLVER_BENCHMARKS }}" ]]; then
145138
FLAGS="$FLAGS --solver-benchmarks"
146139
fi
147-
if [[ ${{ matrix.ghc }} == ${{ env.GHC_FOR_COMPLETE_HACKAGE_TESTS }} ]]; then
140+
if [[ "${{ matrix.ghc }}" == "${{ env.GHC_FOR_COMPLETE_HACKAGE_TESTS }}" ]]; then
148141
FLAGS="$FLAGS --complete-hackage-tests"
149142
fi
150-
echo "FLAGS=$FLAGS" >> $GITHUB_ENV
143+
echo "FLAGS=$FLAGS" >> "$GITHUB_ENV"
151144
152145
- name: Validate print-config
153146
run: sh validate.sh $FLAGS -s print-config
@@ -164,19 +157,21 @@ jobs:
164157
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} --project-file=cabal.project.validate cabal-install:exe:cabal)
165158
# We have to tar the executable to preserve executable permissions
166159
# see https://github.com/actions/upload-artifact/issues/38
167-
if [[ ${{ runner.os }} == 'Windows' ]]; then
160+
if [[ "${{ runner.os }}" == "Windows" ]]; then
168161
# `cabal list-bin` gives us a windows path but tar needs the posix one
169-
CABAL_EXEC=$(cygpath $CABAL_EXEC)
162+
CABAL_EXEC=$(cygpath "$CABAL_EXEC")
170163
fi
171164
if [[ "${{ runner.os }}" == "macOS" ]]; then
172165
# Workaround to avoid bsdtar corrupts the executable
173166
# so executing it after untar throws `cannot execute binary file`
174167
# see https://github.com/actions/virtual-environments/issues/2619#issuecomment-788397841
175168
sudo /usr/sbin/purge
176169
fi
177-
export CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar.gz"
178-
tar -czvf $CABAL_EXEC_TAR -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
179-
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> $GITHUB_ENV
170+
DIR=$(dirname "$CABAL_EXEC")
171+
FILE=$(basename "$CABAL_EXEC")
172+
CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar.gz"
173+
tar -czvf "$CABAL_EXEC_TAR" -C "$DIR" "$FILE"
174+
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> "$GITHUB_ENV"
180175
181176
# We upload the cabal executable built with the ghc used in the release for:
182177
# - Reuse it in the dogfooding job (although we could use the cached build dir)
@@ -196,81 +191,55 @@ jobs:
196191
run: sh validate.sh $FLAGS -s lib-tests
197192

198193
- name: Validate lib-suite
199-
# Have to disable *-suite validation:
200-
# - the [email protected] problem is tracked at https://github.com/haskell/cabal/issues/8858
201-
# - but curently can't run it with GHC 9.6, tracking: https://github.com/haskell/cabal/issues/8883
202194
run: sh validate.sh $FLAGS -s lib-suite
203195

204196
- name: Validate cli-tests
205197
run: sh validate.sh $FLAGS -s cli-tests
206198

207199
- name: Validate cli-suite
208-
# Have to disable *-suite validation, see above the comment for lib-suite
209200
run: sh validate.sh $FLAGS -s cli-suite
210201

211202
- name: Validate solver-benchmarks-tests
212-
run: |
213-
if [[ ${{ matrix.ghc }} == ${{ env.GHC_FOR_SOLVER_BENCHMARKS }} ]]; then
214-
sh validate.sh $FLAGS -s solver-benchmarks-tests
215-
fi
203+
if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS
204+
run: sh validate.sh $FLAGS -s solver-benchmarks-tests
216205

217206
- name: Validate solver-benchmarks-run
218-
run: |
219-
if [[ ${{ matrix.ghc }} == ${{ env.GHC_FOR_SOLVER_BENCHMARKS }} ]]; then
220-
sh validate.sh $FLAGS -s solver-benchmarks-run
221-
fi
207+
if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS
208+
run: sh validate.sh $FLAGS -s solver-benchmarks-run
209+
222210

223211
validate-old-ghcs:
224212
name: Validate old ghcs ${{ matrix.extra-ghc }}
225213
runs-on: ubuntu-latest
226214
needs: validate
227-
# This job needs an older ubuntu (16.04) cause
228-
# the required old ghcs using the `-dyn` flavour
229-
# are not installable from ppa/hvr in newer ones
230-
# see https://github.com/haskell/cabal/issues/8011
231-
container:
232-
image: phadej/ghc:8.8.4-xenial
233215

234216
strategy:
235217
matrix:
236-
# Newer ghc versions than 8.8.4 have to be installed with ghcup cause
237-
# they are not available in ppa/hvr. The ghcup installation
238-
# needs `sudo` which is not available in the xenial container
239-
ghc: ["8.8.4"]
240-
extra-ghc: ["8.4.4", "8.2.2", "8.0.2", "7.10.3", "7.8.4", "7.6.3", "7.4.2", "7.2.2", "7.0.4"]
218+
ghc: ['9.4.8']
219+
extra-ghc: ['8.4.4', '8.2.2', '8.0.2', '7.10.3']
241220

242221
steps:
243222

244-
# We can't use actions/checkout with the xenial docker container
245-
# cause it does not work with the git version included in it, see:
246-
# https://github.com/actions/checkout/issues/170
247-
# https://github.com/actions/checkout/issues/295
248-
# - uses: actions/checkout@v4
249-
- name: Checkout
250-
run: |
251-
echo $GITHUB_REF $GITHUB_SHA
252-
git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git .
253-
git fetch origin $GITHUB_SHA:temporary-ci-branch
254-
git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA)
255-
256-
- name: Install extra compiler
257-
run: |
258-
apt-get update
259-
apt-get install -y ghc-${{ matrix.extra-ghc }}-dyn
223+
- uses: actions/checkout@v4
260224

261-
- uses: haskell-actions/[email protected]
262-
# From 2.7 the setup action uses node20,
263-
# which is not supported by the phadej/ghc:8.8.4-xenial container.
225+
- uses: haskell-actions/setup@v2
264226
id: setup-haskell
265227
with:
266228
ghc-version: ${{ matrix.ghc }}
267-
# Make sure this bindist works in this old environment
268-
cabal-version: 3.10.1.0
229+
cabal-version: latest
230+
231+
- name: Install extra compiler
232+
run: ghcup install ghc ${{ matrix.extra-ghc }}
233+
234+
- name: GHC versions
235+
run: |
236+
ghc --version
237+
"ghc-${{ matrix.extra-ghc }}" --version
269238
270239
# As we are reusing the cached build dir from the previous step
271240
# the generated artifacts are available here,
272241
# including the cabal executable and the test suite
273-
- uses: actions/cache@v3
242+
- uses: actions/cache@v4
274243
with:
275244
path: |
276245
${{ steps.setup-haskell.outputs.cabal-store }}
@@ -283,13 +252,13 @@ jobs:
283252

284253
- name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}"
285254
env:
286-
EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}"
287-
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc ${{ env.EXTRA_GHC }}
255+
EXTRA_GHC: ghc-${{ matrix.extra-ghc }}
256+
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}"
288257

289258
build-alpine:
290259
name: Build statically linked using alpine
291-
runs-on: "ubuntu-latest"
292-
container: "alpine:3.19"
260+
runs-on: ubuntu-latest
261+
container: 'alpine:3.19'
293262
steps:
294263
- name: Install extra dependencies
295264
shell: sh
@@ -303,14 +272,20 @@ jobs:
303272

304273
# See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions
305274
- name: Manually supplied constraints/allow-newer
306-
if: ${{ github.event_name == 'workflow_dispatch' }}
275+
if: github.event_name == 'workflow_dispatch'
307276
run: |
308-
echo 'allow-newer:' ${ALLOWNEWER} >> cabal.project.validate
309-
echo 'constraints:' ${CONSTRAINTS} >> cabal.project.validate
277+
echo "allow-newer: ${ALLOWNEWER}" >> cabal.project.validate
278+
echo "constraints: ${CONSTRAINTS}" >> cabal.project.validate
279+
280+
- uses: haskell-actions/setup@v2
281+
id: setup-haskell
282+
with:
283+
ghc-version: ${{ env.GHC_FOR_RELEASE }}
284+
cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133
310285

311286
# See the following link for a breakdown of the following step
312287
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
313-
- uses: actions/cache@v3
288+
- uses: actions/cache@v4
314289
with:
315290
# validate.sh uses a special build dir
316291
path: |
@@ -319,12 +294,6 @@ jobs:
319294
key: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-${{ github.sha }}
320295
restore-keys: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-
321296

322-
- uses: haskell-actions/setup@v2
323-
id: setup-haskell
324-
with:
325-
ghc-version: ${{ env.GHC_FOR_RELEASE }}
326-
cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133
327-
328297
- name: Enable statically linked executables
329298
run: |
330299
echo 'executable-static: true' >> cabal.project.validate
@@ -337,9 +306,11 @@ jobs:
337306
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ env.GHC_FOR_RELEASE }} --project-file=cabal.project.validate cabal-install:exe:cabal)
338307
# We have to tar the executable to preserve executable permissions
339308
# see https://github.com/actions/upload-artifact/issues/38
340-
export CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-static-x86_64.tar.gz"
341-
tar -czvf $CABAL_EXEC_TAR -C $(dirname "$CABAL_EXEC") $(basename "$CABAL_EXEC")
342-
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> $GITHUB_ENV
309+
DIR=$(dirname "$CABAL_EXEC")
310+
FILE=$(basename "$CABAL_EXEC")
311+
CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-static-x86_64.tar.gz"
312+
tar -czvf "$CABAL_EXEC_TAR" -C "$DIR" "$FILE"
313+
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> "$GITHUB_ENV"
343314
344315
- name: Upload cabal-install executable to workflow artifacts
345316
uses: actions/upload-artifact@v3
@@ -357,31 +328,21 @@ jobs:
357328
needs: validate
358329
strategy:
359330
matrix:
360-
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
331+
os: [ubuntu-latest, macos-latest, windows-latest]
361332
# We only use one ghc version the used one for the next release (defined at top of the workflow)
362333
# We need to build an array dynamically to inject the appropiate env var in a previous job,
363334
# see https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson
364335
ghc: ${{ fromJSON (needs.validate.outputs.GHC_FOR_RELEASE) }}
365336

366337
steps:
367338
- name: Work around XDG directories existence (haskell-actions/setup#62)
368-
if: ${{ runner.os == 'macOS' }}
339+
if: runner.os == 'macOS'
369340
run: |
370341
rm -rf ~/.config/cabal
371342
rm -rf ~/.cache/cabal
372343
373344
- uses: actions/checkout@v4
374345

375-
# See https://github.com/haskell/cabal/pull/8739
376-
- name: Sudo chmod to permit ghcup to update its cache
377-
run: |
378-
if [[ "${{ runner.os }}" == "Linux" ]]; then
379-
sudo ls -lah /usr/local/.ghcup/cache
380-
sudo mkdir -p /usr/local/.ghcup/cache
381-
sudo ls -lah /usr/local/.ghcup/cache
382-
sudo chown -R $USER /usr/local/.ghcup
383-
sudo chmod -R 777 /usr/local/.ghcup
384-
fi
385346
- uses: haskell-actions/setup@v2
386347
id: setup-haskell
387348
with:
@@ -395,7 +356,7 @@ jobs:
395356
path: cabal-head
396357

397358
- name: Untar the cabal executable
398-
run: tar -xzf ./cabal-head/cabal-head-${{ runner.os }}-x86_64.tar.gz -C cabal-head
359+
run: tar -xzf "./cabal-head/cabal-head-${{ runner.os }}-x86_64.tar.gz" -C cabal-head
399360

400361
- name: print-config using cabal HEAD
401362
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s print-config
@@ -431,12 +392,12 @@ jobs:
431392
name: cabal-macOS-x86_64
432393

433394
- name: Create GitHub prerelease
434-
uses: "marvinpinto/[email protected]"
395+
uses: marvinpinto/[email protected]
435396
with:
436-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
437-
automatic_release_tag: "cabal-head"
397+
repo_token: ${{ secrets.GITHUB_TOKEN }}
398+
automatic_release_tag: cabal-head
438399
prerelease: true
439-
title: "cabal-head"
400+
title: cabal-head
440401
files: |
441402
cabal-head-Windows-x86_64.tar.gz
442403
cabal-head-Linux-x86_64.tar.gz

0 commit comments

Comments
 (0)