Skip to content

Commit 064e04b

Browse files
hsyl20claude
andcommitted
Add a Windows plinth-test CI job
Make plinth-build-windows produce and upload a bindist (BINDIST=1), and add a dependent plinth-test-windows job that runs the existing plinth-test.sh against it. plinth-test.sh already works on Windows unchanged: it detects MSYS/MINGW, appends .exe, and cygpath -w's the compiler path for cabal. Unlike Unix, the Windows GHC bindist is relocatable and has no configure/make install, so the test job extracts the archive and runs bin/uplc-ghc.exe in place rather than installing it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fe40eb9 commit 064e04b

1 file changed

Lines changed: 115 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 115 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,5 +357,118 @@ jobs:
357357
cabal-version: "latest"
358358
cabal-update: true
359359

360-
- name: Build uplc-ghc
361-
run: ./plinth-build.sh
360+
# BINDIST=1 produces the fixed-up uplc-ghc bindist (+ .tar.xz archive); the
361+
# plinth-test-windows job consumes that archive instead of rebuilding.
362+
- name: Build uplc-ghc bindist
363+
run: BINDIST=1 ./plinth-build.sh
364+
365+
- name: Upload uplc-ghc bindist
366+
uses: actions/upload-artifact@v4
367+
with:
368+
# key by GHC so this never collides with another job's artifact within a
369+
# run. See the matching download in the plinth-test-windows job.
370+
name: plinth-bindist-windows-${{ matrix.ghc }}
371+
path: _build/bindist/*.tar.xz
372+
retention-days: 1
373+
# the archive is already xz-compressed; don't re-zip it
374+
compression-level: 0
375+
376+
# plinth-test on Windows, mirroring plinth-test-linux: consume the bindist
377+
# produced by plinth-build-windows, install it (configure + make install under
378+
# MSYS2) and run the test suite. Depends on plinth-build-windows.
379+
plinth-test-windows:
380+
name: plinth-test / windows-latest / ghc ${{ matrix.ghc }}
381+
needs: plinth-build-windows
382+
runs-on: windows-latest
383+
strategy:
384+
fail-fast: false
385+
matrix:
386+
ghc: ['9.6.7']
387+
defaults:
388+
run:
389+
shell: msys2 {0}
390+
391+
steps:
392+
393+
# Git on Windows defaults to not creating symlinks; the submodules and the
394+
# bindist's wrappers/ dir rely on them, so enable symlink support first.
395+
- name: Configure git for Windows
396+
shell: bash
397+
run: git config --global core.symlinks true
398+
399+
- uses: actions/checkout@v4
400+
with:
401+
submodules: false
402+
403+
# The pre-MSYS2 step runs in the default Git-for-Windows bash because the
404+
# MSYS2 environment is not set up yet. plinth/test/cabal.project pulls
405+
# plutus-tx/plutus-core/plutus-ledger-api from the plutus submodule.
406+
- name: Init and update submodules
407+
shell: bash
408+
run: |
409+
git submodule sync
410+
# Shallow (single-commit) submodule clones: the build never needs
411+
# submodule history. --jobs fetches them in parallel.
412+
git submodule update --init --recursive --depth 1 --jobs 4
413+
414+
# MINGW64 toolchain incl. tar/xz to extract the bindist. path-type: inherit
415+
# keeps the Windows PATH (incl. the cabal installed below) visible.
416+
- name: Setup MSYS2
417+
uses: msys2/setup-msys2@v2
418+
with:
419+
msystem: MINGW64
420+
path-type: inherit
421+
update: false
422+
install: >-
423+
autoconf automake make tar xz patch curl
424+
mingw-w64-x86_64-python mingw-w64-x86_64-python-sphinx
425+
426+
# plinth-test.sh invokes cabal, so cabal must be on PATH. (The boot GHC this
427+
# also installs is unused by the test.)
428+
- uses: haskell-actions/setup@v2
429+
id: setup
430+
name: Setup Haskell tools
431+
with:
432+
ghc-version: ${{ matrix.ghc }}
433+
cabal-version: "latest"
434+
cabal-update: true
435+
436+
- name: Download uplc-ghc bindist
437+
uses: actions/download-artifact@v4
438+
with:
439+
# matches the plinth-build-windows upload name.
440+
name: plinth-bindist-windows-${{ matrix.ghc }}
441+
path: _build/artifact
442+
443+
# Unlike Unix, the Windows GHC bindist has no configure/make install: it is
444+
# relocatable, so we just extract it and run bin/uplc-ghc.exe in place.
445+
- name: Extract uplc-ghc bindist
446+
run: |
447+
shopt -s nullglob
448+
archives=(_build/artifact/*.tar.xz)
449+
if [ ${#archives[@]} -ne 1 ]; then
450+
echo "error: expected exactly one bindist archive, found: ${archives[*]:-none}"
451+
exit 1
452+
fi
453+
mkdir -p _build/install
454+
echo "extracting ${archives[0]}"
455+
tar --xz -xf "${archives[0]}" -C _build/install
456+
bindirs=(_build/install/ghc-*)
457+
if [ ${#bindirs[@]} -ne 1 ]; then
458+
echo "error: expected one extracted bindist dir, found: ${bindirs[*]:-none}"
459+
exit 1
460+
fi
461+
uplc="${bindirs[0]}/bin/uplc-ghc.exe"
462+
if [ ! -x "$uplc" ]; then
463+
echo "error: $uplc missing or not executable in extracted bindist"
464+
ls -l "${bindirs[0]}/bin" || true
465+
exit 1
466+
fi
467+
rm -rf _build/artifact
468+
469+
# Build packages serially (JOBS=1): compiling with the Plinth plugin
470+
# (Core -> PLC) is memory-heavy. plinth-test.sh cygpath -w's the GHC path.
471+
- name: Test uplc-ghc
472+
run: |
473+
bindirs=(_build/install/ghc-*)
474+
JOBS=1 GHC="${bindirs[0]}/bin/uplc-ghc.exe" ./plinth-test.sh

0 commit comments

Comments
 (0)