-
Notifications
You must be signed in to change notification settings - Fork 0
856 lines (771 loc) · 28.2 KB
/
Copy pathci.yml
File metadata and controls
856 lines (771 loc) · 28.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches: [master, ghc-9.6-plinth]
tags: ['v*']
workflow_dispatch:
inputs:
release:
description: 'Build release bindists (with docs)'
type: boolean
default: false
jobs:
build:
name: Build / ${{ matrix.name }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- name: x86_64-linux-glibc
os: ubuntu-latest
docker: rockylinux:8
shell: bash
- name: x86_64-linux-musl
os: ubuntu-latest
docker: alpine:3.20
shell: bash
- name: aarch64-linux-glibc
os: ubuntu-22.04-arm
container: debian:11
shell: bash
- name: aarch64-linux-musl
os: ubuntu-22.04-arm
docker: alpine:3.20
shell: bash
- name: aarch64-darwin
os: macos-15
shell: bash
# - name: x86_64-darwin
# os: macos-15-large
# shell: bash
- name: x86_64-windows
os: windows-latest
shell: msys2 {0}
env:
RELEASE: '1'
LANG: C.UTF-8
LC_ALL: C.UTF-8
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Free disk space
if: runner.os == 'Linux' && !matrix.container
run: |
echo "=== Before cleanup ==="
df -h /
sudo rm -rf \
/usr/local/lib/android \
/usr/share/dotnet \
/usr/share/swift \
/usr/local/.ghcup \
/usr/local/share/boost \
/usr/local/share/powershell \
/usr/local/share/chromium \
/usr/local/lib/node_modules \
/opt/hostedtoolcache \
/opt/az \
/opt/microsoft \
/opt/pipx \
/imagegeneration
sudo docker image prune -af 2>/dev/null || true
echo "=== After cleanup ==="
df -h /
- name: Install system dependencies (Debian)
if: matrix.container == 'debian:11'
run: |
apt-get update
apt-get install -y \
gcc g++ make autoconf automake \
python3 python3-sphinx tar xz-utils curl git perl \
libgmp-dev libncurses-dev zlib1g-dev libffi-dev \
openssh-client patchelf
- name: Configure git for Windows
if: runner.os == 'Windows'
shell: bash
run: git config --global core.symlinks true
- uses: actions/checkout@v4
with:
submodules: false
- name: Mark workspace as safe for git
if: matrix.container
shell: bash
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Setup SSH for submodules
shell: bash
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SUBMODULE_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Restore submodule mirror cache
uses: actions/cache@v4
with:
path: submodule-cache
key: submodule-mirrors-${{ runner.os }}-${{ runner.arch }}
- name: Init and update submodules
shell: bash
env:
GIT_SSH_COMMAND: "ssh -i $HOME/.ssh/id_rsa -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes"
SUBMODULE_CACHE: submodule-cache
run: ./submodule-cache.sh update --init
- name: Setup MSYS2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
update: false
install: >-
autoconf automake make tar xz patch curl
mingw-w64-x86_64-python mingw-w64-x86_64-python-sphinx
- name: Install autotools (macOS)
if: runner.os == 'macOS'
run: |
brew install autoconf automake
python3 -m venv "$RUNNER_TEMP/sphinx-venv"
"$RUNNER_TEMP/sphinx-venv/bin/pip" install 'sphinx<8'
echo "$RUNNER_TEMP/sphinx-venv/bin" >> "$GITHUB_PATH"
- uses: haskell-actions/setup@v2
if: ${{ !matrix.docker }}
name: Setup Haskell tools
with:
ghc-version: '9.6.7'
cabal-version: 'latest'
cabal-update: true
- name: Build bindist
if: ${{ !matrix.docker }}
env:
CLEAN_AFTER_BUILD: '1'
run: ./plinth-build.sh
# For docker: entries, run the entire build inside Docker.
# The workspace is mounted from the host so checkout/submodules
# done above are available. Using docker: instead of container:
# allows the free-disk-space step to run on the host first.
- name: Build bindist (Docker)
if: ${{ matrix.docker }}
run: |
docker run --rm \
-v "$GITHUB_WORKSPACE:/workspace" \
-w /workspace \
-e RELEASE="${{ env.RELEASE }}" \
-e CLEAN_AFTER_BUILD=1 \
-e LANG=C.UTF-8 \
-e LC_ALL=C.UTF-8 \
${{ matrix.docker }} sh -c '
set -eux
# Install system dependencies (auto-detect distro)
if command -v apk >/dev/null 2>&1; then
apk update
apk add \
alpine-sdk autoconf automake bash build-base coreutils \
curl gcc g++ git gmp gmp-dev grep linux-headers gzip \
ncurses-dev ncurses-libs ncurses-static \
perl python3 py3-sphinx sudo wget xz zlib-dev zlib-static \
patchelf findutils llvm17 clang17
elif command -v dnf >/dev/null 2>&1; then
dnf install -y "dnf-command(config-manager)" || true
dnf config-manager --set-enabled powertools 2>/dev/null || true
dnf install -y epel-release 2>/dev/null || true
dnf install -y --allowerasing \
gcc gcc-c++ make autoconf automake \
python3 python3-pip tar xz curl git perl which findutils diffutils \
gmp-devel ncurses-devel zlib-devel libffi-devel \
patchelf
pip3 install "sphinx<8"
fi
# Install GHCup + GHC + cabal
curl --proto "=https" --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
BOOTSTRAP_HASKELL_GHC_VERSION=9.6.7 \
BOOTSTRAP_HASKELL_CABAL_VERSION=latest \
sh
. "$HOME/.ghcup/env"
git config --global --add safe.directory /workspace
./plinth-build.sh
'
- name: Upload bindist
uses: ./.github/actions/upload
with:
name: bindist-${{ matrix.name }}
path: _build/bindist/*.tar.xz
- name: Upload metadata
uses: ./.github/actions/upload
with:
name: metadata-${{ matrix.name }}
path: _build/bindist/*-ghcup-metadata.yaml
# Dev builds with assertions (RELEASE=0) for platforms that run full_test
build-dev:
name: Build Dev / ${{ matrix.name }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- name: x86_64-linux-glibc
os: ubuntu-latest
docker: rockylinux:8
shell: bash
- name: aarch64-linux-glibc
os: ubuntu-22.04-arm
container: debian:11
shell: bash
env:
RELEASE: '0'
LANG: C.UTF-8
LC_ALL: C.UTF-8
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Free disk space
if: runner.os == 'Linux' && !matrix.container
run: |
echo "=== Before cleanup ==="
df -h /
sudo rm -rf \
/usr/local/lib/android \
/usr/share/dotnet \
/usr/share/swift \
/usr/local/.ghcup \
/usr/local/share/boost \
/usr/local/share/powershell \
/usr/local/share/chromium \
/usr/local/lib/node_modules \
/opt/hostedtoolcache \
/opt/az \
/opt/microsoft \
/opt/pipx \
/imagegeneration
sudo docker image prune -af 2>/dev/null || true
echo "=== After cleanup ==="
df -h /
- name: Install system dependencies (Debian)
if: matrix.container == 'debian:11'
run: |
apt-get update
apt-get install -y \
gcc g++ make autoconf automake \
python3 tar xz-utils curl git perl \
libgmp-dev libncurses-dev zlib1g-dev libffi-dev \
openssh-client patchelf
- uses: actions/checkout@v4
with:
submodules: false
- name: Mark workspace as safe for git
if: matrix.container
shell: bash
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Setup SSH for submodules
shell: bash
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SUBMODULE_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Restore submodule mirror cache
uses: actions/cache@v4
with:
path: submodule-cache
key: submodule-mirrors-${{ runner.os }}-${{ runner.arch }}
- name: Init and update submodules
shell: bash
env:
GIT_SSH_COMMAND: "ssh -i $HOME/.ssh/id_rsa -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes"
SUBMODULE_CACHE: submodule-cache
run: ./submodule-cache.sh update --init
- uses: haskell-actions/setup@v2
if: ${{ !matrix.docker }}
name: Setup Haskell tools
with:
ghc-version: '9.6.7'
cabal-version: 'latest'
cabal-update: true
- name: Build bindist
if: ${{ !matrix.docker }}
env:
CLEAN_AFTER_BUILD: '1'
run: ./plinth-build.sh
- name: Build bindist (Docker)
if: ${{ matrix.docker }}
run: |
docker run --rm \
-v "$GITHUB_WORKSPACE:/workspace" \
-w /workspace \
-e RELEASE="${{ env.RELEASE }}" \
-e CLEAN_AFTER_BUILD=1 \
-e LANG=C.UTF-8 \
-e LC_ALL=C.UTF-8 \
${{ matrix.docker }} sh -c '
set -eux
# Install system dependencies (auto-detect distro)
if command -v apk >/dev/null 2>&1; then
apk update
apk add \
alpine-sdk autoconf automake bash build-base coreutils \
curl gcc g++ git gmp gmp-dev grep linux-headers gzip \
ncurses-dev ncurses-libs ncurses-static \
perl python3 sudo wget xz zlib-dev zlib-static \
patchelf findutils llvm17 clang17
elif command -v dnf >/dev/null 2>&1; then
dnf install -y "dnf-command(config-manager)" || true
dnf config-manager --set-enabled powertools 2>/dev/null || true
dnf install -y epel-release 2>/dev/null || true
dnf install -y --allowerasing \
gcc gcc-c++ make autoconf automake \
python3 tar xz curl git perl which findutils diffutils \
gmp-devel ncurses-devel zlib-devel libffi-devel \
patchelf
fi
# Install GHCup + GHC + cabal
curl --proto "=https" --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
BOOTSTRAP_HASKELL_GHC_VERSION=9.6.7 \
BOOTSTRAP_HASKELL_CABAL_VERSION=latest \
sh
. "$HOME/.ghcup/env"
git config --global --add safe.directory /workspace
./plinth-build.sh
'
- name: Upload bindist
uses: ./.github/actions/upload
with:
name: bindist-dev-${{ matrix.name }}
path: _build/bindist/*.tar.xz
test:
name: Test / ${{ matrix.name }}
needs: [build, build-dev]
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
# Test x86_64-linux-glibc bindist across distros
- name: x86_64-linux / rocky-8
os: ubuntu-latest
docker: rockylinux:8
shell: bash
bindist: x86_64-linux-glibc
full_test: true
- name: x86_64-linux / rocky-9
os: ubuntu-latest
docker: rockylinux:9
shell: bash
bindist: x86_64-linux-glibc
- name: x86_64-linux / debian-11
os: ubuntu-latest
container: debian:11
shell: bash
bindist: x86_64-linux-glibc
pkg: apt
- name: x86_64-linux / debian-12
os: ubuntu-latest
container: debian:12
shell: bash
bindist: x86_64-linux-glibc
pkg: apt
- name: x86_64-linux / ubuntu-22.04
os: ubuntu-latest
container: ubuntu:22.04
shell: bash
bindist: x86_64-linux-glibc
pkg: apt
- name: x86_64-linux / ubuntu-24.04
os: ubuntu-latest
container: ubuntu:24.04
shell: bash
bindist: x86_64-linux-glibc
pkg: apt
- name: x86_64-linux / fedora-42
os: ubuntu-latest
container: fedora:42
shell: bash
bindist: x86_64-linux-glibc
pkg: dnf
# Test x86_64-linux-musl bindist
- name: x86_64-linux / alpine-3.20
os: ubuntu-latest
container: alpine:3.20
shell: sh
bindist: x86_64-linux-musl
pkg: apk
# Test aarch64-linux-glibc bindist
- name: aarch64-linux / debian-11
os: ubuntu-22.04-arm
container: debian:11
shell: bash
bindist: aarch64-linux-glibc
pkg: apt
full_test: true
- name: aarch64-linux / debian-12
os: ubuntu-22.04-arm
container: debian:12
shell: bash
bindist: aarch64-linux-glibc
pkg: apt
- name: aarch64-linux / ubuntu-24.04
os: ubuntu-22.04-arm
container: ubuntu:24.04
shell: bash
bindist: aarch64-linux-glibc
pkg: apt
# Test aarch64-linux-musl bindist (Docker, not container:)
- name: aarch64-linux / alpine-3.20
os: ubuntu-22.04-arm
docker: alpine:3.20
shell: bash
bindist: aarch64-linux-musl
- name: aarch64-darwin
os: macos-15
shell: bash
bindist: aarch64-darwin
# - name: x86_64-darwin
# os: macos-15-large
# shell: bash
# bindist: x86_64-darwin
- name: x86_64-windows
os: windows-latest
shell: msys2 {0}
bindist: x86_64-windows
env:
# Only run the full plinth test suite on selected entries
RUN_PLINTH_TEST: ${{ matrix.full_test && '1' || '0' }}
RUN_PLUGIN_TEST: ${{ matrix.full_test && '1' || '0' }}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Free disk space
if: runner.os == 'Linux' && !matrix.container
run: |
echo "=== Before cleanup ==="
df -h /
sudo rm -rf \
/usr/local/lib/android \
/usr/share/dotnet \
/usr/share/swift \
/usr/local/.ghcup \
/usr/local/share/boost \
/usr/local/share/powershell \
/usr/local/share/chromium \
/usr/local/lib/node_modules \
/opt/hostedtoolcache \
/opt/az \
/opt/microsoft \
/opt/pipx \
/imagegeneration
sudo docker image prune -af 2>/dev/null || true
echo "=== After cleanup ==="
df -h /
- name: Install test dependencies (apt)
if: matrix.pkg == 'apt'
run: |
apt-get update
apt-get install -y \
gcc g++ make autoconf automake curl git \
libgmp-dev libncurses-dev zlib1g-dev libffi-dev \
openssh-client file binutils patchelf xz-utils
rm -rf /var/lib/apt/lists/*
- name: Install test dependencies (dnf)
if: matrix.pkg == 'dnf'
run: |
dnf install -y epel-release || true
dnf install -y --allowerasing \
gcc gcc-c++ make autoconf automake curl git \
gmp-devel ncurses-devel zlib-devel libffi-devel \
openssh-clients file binutils findutils patchelf xz
dnf clean all
- name: Install test dependencies (yum)
if: matrix.pkg == 'yum'
run: |
dnf install -y epel-release
yum install -y \
gcc gcc-c++ make autoconf automake curl git \
gmp-devel ncurses-devel zlib-devel libffi-devel \
openssh-clients file binutils findutils patchelf xz
yum clean all
- name: Install test dependencies (apk)
if: matrix.pkg == 'apk'
run: |
apk update
apk add \
gcc g++ musl-dev make autoconf automake curl git \
gmp-dev ncurses-dev zlib-dev libffi-dev \
file binutils findutils patchelf bash coreutils \
openssh-client xz
rm -rf /var/cache/apk/*
- uses: actions/checkout@v4
with:
submodules: false
- name: Mark workspace as safe for git
if: matrix.container
shell: bash
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory '*'
# Submodules are only needed for the plinth test suite (full_test)
- name: Setup SSH for submodules
if: matrix.full_test
shell: bash
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SUBMODULE_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Restore submodule mirror cache
if: matrix.full_test
uses: actions/cache@v4
with:
path: submodule-cache
key: submodule-mirrors-${{ runner.os }}-${{ runner.arch }}
- name: Init and update submodules
if: matrix.full_test
shell: bash
env:
GIT_SSH_COMMAND: "ssh -i $HOME/.ssh/id_rsa -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes"
SUBMODULE_CACHE: submodule-cache
run: ./submodule-cache.sh update --init
- name: Setup MSYS2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: inherit
update: false
install: tar xz
# Haskell tools needed for the full plinth test suite (cabal build/run)
# Docker entries install GHC+cabal via ghcup inside the container instead.
- uses: haskell-actions/setup@v2
if: matrix.full_test && !matrix.docker
name: Setup Haskell tools
with:
ghc-version: '9.6.7'
cabal-version: 'latest'
cabal-update: true
- name: Download bindist
uses: ./.github/actions/download
with:
name: ${{ matrix.full_test && format('bindist-dev-{0}', matrix.bindist) || format('bindist-{0}', matrix.bindist) }}
path: _build/bindist/
- name: Verify bindist
if: runner.os != 'Windows' && !matrix.docker
env:
LANG: C.UTF-8
LC_ALL: C.UTF-8
run: ./verify-bindist-relocatable.sh
# For Docker-based test entries without full_test, run basic
# verification inside Docker with the workspace mounted from the host.
- name: Verify bindist (Docker)
if: ${{ matrix.docker && !matrix.full_test }}
run: |
docker run --rm \
-v "$GITHUB_WORKSPACE:/workspace" \
-w /workspace \
-e RUN_PLINTH_TEST=0 \
-e LANG=C.UTF-8 \
-e LC_ALL=C.UTF-8 \
${{ matrix.docker }} sh -c '
set -eux
# Install test dependencies (auto-detect distro)
if command -v apk >/dev/null 2>&1; then
apk update
apk add \
gcc g++ musl-dev make autoconf automake curl git \
gmp-dev ncurses-dev zlib-dev libffi-dev \
file binutils findutils patchelf bash coreutils xz
elif command -v dnf >/dev/null 2>&1; then
dnf install -y epel-release || true
dnf install -y --allowerasing \
gcc gcc-c++ make autoconf automake curl git \
gmp-devel ncurses-devel zlib-devel libffi-devel \
file binutils findutils patchelf xz
dnf clean all
fi
git config --global --add safe.directory /workspace
./verify-bindist-relocatable.sh
'
# For Docker-based full_test entries, install GHC+cabal via ghcup
# inside the container so the plinth test suite can run.
# Using docker: instead of container: lets the free-disk-space step
# run on the host first.
- name: Verify bindist (Docker full_test)
if: ${{ matrix.docker && matrix.full_test }}
run: |
docker run --rm \
-v "$GITHUB_WORKSPACE:/workspace" \
-w /workspace \
-e RUN_PLINTH_TEST=1 \
-e RUN_PLUGIN_TEST=1 \
-e LANG=C.UTF-8 \
-e LC_ALL=C.UTF-8 \
${{ matrix.docker }} bash -c '
set -eux
dnf install -y epel-release || true
dnf install -y --allowerasing \
gcc gcc-c++ make autoconf automake curl git \
gmp-devel ncurses-devel zlib-devel libffi-devel \
openssh-clients file binutils findutils patchelf xz
dnf clean all
# Install GHCup + GHC + cabal
curl --proto "=https" --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
BOOTSTRAP_HASKELL_GHC_VERSION=9.6.7 \
BOOTSTRAP_HASKELL_CABAL_VERSION=latest \
sh
. "$HOME/.ghcup/env"
git config --global --add safe.directory /workspace
./verify-bindist-relocatable.sh
'
# On Windows the bindist has no configure script; verify by
# extracting and running the relocatable binaries directly.
- name: Verify bindist (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
tarball=(_build/bindist/*.tar.xz)
dir=$(basename "$tarball" .tar.xz)
mkdir -p _test/bindist
tar -xf "$tarball" -C _test/bindist
echo "=== uplc-ghc --version ==="
_test/bindist/"$dir"/bin/uplc-ghc.exe --version
echo "=== uplc-ghc -e ==="
_test/bindist/"$dir"/bin/uplc-ghc.exe -e 'putStrLn "hello"'
echo "=== ghc-pkg check ==="
_test/bindist/"$dir"/bin/ghc-pkg.exe check --no-user-package-db
release:
name: Release
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all bindist artifacts
uses: actions/download-artifact@v4
with:
pattern: bindist-*
path: artifacts/bindists/
- name: Download all metadata artifacts
uses: actions/download-artifact@v4
with:
pattern: metadata-*
path: artifacts/metadata/
- name: Collect release assets
run: |
mkdir -p release/
for dir in artifacts/bindists/*/; do
for tarball in "$dir"*.tar.xz; do
[ -f "$tarball" ] || continue
cp "$tarball" release/
done
done
echo "Release assets:"
ls -lh release/
- name: Merge ghcup metadata
run: |
pip install pyyaml
python3 << 'PYEOF'
import yaml, glob, os, copy
tag = os.environ['GITHUB_REF_NAME']
repo = os.environ['GITHUB_REPOSITORY']
base_url = f"https://github.com/{repo}/releases/download/{tag}"
# Collect all release tarball filenames for URL rewriting
release_files = set(os.listdir('release'))
merged = {'toolRequirements': {}, 'ghcupDownloads': {'plinth': {}}}
for f in sorted(glob.glob('artifacts/metadata/*/*.yaml')):
with open(f) as fh:
data = yaml.safe_load(fh)
for version, vinfo in data['ghcupDownloads']['plinth'].items():
if version not in merged['ghcupDownloads']['plinth']:
merged['ghcupDownloads']['plinth'][version] = {
'viTags': vinfo.get('viTags', []),
'viArch': {}
}
dest_arch = merged['ghcupDownloads']['plinth'][version]['viArch']
for arch, platforms in vinfo['viArch'].items():
if arch not in dest_arch:
dest_arch[arch] = {}
for platform, versioning in platforms.items():
entry = copy.deepcopy(versioning)
# Rewrite dlUri from file:// to release asset URL
for vkey in entry:
vdata = entry[vkey]
if isinstance(vdata, dict) and 'dlUri' in vdata:
old_uri = vdata['dlUri']
filename = os.path.basename(old_uri)
if filename in release_files:
vdata['dlUri'] = f"{base_url}/{filename}"
else:
print(f"WARNING: {filename} not in release assets")
vdata['dlUri'] = f"{base_url}/{filename}"
dest_arch[arch][platform] = entry
os.makedirs('release', exist_ok=True)
with open('release/ghcup-metadata.yaml', 'w') as fh:
yaml.dump(merged, fh, default_flow_style=False, sort_keys=False)
print("Merged metadata written to release/ghcup-metadata.yaml")
with open('release/ghcup-metadata.yaml') as fh:
print(fh.read())
PYEOF
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "Plinth $GITHUB_REF_NAME" \
--generate-notes \
release/*
- name: Deploy metadata to GitHub Pages
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Fetch existing gh-pages metadata if it exists
EXISTING=""
if git fetch origin gh-pages 2>/dev/null; then
git show origin/gh-pages:ghcup-metadata.yaml > existing-metadata.yaml 2>/dev/null && EXISTING="existing-metadata.yaml" || true
fi
# Merge new version into existing metadata (cumulative channel)
python3 << PYEOF
import yaml, os
existing_file = "$EXISTING"
new_file = "release/ghcup-metadata.yaml"
if existing_file and os.path.exists(existing_file):
with open(existing_file) as fh:
existing = yaml.safe_load(fh) or {}
else:
existing = {}
with open(new_file) as fh:
new = yaml.safe_load(fh)
# Deep-merge: add new version entries into existing metadata
if 'ghcupDownloads' not in existing:
existing['ghcupDownloads'] = {}
if 'plinth' not in existing['ghcupDownloads']:
existing['ghcupDownloads']['plinth'] = {}
existing.setdefault('toolRequirements', {})
for version, vinfo in new['ghcupDownloads']['plinth'].items():
if version not in existing['ghcupDownloads']['plinth']:
existing['ghcupDownloads']['plinth'][version] = vinfo
else:
dest = existing['ghcupDownloads']['plinth'][version]
if 'viArch' not in dest:
dest['viArch'] = {}
for arch, platforms in vinfo.get('viArch', {}).items():
if arch not in dest['viArch']:
dest['viArch'][arch] = {}
dest['viArch'][arch].update(platforms)
with open('pages-metadata.yaml', 'w') as fh:
yaml.dump(existing, fh, default_flow_style=False, sort_keys=False)
PYEOF
# Commit to gh-pages branch
git checkout --orphan gh-pages-deploy
git rm -rf .
cp pages-metadata.yaml ghcup-metadata.yaml
git add ghcup-metadata.yaml
git commit -m "Update ghcup metadata for $GITHUB_REF_NAME"
git push -f origin HEAD:gh-pages