-
Notifications
You must be signed in to change notification settings - Fork 2
518 lines (450 loc) · 24.9 KB
/
build.yml
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
# Suggested filename: .github/workflows/build-with-dkml.yml
name: Build installer with DkML compiler
env:
PROGRAM_NAME_KEBAB: diskuv-ocaml
DKML_COMPILER: "" # You can override the dkml-compiler package version. Example: 4.12.1-v1.0.2, 4.14.0-v1.1.0-prerel1
OPAM_PACKAGE: dkml-installer-ocaml-network
on:
push:
branches:
- main
- v*
tags:
- v*
# ... or trigger manually from GitHub web interface
workflow_dispatch:
inputs:
test-filter:
type: choice
description: "Which tests are used"
required: false
default: all-tests
options:
- "all-tests"
- "no-tests"
- "no-direct-tests"
- "no-vagrant-tests"
jobs:
build:
timeout-minutes: 90 # 1.5 hours
strategy:
fail-fast: false
matrix:
include:
- gh_os: windows-2019
abi_pattern: win32-windows_x86
dkml_host_abi: windows_x86
- gh_os: windows-2019
abi_pattern: win32-windows_x86_64
dkml_host_abi: windows_x86_64
# - gh_os: ubuntu-latest
# abi_pattern: manylinux2014-linux_x86
# dkml_host_abi: linux_x86
# - gh_os: ubuntu-latest
# abi_pattern: manylinux2014-linux_x86_64
# dkml_host_abi: linux_x86_64
# - gh_os: macos-latest
# abi_pattern: macos-darwin_all
# dkml_host_abi: darwin_x86_64
runs-on: ${{ matrix.gh_os }}
name: build / ${{ matrix.abi_pattern }}
steps:
- name: Checkout code
uses: actions/checkout@v3
# The Setup DKML action will create the environment variables:
# opam_root, exe_ext, dkml_host_abi, abi_pattern (and many more)
- name: Setup DKML on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
- name: Setup DKML on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./ci/setup-dkml/gh-darwin/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
- name: Setup DKML on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./ci/setup-dkml/gh-linux/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
# This section is for your own build logic which you should place in ci/build-test.sh or a similar file
- name: Build and test the package on Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
shell: msys2 {0}
# with:
# DKML_HOST_ABI: ${{ matrix.dkml_host_abi }}
run: ci/build-test.sh --opam-package=${{ env.OPAM_PACKAGE }} --program-name-kebab=${{ env.PROGRAM_NAME_KEBAB }}
- name: Build and test the package on non-Windows host
if: "!startsWith(matrix.dkml_host_abi, 'windows_')"
# with:
# DKML_HOST_ABI: ${{ matrix.dkml_host_abi }}
run: ci/build-test.sh --opam-package=${{ env.OPAM_PACKAGE }} --program-name-kebab=${{ env.PROGRAM_NAME_KEBAB }}
# The Teardown DKML action will finalize caching, etc.
- name: Teardown DKML on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/post
- name: Teardown DKML on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./ci/setup-dkml/gh-darwin/post
- name: Teardown DKML on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./ci/setup-dkml/gh-linux/post
# We'll capture the dist/ folder for the testing steps
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.dkml_host_abi }}
path: dist/
release-notes:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout installer code
uses: actions/checkout@v3
- name: Decode opam version of installer
run: |
# (version 1.0.1) -> 1.0.1
OPAMMAJMINPAT=$(awk '$1 == "(version" {sub(/)/,"",$2); print $2}' dune-project)
echo "OPAMMAJMINPAT=$OPAMMAJMINPAT" >> $GITHUB_ENV
- name: Decode semver versions of CI tag
run: |
# From refs/tags/v0.4.0-prerel91_r1_no_test -> 0.4.0
# From refs/tags/v0.4.0+something -> 0.4.0
MAJMINPAT=$(printf "%s" '${{ github.ref }}' | sed 's#refs/tags/##; s#^v##; s#-.*##; s#+.*##')
# From refs/tags/v0.4.0-prerel91_r1_no_test -> 0.4.0-prerel91
# From refs/tags/v0.4.0+something -> 0.4.0
MAJMINPATPRE=$(printf "%s" '${{ github.ref }}' | sed 's#refs/tags/##; s#^v##; s#\(-prerel[0-9]*\).*#\1#; s#+.*##')
echo "MAJMINPAT=$MAJMINPAT" >> $GITHUB_ENV
echo "MAJMINPATPRE=$MAJMINPATPRE" >> $GITHUB_ENV
printf 'Major.Minor.Patch = \e[1;34m%s\e[0m\n' "$MAJMINPAT"
printf 'Major.Minor.Patch[-Prerelease] = \e[1;34m%s\e[0m\n' "$MAJMINPATPRE"
- name: Checkout diskuv-ocaml at semver tags
run: |
git clone https://gitlab.com/dkml/distributions/dkml.git
if ! git -C dkml -c advice.detachedHead=false checkout "${MAJMINPATPRE}"; then
# If there is no prerelease tag, perhaps there is a maj/min/patch tag?
if ! git -C dkml -c advice.detachedHead=false checkout "${MAJMINPAT}"; then
# If there is no maj/min/patch tag, don't let next step grab notes from HEAD
rm -rf dkml
fi
fi
- name: View release notes
run: |
notes=diskuv-ocaml/contributors/changes/v${MAJMINPAT}.md
cat > footer-top.md <<EOF
## Asset Listing
| Asset | Supported? | Description |
| ----------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------- |
EOF
cat > footer-mid-prerelease.md <<EOF
| [unsigned-diskuv-ocaml-windows_x86_64-i-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/unsigned-diskuv-ocaml-windows_x86_64-i-$OPAMMAJMINPAT.exe) | Yes | Unsigned 64-bit OCaml distribution installer. **You should download+install this** |
| [unsigned-diskuv-ocaml-windows_x86-i-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/unsigned-diskuv-ocaml-windows_x86-i-$OPAMMAJMINPAT.exe) | Partial | Unsigned 32-bit OCaml distribution on 64-bit Windows. Some OCaml packages may have problems |
| [unsigned-diskuv-ocaml-windows_x86_64-u-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/unsigned-diskuv-ocaml-windows_x86_64-u-$OPAMMAJMINPAT.exe) | Yes | Unsigned 64-bit OCaml distribution uninstaller. Use this if support@ tells you |
| [unsigned-diskuv-ocaml-windows_x86-u-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/unsigned-diskuv-ocaml-windows_x86-u-$OPAMMAJMINPAT.exe) | Partial | Unsigned 32-bit OCaml distribution uninstaller |
EOF
cat > footer-mid-release.md <<EOF
| [setup-diskuv-ocaml-windows_x86_64-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/setup-diskuv-ocaml-windows_x86_64-$OPAMMAJMINPAT.exe) | Yes | 64-bit OCaml distribution installer. **You should download+install this** |
| [setup-diskuv-ocaml-windows_x86-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/setup-diskuv-ocaml-windows_x86-$OPAMMAJMINPAT.exe) | Partial | 32-bit OCaml distribution on 64-bit Windows. Some OCaml packages may have problems |
| [uninstall-diskuv-ocaml-windows_x86_64-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/uninstall-diskuv-ocaml-windows_x86_64-$OPAMMAJMINPAT.exe) | Yes | 64-bit OCaml distribution uninstaller. Use this if support@ tells you |
| [uninstall-diskuv-ocaml-windows_x86-$OPAMMAJMINPAT.exe](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/uninstall-diskuv-ocaml-windows_x86-$OPAMMAJMINPAT.exe) | Partial | 32-bit OCaml distribution uninstaller |
EOF
cat > footer-bottom.md <<EOF
| [diskuv-ocaml-darwin_x86_64-i-$OPAMMAJMINPAT.tar.gz](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/diskuv-ocaml-darwin_x86_64-i-$OPAMMAJMINPAT.tar.gz) | No | Unsigned macOS on Intel binary distribution |
| [diskuv-ocaml-linux_x86_64-i-$OPAMMAJMINPAT.tar.gz](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/diskuv-ocaml-linux_x86_64-i-$OPAMMAJMINPAT.tar.gz) | No | Linux distribution compatible with CentOS 7, CentOS 8, Fedora 32+, Mageia 8+, ... |
| [diskuv-ocaml-linux_x86-i-$OPAMMAJMINPAT.tar.gz](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/diskuv-ocaml-linux_x86-i-$OPAMMAJMINPAT.tar.gz) | No | ... openSUSE 15.3+, Photon OS 4.0+ (3.0+ with updates), Ubuntu 20.04+Linux |
| [diskuv-ocaml-windows_x86-i-$OPAMMAJMINPAT.sfx](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/diskuv-ocaml-windows_x86-i-$OPAMMAJMINPAT.sfx) | No | Self-extracting executable header used when creating signed installers from ... |
| [diskuv-ocaml-windows_x86_64-i-$OPAMMAJMINPAT.sfx](https://github.com/diskuv/dkml-installer-ocaml/releases/download/v${MAJMINPATPRE}/diskuv-ocaml-windows_x86_64-i-$OPAMMAJMINPAT.sfx) | No | ... the pk7zip contents of the unsigned Windows installers |
| *-u-$OPAMMAJMINPAT.* | No | Uninstallers for all the above |
EOF
echo > emptyline
if [ -e "$notes" ]; then
RELEASEDATE=$(date -u +%Y-%m-%d)
cat "$notes" emptyline footer-top.md footer-mid-prerelease.md footer-bottom.md | sed "s/@@YYYYMMDD@@/$RELEASEDATE/" > notes-prerelease.md
cat "$notes" emptyline footer-top.md footer-mid-release.md footer-bottom.md | sed "s/@@YYYYMMDD@@/$RELEASEDATE/" > notes-release.md
else
cat footer-top.md footer-mid-prerelease.md footer-bottom.md > notes-prerelease.md
cat footer-top.md footer-mid-release.md footer-bottom.md > notes-release.md
fi
tail -n200 notes-prerelease.md notes-release.md # Just for troubleshooting
- uses: actions/upload-artifact@v3
with:
name: release-notes
path: |
notes-prerelease.md
notes-release.md
# Vagrant testing uncovers bugs that only appear on a fresh Windows installation.
# For example, found missing vcruntime140.dll with Vagrant testing.
#
# However Vagrant uses UNC paths for its shared drive which sometimes gets
# resolved as \\xxx\y rather than C:\vagrant. UNC paths are not supported well
# in OCaml ecosystem. So we only test the installer and uninstaller and some
# very light Dune-based tests in Vagrant.
vagrant-testing:
timeout-minutes: 180 # 3.0 hours
if: |
github.event.inputs.test-filter != 'no-tests' &&
github.event.inputs.test-filter != 'no-vagrant-tests' &&
!endsWith(github.ref_name, '_no_test')
# Wait for build
needs:
- build
strategy:
fail-fast: false
matrix:
os: [windows-2019]
dkml_host_abi:
- windows_x86
- windows_x86_64
virtualbox:
- windows-10-enterprise
# - windows-10-21h2-enterprise
# - windows-10-22h2-enterprise-nocm
- windows-11-21h2-enterprise
# macOS-12 is only GitHub CI runner that supports VirtualBox
# - the suggested 10.15 from https://stackoverflow.com/questions/66261101/using-vagrant-on-github-actions-ideally-incl-virtualbox
# is deprecated (https://github.com/actions/runner-images/issues/5583)
# - virtualbox added to macOS-12 in https://github.com/actions/runner-images/pull/5594
runs-on: macos-12
name: vagrant / ${{ matrix.dkml_host_abi }} / ${{ matrix.virtualbox }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download and unpack ${{ matrix.dkml_host_abi }} artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.dkml_host_abi }}
path: dist
- name: Cache Vagrant boxes
uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('vagrant/win32/Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Sanitize
run: rm -rf ~/playground
- name: vagrant up for ${{ matrix.dkml_host_abi }} build
run: |
#!/bin/sh
set -eufx
awk 'BEGIN{FS="="} /let +arp_version *= */{print $NF}' installer/src/version.ml | tr -d '"' | tee vagrant/win32/arpversion.txt
# Move artifacts into the Vagrant filesystem as "setup.exe" and "uninstall.exe"
mv dist/unsigned-${PROGRAM_NAME_KEBAB}-${{matrix.dkml_host_abi}}-i-$(cat vagrant/win32/arpversion.txt).exe vagrant/win32/setup.exe
mv dist/unsigned-${PROGRAM_NAME_KEBAB}-${{matrix.dkml_host_abi}}-u-$(cat vagrant/win32/arpversion.txt).exe vagrant/win32/uninstall.exe
cd vagrant/win32
vagrant up "${{ matrix.dkml_host_abi }}-${{ matrix.virtualbox }}"
- name: Check test_installation.t status
run: |
set -x ; EXITC=$(awk 'NF>0{print $1}' vagrant/win32/test_installation.t/exitcode.en-US.txt) ; if [ ! "$EXITC" = 0 ]; then echo "FATAL: Vagrant test_installation.t FAILED with exit code $EXITC"; exit 1; fi
- name: Get EstimatedSize= for Windows registry
run: |
cat vagrant/win32/test_installation.t/estimatedsize.en-US.txt
# Direct testing is simply using GitHub virtual machine to run the setup.
#
# Pros and Cons
# Because GitHub virtual machine already has Visual Studio and several other
# tools, it doesn't exercise all the paths that vagrant-testing covers.
# However, it is quicker and it can find issues with conflicting Cygwin
# (or any other of the many programs that are installed on a GitHub machine).
# In addition, windows-2019 (somewhat older Windows) and windows-latest (2022, or
# which is the latest) is tested ... Vagrant is closer to windows-latest
# as of Apr 2022.
#
# Matrix
# Instead of all 4 combinations of (2019,latest) x (32bit,64bit), we half
# the matrix so save compute cycles.
#
# Tricky Issues
# [Git installer hangs]
#
# The move for both windows-2019 and windows-latest from
# Image Release: https://github.com/actions/virtual-environments/releases/tag/win19%2F20220606.1
# to:
# Image Release: https://github.com/actions/virtual-environments/releases/tag/win19%2F20220614.0
# causes the Git for Windows 2.36.0 installer to hang.
#
# Root cause? It is likely antivirus
# (https://github.com/git-for-windows/msys2-runtime/pull/37) or a slightly
# different UAC environment.
#
# Mitigation: Pre-install Git for Windows from Chocolatey. Also Vagrant still
# tests the Git installer successfully.
direct-testing:
# Disabled until "Tricky Issues" is fixed
#if: false
if: |
github.event.inputs.test-filter != 'no-tests' &&
github.event.inputs.test-filter != 'no-direct-tests' &&
!endsWith(github.ref_name, '_no_test')
timeout-minutes: 90 # 1.5 hours
# Wait for build
needs:
- build
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
dkml_host_abi: windows_x86
- os: windows-latest
dkml_host_abi: windows_x86_64
runs-on: ${{ matrix.os }}
name: direct / ${{ matrix.os }} ${{ matrix.dkml_host_abi }}
steps:
- name: Download and unpack ${{ matrix.dkml_host_abi }} artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.dkml_host_abi }}
path: dist
- name: Troubleshoot environment (Windows)
shell: pwsh
run: |
dir env:
get-command git
echo dir "C:\Program Files\git\bin"
dir "C:\Program Files\git\bin"
echo dir "C:\Program Files\git\cmd"
dir "C:\Program Files\git\cmd"
- name: Test the installer (Windows)
env:
# Fix PATH so that `C:\Program Files\Git\usr\bin\cygpath.exe` and
# `C:\Program Files\Git\bin\bash.exe` are gone. GitHub Actions
# seems to put Git Bash entirely in the PATH!
PATH: "C:\\Program Files\\PowerShell\\7;\
C:\\ProgramData\\chocolatey\\bin;\
C:\\Program Files (x86)\\NSIS\\;\
C:\\tools\\zstd;\
C:\\Program Files\\git\\cmd;\
C:\\Program Files\\dotnet;\
C:\\Windows\\system32;\
C:\\Windows;\
C:\\Windows\\System32\\Wbem;\
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;\
C:\\Program Files\\Docker;\
C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit"
# If we don't change the shell then msys2/setup-msys2@v2 will conflict with
# the dkml-component-unixutils' MSYS2 ... you get:
# *** fatal error - cygheap base mismatch detected - 0x180348408/0x180349408.
# This problem is probably due to using incompatible versions of the cygwin DLL.
shell: pwsh
run: |
# Avoid Git installer hanging by pre-installing Git.
# (Choco best practices: https://docs.chocolatey.org/en-us/choco/commands/#scripting-integration-best-practices-style-guide)
#choco upgrade git -y --no-progress --version="'2.36.1'"
# --------- INSTALL ---------
$setup = Get-ChildItem -Path dist -Filter "unsigned-${{ env.PROGRAM_NAME_KEBAB }}-${{matrix.dkml_host_abi}}-i-*.exe" | Select-Object -First 1
Write-Host "Running $($setup.FullName) ..."
& $setup.FullName -v -v --color=always
if ($LastExitCode -ne 0) { throw "setup failed! Exited with $LastExitCode" }
& "$env:LOCALAPPDATA\Programs\DiskuvOCaml\usr\bin\ocamlopt.exe" -config
if ($LastExitCode -ne 0) { throw "ocamlopt.exe -config failed! Exited with $LastExitCode" }
& "$env:LOCALAPPDATA\Programs\DiskuvOCaml\bin\opam.exe" --version
if ($LastExitCode -ne 0) { throw "opam.exe --version failed! Exited with $LastExitCode" }
& "$env:LOCALAPPDATA\Programs\DiskuvOCaml\bin\opam.exe" var
if ($LastExitCode -ne 0) { throw "opam.exe var failed! Exited with $LastExitCode" }
# --------- TESTING SWITCH ---------
# Refresh the PATH with newly installed User entries
$env:Path = [Environment]::GetEnvironmentVariable('PATH', 'User') + [System.IO.Path]::PathSeparator + $env:Path
# Mimic $DiskuvOCamlHome
$env:DiskuvOCamlHome = "$env:LOCALAPPDATA\Programs\DiskuvOCaml"
$opamroot = opam var root
Write-Output "Testing otherplayground ..."
# Run through a simple playground ... different from the auto-installed 'playground' switch ...
# where we can test a new switch being created
(Test-Path -Path otherplayground) -or $(New-Item otherplayground -ItemType Directory)
Set-Location otherplayground # aka. cd playground
$env:DKML_BUILD_TRACE = "ON" # enable tracing
$env:DKML_BUILD_TRACE_LEVEL = "2" # verbose trace
$env:OCAMLRUNPARAM = "b" # stacktrace on failure
dkml init --yes # create switch
if ($lastexitcode -ne 0) { throw ("FATAL: dkml init failed") }
$env:DKML_BUILD_TRACE = "OFF" # disable tracing
$env:DKML_BUILD_TRACE_LEVEL = "0" # no trace
opam install graphics --yes # install something with a low number of dependencies, that sufficiently exercises Opam
if ($lastexitcode -ne 0) {
Write-Output "----- TROUBLESHOOTING: dune-*-*.out ----"
Get-ChildItem "$opamroot\log" -Filter "dune-*-*.out" | ForEach-Object { Write-Output "[BEGIN $_]" ; Get-Content $_; Write-Output "[END $_]`n" }
throw ("FATAL: opam install graphics failed")
}
opam install ppx_jane --yes # regression test: https://discuss.ocaml.org/t/ann-diskuv-ocaml-1-x-x-windows-ocaml-installer-no-longer-in-preview/10309/8?u=jbeckford
if ($lastexitcode -ne 0) { throw ("FATAL: opam install ppx_jane failed") }
opam install pyml --yes # regression test: https://github.com/diskuv/dkml-installer-ocaml/issues/12
if ($lastexitcode -ne 0) { throw ("FATAL: opam install pyml failed") }
opam install ocaml-lsp-server merlin --yes # regression test: https://github.com/diskuv/dkml-installer-ocaml/issues/21
if ($lastexitcode -ne 0) { throw ("FATAL: opam install ocaml-lsp-server merlin failed") }
opam install ocamlformat --yes
if ($lastexitcode -ne 0) { throw ("FATAL: opam install ocamlformat failed") }
#opam install yaml --yes # test ctypes (but yaml.3.1.0 fails with same error as supposedly fixed https://github.com/avsm/ocaml-yaml/pull/53)
if ($lastexitcode -ne 0) { throw ("FATAL: opam install yaml failed") }
Set-Location ..
# -------- TEST PACMAN ---------
& "$env:LOCALAPPDATA\Programs\DiskuvOCaml\bin\with-dkml.exe" pacman-key --init
if ($LastExitCode -ne 0) { throw "pacman-key --init failed! Exited with $LastExitCode" }
& "$env:LOCALAPPDATA\Programs\DiskuvOCaml\bin\with-dkml.exe" pacman-key --populate
if ($LastExitCode -ne 0) { throw "pacman-key --populate failed! Exited with $LastExitCode" }
& "$env:LOCALAPPDATA\Programs\DiskuvOCaml\bin\with-dkml.exe" pacman -Q
if ($LastExitCode -ne 0) { throw "pacman -Q failed! Exited with $LastExitCode" }
# --------- UNINSTALL ---------
$uninstall = Get-ChildItem -Path dist -Filter "unsigned-${{ env.PROGRAM_NAME_KEBAB }}-${{matrix.dkml_host_abi}}-u-*.exe" | Select-Object -First 1
Write-Host "Running $($uninstall.FullName) ..."
& $uninstall.FullName -v -v --color=always
if ($LastExitCode -ne 0) { throw "uninstall failed! Exited with $LastExitCode" }
#--------
# Release
#--------
#
# We need Release to run even if the tests are disabled with _no_test tag
# or through a test-filter. That means we cannot put a dependency on
# the tests.
# With no dependency on tests, we can create a Release even if tests fail.
# But that is OK because the Release is just a Pre-release.
release:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for softprops/action-gh-release@v1
# Wait until `build` and `release-notes` complete
needs:
- build
- release-notes
steps:
- uses: actions/download-artifact@v3
with:
path: dist
- name: Remove setup artifacts
run: rm -rf setup-*
working-directory: dist
- name: Restructure multi-ABI directories
run: |
_release="$(pwd)/_release"
install -d "$_release"
# Special case: Release notes are not part of multi-ABI
mv dist/release-notes release-notes
cd dist
find . -mindepth 1 -maxdepth 1 -type d | while read -r distname; do
rsync -av $distname/ "$_release"
done
- name: Display files to be distributed
run: ls -R
working-directory: _release
- name: Pre-release (only when Git tag pushed)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-prerel')
with:
prerelease: true
# [draft] should make it not visible on the GitHub releases page
draft: true
body_path: release-notes/notes-prerelease.md
files: |
_release/*
- name: Full release (only when Git tag pushed)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-prerel')
with:
# [draft] should make it not visible on the GitHub releases page.
# definitely should not be visible until signed.
draft: true
body_path: release-notes/notes-release.md
files: |
_release/*