Skip to content

Commit 4cf4555

Browse files
authored
[ci] Simplify windows ci with native opam (#11879)
* [ci] Remove windows 32 ocaml install script * [ci] Remove installation of perl libraries These were only needed for camlp5 which has now been removed * [ci] Remove unneeded PATH step on windows This is handled now by the mingw-w64-shims package: https://github.com/dra27/mingw-w64-shims/blob/3c4a82700d9b03443ad6f2927449f7a8f25a77cf/mingw-w64-shims.opam#L8 * [ci] Use cygwin tar * [ci] Update setup-ocaml * [ci] Update to latest ocaml 4 release on windows 4.08.1 was not supported natively on windows * [ci] Add required PATH entries for installing luv See: aantron/luv#162 * [ci] Run windows make commands natively With native opam, we no longer need to build from the cygwin bash. This means we can rely on native git.
1 parent 30cea1a commit 4cf4555

File tree

6 files changed

+37
-124
lines changed

6 files changed

+37
-124
lines changed

.github/workflows/main.yml

+18-42
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ jobs:
1818
with:
1919
submodules: recursive
2020

21-
- name: Use GNU Tar from msys
22-
run: |
23-
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
24-
rm C:\msys64\usr\bin\bash.exe
25-
2621
- name: choco install nsis
2722
uses: nick-invision/retry@v3
2823
with:
@@ -51,44 +46,30 @@ jobs:
5146
run: neko -version 2>&1
5247

5348
- name: Setup ocaml
54-
uses: ocaml/setup-ocaml@v2
49+
uses: ocaml/setup-ocaml@v3
5550
with:
56-
ocaml-compiler: 4.08.1
57-
opam-repositories: |
58-
opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
59-
default: https://github.com/ocaml/opam-repository.git
51+
ocaml-compiler: 4
6052
opam-local-packages: |
6153
haxe.opam
6254
6355
- name: Install dependencies
6456
shell: pwsh
57+
env:
58+
MBEDTLS_VERSION: 2.16.3
6559
run: |
66-
Set-PSDebug -Trace 1
67-
curl.exe -fsSL -o "libmbedtls.tar.xz" --retry 3 https://github.com/Simn/mingw64-mbedtls/releases/download/2.16.3/mingw64-$($env:MINGW_ARCH)-mbedtls-2.16.3-1.tar.xz
68-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'curl -L https://cpanmin.us | perl - App::cpanminus')
69-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cpanm IPC::System::Simple module')
70-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cpanm String::ShellQuote')
71-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'echo "$OLDPWD"')
72-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -C / -xvf libmbedtls.tar.xz')
60+
curl.exe -fsSL -o "libmbedtls.tar.xz" --retry 3 `
61+
https://github.com/Simn/mingw64-mbedtls/releases/download/${{ env.MBEDTLS_VERSION }}/mingw64-${{ env.MINGW_ARCH }}-mbedtls-${{ env.MBEDTLS_VERSION }}-1.tar.xz
62+
${{ env.CYG_ROOT }}\bin\tar.exe -C ${{ env.CYG_ROOT }} -xvf libmbedtls.tar.xz
7363
7464
- name: Install OCaml libraries
7565
shell: pwsh
7666
run: |
7767
Set-PSDebug -Trace 1
68+
# see: https://github.com/aantron/luv/issues/162
69+
$env:PATH="${env:CYG_ROOT}\bin;${env:CYG_ROOT}\usr\x86_64-w64-mingw32\bin;${env:PATH}"
7870
opam install haxe --deps-only
7971
opam list
8072
81-
- name: Expose mingw dll files
82-
shell: pwsh
83-
run: Write-Host "::add-path::${env:CYG_ROOT}/usr/$($env:MINGW_ARCH)-w64-mingw32/sys-root/mingw/bin"
84-
85-
# required to be able to retrieve the revision
86-
- name: Mark directory as safe
87-
shell: pwsh
88-
run: |
89-
Set-PSDebug -Trace 1
90-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'git config --global --add safe.directory "$OLDPWD"')
91-
9273
- name: Set ADD_REVISION=1 for non-release
9374
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
9475
shell: pwsh
@@ -98,20 +79,15 @@ jobs:
9879
shell: pwsh
9980
run: |
10081
Set-PSDebug -Trace 1
101-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win -j`nproc` haxe 2>&1')
102-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win haxelib 2>&1')
103-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -f Makefile.win echo_package_files package_bin package_installer_win package_choco 2>&1')
104-
dir out
105-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxe.exe')
106-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxelib.exe')
107-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && ls ./out')
108-
109-
- name: Check artifact
110-
shell: bash
111-
run: |
112-
ls out
113-
# Output should contain binaries zip, installer zip and nupkg
114-
[ $(ls -1 out | wc -l) -eq "3" ]
82+
# stop after any command returns an error
83+
$PSNativeCommandUseErrorActionPreference = $true
84+
$ErrorActionPreference = 'Stop'
85+
opam exec -- make -s -f Makefile.win -j"$env:NUMBER_OF_PROCESSORS" haxe
86+
opam exec -- make -s -f Makefile.win haxelib
87+
opam exec -- make -f Makefile.win echo_package_files package_bin package_installer_win package_choco
88+
cygcheck ./haxe.exe
89+
cygcheck ./haxelib.exe
90+
ls ./out
11591
11692
- name: Upload artifact
11793
uses: actions/upload-artifact@v4

extra/github-actions/build-windows.yml

+9-25
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
- name: Expose mingw dll files
2-
shell: pwsh
3-
run: Write-Host "::add-path::${env:CYG_ROOT}/usr/$($env:MINGW_ARCH)-w64-mingw32/sys-root/mingw/bin"
4-
5-
# required to be able to retrieve the revision
6-
- name: Mark directory as safe
7-
shell: pwsh
8-
run: |
9-
Set-PSDebug -Trace 1
10-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'git config --global --add safe.directory "$OLDPWD"')
11-
121
- name: Set ADD_REVISION=1 for non-release
132
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
143
shell: pwsh
@@ -18,20 +7,15 @@
187
shell: pwsh
198
run: |
209
Set-PSDebug -Trace 1
21-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win -j`nproc` haxe 2>&1')
22-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win haxelib 2>&1')
23-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -f Makefile.win echo_package_files package_bin package_installer_win package_choco 2>&1')
24-
dir out
25-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxe.exe')
26-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxelib.exe')
27-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && ls ./out')
28-
29-
- name: Check artifact
30-
shell: bash
31-
run: |
32-
ls out
33-
# Output should contain binaries zip, installer zip and nupkg
34-
[ $(ls -1 out | wc -l) -eq "3" ]
10+
# stop after any command returns an error
11+
$PSNativeCommandUseErrorActionPreference = $true
12+
$ErrorActionPreference = 'Stop'
13+
opam exec -- make -s -f Makefile.win -j"$env:NUMBER_OF_PROCESSORS" haxe
14+
opam exec -- make -s -f Makefile.win haxelib
15+
opam exec -- make -f Makefile.win echo_package_files package_bin package_installer_win package_choco
16+
cygcheck ./haxe.exe
17+
cygcheck ./haxelib.exe
18+
ls ./out
3519
3620
- name: Upload artifact
3721
uses: actions/upload-artifact@v4

extra/github-actions/install-ocaml-libs-windows.yml

+2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
shell: pwsh
33
run: |
44
Set-PSDebug -Trace 1
5+
# see: https://github.com/aantron/luv/issues/162
6+
$env:PATH="${env:CYG_ROOT}\bin;${env:CYG_ROOT}\usr\x86_64-w64-mingw32\bin;${env:PATH}"
57
opam install haxe --deps-only
68
opam list
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,15 @@
11
- name: Setup ocaml
2-
id: ocaml
3-
continue-on-error: true
4-
uses: kLabz/setup-ocaml@win32
2+
uses: ocaml/setup-ocaml@v3
53
with:
6-
ocaml-compiler: 4.08.1
7-
opam-depext: false
8-
opam-repositories: |
9-
opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
10-
default: https://github.com/ocaml/opam-repository.git
4+
ocaml-compiler: 4
115
opam-local-packages: |
126
haxe.opam
13-
cache-prefix: w32-v1
14-
15-
# TODO make it work on first try
16-
# (when cygwin cache doesn't exist, ocaml install fails with a curl error)
17-
- name: Setup ocaml (second chance)
18-
if: steps.ocaml.outcome == 'failure'
19-
uses: kLabz/setup-ocaml@win32
20-
with:
21-
ocaml-compiler: 4.08.1
22-
opam-depext: false
23-
opam-repositories: |
24-
opam-repository-mingw: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
25-
default: https://github.com/ocaml/opam-repository.git
26-
opam-local-packages: |
27-
haxe.opam
28-
cache-prefix: w32-v1
297
308
- name: Install dependencies
319
shell: pwsh
10+
env:
11+
MBEDTLS_VERSION: 2.16.3
3212
run: |
33-
Set-PSDebug -Trace 1
34-
curl.exe -fsSL -o "libmbedtls.tar.xz" --retry 3 https://github.com/Simn/mingw64-mbedtls/releases/download/2.16.3/mingw64-$($env:MINGW_ARCH)-mbedtls-2.16.3-1.tar.xz
35-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'curl -L https://cpanmin.us | perl - App::cpanminus')
36-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cpanm IPC::System::Simple module')
37-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cpanm String::ShellQuote')
38-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'echo "$OLDPWD"')
39-
& "$($env:CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -C / -xvf libmbedtls.tar.xz')
13+
curl.exe -fsSL -o "libmbedtls.tar.xz" --retry 3 `
14+
https://github.com/Simn/mingw64-mbedtls/releases/download/${{ env.MBEDTLS_VERSION }}/mingw64-${{ env.MINGW_ARCH }}-mbedtls-${{ env.MBEDTLS_VERSION }}-1.tar.xz
15+
${{ env.CYG_ROOT }}\bin\tar.exe -C ${{ env.CYG_ROOT }} -xvf libmbedtls.tar.xz

extra/github-actions/install-ocaml-windows64.yml

-20
This file was deleted.

extra/github-actions/workflows/main.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@ jobs:
1717
with:
1818
submodules: recursive
1919

20-
- name: Use GNU Tar from msys
21-
run: |
22-
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
23-
rm C:\msys64\usr\bin\bash.exe
24-
2520
@import install-nsis.yml
2621
@import install-neko-windows.yml
27-
@import install-ocaml-windows64.yml
22+
@import install-ocaml-windows.yml
2823
@import install-ocaml-libs-windows.yml
2924
@import build-windows.yml
3025

0 commit comments

Comments
 (0)