From aadfed5c5bed85371e326ce94782f29ad7458909 Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 2 Jan 2024 15:26:53 +0000 Subject: [PATCH] GHA: Make sure the resulting opam binary is "statically" linked on MinGW --- .github/scripts/cygwin.cmd | 2 -- .github/workflows/ci.ml | 1 + .github/workflows/main.yml | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/scripts/cygwin.cmd b/.github/scripts/cygwin.cmd index eb02db20b54..d0e97725fc3 100644 --- a/.github/scripts/cygwin.cmd +++ b/.github/scripts/cygwin.cmd @@ -49,8 +49,6 @@ if not exist %CYGWIN_CACHE_DIR%\%CYGWIN_DISTRO%\cache.tar ( :: C:\Windows\system32 (overriding curl, bash, etc. in System32) but after Mercurial :: and Git (so that they are not overridden). set Path=C:\Program Files\Mercurial;C:\Program Files\Git\cmd;%CYGWIN_ROOT%\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\ -if "%3" equ "i686-w64-mingw32" set Path=%CYGWIN_ROOT%\usr\%3\sys-root\mingw\bin;%Path% -if "%3" equ "x86_64-w64-mingw32" set Path=%CYGWIN_ROOT%\usr\%3\sys-root\mingw\bin;%Path% if "%3" equ "x86_64-pc-cygwin" set Path=%CYGWIN_ROOT%\bin;%Path% ::echo %CYGWIN_ROOT%\bin>> %GITHUB_PATH% diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index c54c7131bbf..a5fa760a539 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -339,6 +339,7 @@ let main_build_job ~analyse_job ~cygwin_job ?section runner start_version ~oc ~w ++ build_cache OCaml platform "${{ matrix.ocamlv }}" host ++ run "Build" ["bash -exu .github/scripts/main/main.sh " ^ host] ++ not_on Windows (run "Test (basic)" ["bash -exu .github/scripts/main/test.sh"]) + ++ only_on Windows (run ~cond:(Predicate(false, EndsWith("matrix.host", "-pc-cygwin"))) "Test \"static\" binaries on Windows" ["ldd ./opam.exe | test \"$(grep -v -F /cygdrive/c/Windows/)\" = ''"]) ++ only_on Windows (run "Test (basic - Cygwin)" ~cond:(Predicate(true, EndsWith("matrix.host", "-pc-cygwin"))) ["bash -exu .github/scripts/main/test.sh"]) ++ only_on Windows (run "Test (basic - native Windows)" ~env:[("OPAMROOT", {|D:\a\opam\opam\.opam|})] ~shell:"cmd" ~cond:(Predicate(false, EndsWith("matrix.host", "-pc-cygwin"))) ({|set Path=D:\Cache\ocaml-local\bin;%Path%|} :: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 463a31f34e2..30aa7251def 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -204,6 +204,9 @@ jobs: run: bash -exu .github/scripts/main/ocaml-cache.sh ${{ runner.os }} ${{ matrix.ocamlv }} ${{ matrix.host }} - name: Build run: bash -exu .github/scripts/main/main.sh ${{ matrix.host }} + - name: Test "static" binaries on Windows + if: endsWith(matrix.host, '-pc-cygwin') == false + run: ldd ./opam.exe | test "$(grep -v -F /cygdrive/c/Windows/)" = '' - name: Test (basic - Cygwin) if: endsWith(matrix.host, '-pc-cygwin') run: bash -exu .github/scripts/main/test.sh