Skip to content

Commit ec2542f

Browse files
authored
sync validate.yml with master (haskell#10459)
* sync `validate.yml` with `master` Too many backorts in the wrong order = mayhem Giving up on Apple AArch64, `cabal-tests` hates it * fixup! Merge branch '3.14' into sync-validate.yml-3.14
1 parent 99386c1 commit ec2542f

File tree

1 file changed

+97
-49
lines changed

1 file changed

+97
-49
lines changed

.github/workflows/validate.yml

Lines changed: 97 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@ on:
1414
- "doc/**"
1515
- "**/README.md"
1616
- "CONTRIBUTING.md"
17+
- "changelog.d/**"
18+
# only top level for these, because various test packages have them too
19+
- "*/ChangeLog.md"
20+
- "*/changelog.md"
21+
- "release-notes/**"
1722
branches:
1823
- master
1924
pull_request:
2025
paths-ignore:
2126
- "doc/**"
2227
- "**/README.md"
2328
- "CONTRIBUTING.md"
29+
- "changelog.d/**"
30+
- "*/ChangeLog.md"
31+
- "*/changelog.md"
32+
- "release-notes/**"
2433
release:
2534
types:
2635
- created
@@ -71,7 +80,7 @@ jobs:
7180
[
7281
"9.10.1",
7382
"9.8.2",
74-
"9.6.4",
83+
"9.6.6",
7584
"9.4.8",
7685
"9.2.8",
7786
"9.0.2",
@@ -175,6 +184,16 @@ jobs:
175184
- name: Validate build
176185
run: sh validate.sh $FLAGS -s build
177186

187+
- name: Canonicalize architecture
188+
run: |
189+
case ${{ runner.arch }} in
190+
X86) arch=i386 ;;
191+
X64) arch=x86_64 ;;
192+
ARM64) arch=aarch64 ;;
193+
*) echo "Unsupported architecture, please fix validate.yaml" 2>/dev/null; exit 1 ;;
194+
esac
195+
echo "CABAL_ARCH=$arch" >> "$GITHUB_ENV"
196+
178197
- name: Tar cabal head executable
179198
if: matrix.ghc == env.GHC_FOR_RELEASE
180199
run: |
@@ -193,7 +212,7 @@ jobs:
193212
fi
194213
DIR=$(dirname "$CABAL_EXEC")
195214
FILE=$(basename "$CABAL_EXEC")
196-
CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar.gz"
215+
CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-$CABAL_ARCH.tar.gz"
197216
tar -czvf "$CABAL_EXEC_TAR" -C "$DIR" "$FILE"
198217
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> "$GITHUB_ENV"
199218
@@ -204,32 +223,27 @@ jobs:
204223
if: matrix.ghc == env.GHC_FOR_RELEASE
205224
uses: actions/upload-artifact@v4
206225
with:
207-
name: cabal-${{ runner.os }}-x86_64
226+
name: cabal-${{ runner.os }}-${{ env.CABAL_ARCH }}
208227
path: ${{ env.CABAL_EXEC_TAR }}
209228

210-
- name: Validate lib-tests
229+
- name: Validate tests
211230
env:
212231
# `rawSystemStdInOut reports text decoding errors`
213232
# test does not find ghc without the full path in windows
214233
GHCPATH: ${{ steps.setup-haskell.outputs.ghc-exe }}
215-
run: sh validate.sh $FLAGS -s lib-tests
216-
217-
- name: Validate lib-suite
218-
run: sh validate.sh $FLAGS -s lib-suite
219-
220-
- name: Validate cli-tests
221-
run: sh validate.sh $FLAGS -s cli-tests
222-
223-
- name: Validate cli-suite
224-
run: sh validate.sh $FLAGS -s cli-suite
225-
226-
- name: Validate solver-benchmarks-tests
227-
if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS
228-
run: sh validate.sh $FLAGS -s solver-benchmarks-tests
229-
230-
- name: Validate solver-benchmarks-run
231-
if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS
232-
run: sh validate.sh $FLAGS -s solver-benchmarks-run
234+
run: |
235+
set +e
236+
rc=0
237+
tests="lib-tests lib-suite cli-tests cli-suite"
238+
if [ "${{ matrix.ghc }}" = "${{ env.GHC_FOR_SOLVER_BENCHMARKS }}" ]; then
239+
tests="$tests solver-benchmarks-tests solver-benchmarks-run"
240+
fi
241+
for test in $tests; do
242+
echo Validate "$test"
243+
sh validate.sh $FLAGS -s "$test" || rc=1
244+
echo End "$test"
245+
done
246+
exit $rc
233247
234248
validate-old-ghcs:
235249
name: Validate old ghcs ${{ matrix.extra-ghc }}
@@ -283,11 +297,13 @@ jobs:
283297
restore-keys: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}-
284298

285299
- name: Validate build
300+
id: build
286301
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build
287302

288303
- name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}"
289304
env:
290305
EXTRA_GHC: ghc-${{ matrix.extra-ghc }}
306+
continue-on-error: true
291307
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}"
292308

293309
build-alpine:
@@ -357,19 +373,36 @@ jobs:
357373
# This one uses the cabal HEAD generated executable in the previous step
358374
# to build itself again, as sanity check
359375
dogfooding:
360-
name: Dogfooding ${{ matrix.os }} ghc-${{ matrix.ghc }}
361-
runs-on: ${{ matrix.os }}
376+
name: Dogfooding ${{ matrix.sys.os }} ghc-${{ matrix.ghc }}
377+
runs-on: ${{ matrix.sys.os }}
362378
needs: validate
363379
strategy:
364380
matrix:
365-
os: [ubuntu-22.04, macos-13, windows-latest]
381+
sys:
382+
- { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
383+
- { os: ubuntu-22.04, shell: bash }
384+
- { os: macos-13, shell: bash }
366385
# We only use one ghc version the used one for the next release (defined at top of the workflow)
367386
# We need to build an array dynamically to inject the appropiate env var in a previous job,
368387
# see https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson
369388
ghc: ${{ fromJSON (needs.validate.outputs.GHC_FOR_RELEASE) }}
389+
defaults:
390+
run:
391+
shell: ${{ matrix.sys.shell }}
370392

371393
steps:
372-
- name: Work around XDG directories existence (haskell-actions/setup#62)
394+
# TODO: make a reusable action for this
395+
- name: Canonicalize architecture
396+
run: |
397+
case ${{ runner.arch }} in
398+
X86) arch=i386 ;;
399+
X64) arch=x86_64 ;;
400+
ARM64) arch=aarch64 ;;
401+
*) echo "Unsupported architecture" 2>/dev/null; exit 1 ;;
402+
esac
403+
echo "CABAL_ARCH=$arch" >> "$GITHUB_ENV"
404+
405+
- name: "MAC: Work around XDG directories existence (haskell-actions/setup#62)"
373406
if: runner.os == 'macOS'
374407
run: |
375408
rm -rf ~/.config/cabal
@@ -386,11 +419,11 @@ jobs:
386419
- name: Download cabal executable from workflow artifacts
387420
uses: actions/download-artifact@v4
388421
with:
389-
name: cabal-${{ runner.os }}-x86_64
422+
name: cabal-${{ runner.os }}-${{ env.CABAL_ARCH }}
390423
path: cabal-head
391424

392425
- name: Untar the cabal executable
393-
run: tar -xzf "./cabal-head/cabal-head-${{ runner.os }}-x86_64.tar.gz" -C cabal-head
426+
run: tar -xzf "./cabal-head/cabal-head-${{ runner.os }}-$CABAL_ARCH.tar.gz" -C cabal-head
394427

395428
- name: print-config using cabal HEAD
396429
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s print-config
@@ -404,39 +437,54 @@ jobs:
404437
name: Create a GitHub prerelease with the binary artifacts
405438
runs-on: ubuntu-latest
406439
if: github.ref == 'refs/heads/master'
440+
permissions:
441+
contents: write
407442

408443
# IMPORTANT! Any job added to the workflow should be added here too
409444
needs: [validate, validate-old-ghcs, build-alpine, dogfooding]
410445

411446
steps:
447+
# for now this is hardcoded. is there a better way?
412448
- uses: actions/download-artifact@v4
413449
with:
414-
name: cabal-Windows-x86_64
450+
pattern: cabal-*
451+
path: binaries
415452

416-
- uses: actions/download-artifact@v4
453+
- name: Create GitHub prerelease
454+
uses: softprops/action-gh-release@v2
417455
with:
418-
name: cabal-Linux-x86_64
456+
tag_name: cabal-head
457+
prerelease: true
458+
files: binaries/cabal-*
419459

420-
- uses: actions/download-artifact@v4
421-
with:
422-
name: cabal-Linux-static-x86_64
460+
prerelease-lts:
461+
name: Create a GitHub LTS prerelease with the binary artifacts
462+
runs-on: ubuntu-latest
463+
# The LTS branch is hardcoded for now, update it on a new LTS!
464+
if: github.ref == 'refs/heads/3.12'
423465

424-
- uses: actions/download-artifact@v4
425-
with:
426-
name: cabal-macOS-x86_64
466+
# IMPORTANT! Any job added to the workflow should be added here too
467+
needs: [validate, validate-old-ghcs, build-alpine, dogfooding]
427468

428-
- name: Create GitHub prerelease
429-
uses: marvinpinto/[email protected]
430-
with:
431-
repo_token: ${{ secrets.GITHUB_TOKEN }}
432-
automatic_release_tag: cabal-head
433-
prerelease: true
434-
title: cabal-head
435-
files: |
436-
cabal-head-Windows-x86_64.tar.gz
437-
cabal-head-Linux-x86_64.tar.gz
438-
cabal-head-Linux-static-x86_64.tar.gz
439-
cabal-head-macOS-x86_64.tar.gz
469+
steps:
470+
- uses: actions/download-artifact@v4
471+
with:
472+
pattern: cabal-*
473+
path: binaries
474+
475+
- run: |
476+
# bash-ism, but we forced bash above
477+
mv cabal-{,lts-}head-Windows-x86_64.tar.gz
478+
mv cabal-{,lts-}head-Linux-x86_64.tar.gz
479+
mv cabal-{,lts-}head-Linux-static-x86_64.tar.gz
480+
mv cabal-{,lts-}head-macOS-x86_64.tar.gz
481+
482+
- name: Create GitHub prerelease
483+
uses: softprops/action-gh-release@v2
484+
with:
485+
tag_name: cabal-lts-head
486+
prerelease: true
487+
files: binaries/cabal-*
440488

441489
# We use this job as a summary of the workflow
442490
# It will fail if any of the previous jobs does

0 commit comments

Comments
 (0)