From 64a57911ad92d8659947dd1c784c13bfa7884008 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 12:48:02 +0000 Subject: [PATCH 01/11] test(rtop): capture stderr in integration test for Windows --- test/rtopIntegration.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rtopIntegration.t b/test/rtopIntegration.t index 66f9be4a3..1cac5f452 100644 --- a/test/rtopIntegration.t +++ b/test/rtopIntegration.t @@ -11,8 +11,8 @@ always error. Given the above, we're gonna test that utop integration works by piping code into it and asserting the existence of some output. - $ echo "let f = a => a;" | rtop | grep -o "let f: 'a => 'a = ;" + $ echo "let f = a => a;" | rtop 2>&1 | grep -o "let f: 'a => 'a = ;" let f: 'a => 'a = ; - $ echo "let f = (a) => 1 + \"hi\";" | rtop | grep -o "has type" + $ echo "let f = (a) => 1 + \"hi\";" | rtop 2>&1 | grep -o "has type" has type From 8874acd88914bed0d8cd5424b1c8495e265e6259 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 16:25:58 +0000 Subject: [PATCH 02/11] ci: setup tmate --- .github/workflows/esy-ci.yml | 5 +++++ .github/workflows/opam-ci.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/esy-ci.yml b/.github/workflows/esy-ci.yml index 2783730b4..2d6d67d07 100644 --- a/.github/workflows/esy-ci.yml +++ b/.github/workflows/esy-ci.yml @@ -5,6 +5,7 @@ on: push: branches: - master + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -81,6 +82,10 @@ jobs: if: runner.os != 'Windows' run: esy dune runtest + - name: Setup tmate session (Windows debug) + if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch' + uses: mxschmitt/action-tmate@v3 + - name: Test when Windows if: runner.os == 'Windows' run: esy b dune runtest -p "reason,rtop" diff --git a/.github/workflows/opam-ci.yml b/.github/workflows/opam-ci.yml index e4e8a1e25..ac2f5b319 100644 --- a/.github/workflows/opam-ci.yml +++ b/.github/workflows/opam-ci.yml @@ -7,6 +7,7 @@ on: - master tags: - '*' + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -67,6 +68,10 @@ jobs: - name: Build reason and rtop run: opam exec -- dune build -p reason,rtop + - name: Setup tmate session (Windows debug) + if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch' + uses: mxschmitt/action-tmate@v3 + - name: Test run: opam exec -- dune runtest -p reason,rtop From bb604ef077d387e91ac16170c0430b77a70c9666 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 17:54:48 +0000 Subject: [PATCH 03/11] test(rtop): avoid running rtop in windows 4.14.* --- test/dune | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/dune b/test/dune index 7c1e528e0..cde6fdb2e 100644 --- a/test/dune +++ b/test/dune @@ -15,4 +15,10 @@ (cram (applies_to rtopIntegration) (package rtop) + (enabled_if + (or + (= %{os_type} Unix) + (and + (= %{os_type} Win32) + (>= %{ocaml_version} 5.0.0)))) (deps %{bin:ocamlc} %{bin:rtop})) From eb88138cee446fac8f71573913d9602637d0d350 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 17:55:11 +0000 Subject: [PATCH 04/11] ci: enable 5.4.0 in windows --- .github/workflows/opam-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/opam-ci.yml b/.github/workflows/opam-ci.yml index ac2f5b319..658423543 100644 --- a/.github/workflows/opam-ci.yml +++ b/.github/workflows/opam-ci.yml @@ -33,6 +33,7 @@ jobs: # OCaml >= 4.13 # https://github.com/ocaml/setup-ocaml/issues/822#issuecomment-2215525942 - {ocaml-compiler: '4.14.x', os: windows-latest} + - {ocaml-compiler: 'ocaml-base-compiler.5.4.0', os: windows-latest} runs-on: ${{ matrix.setup.os }} From f4422f242b0c8774a831e8c736163c58c2f3dce3 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 17:55:26 +0000 Subject: [PATCH 05/11] ci: remove action-tmate --- .github/workflows/opam-ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/opam-ci.yml b/.github/workflows/opam-ci.yml index 658423543..e264c9946 100644 --- a/.github/workflows/opam-ci.yml +++ b/.github/workflows/opam-ci.yml @@ -69,13 +69,6 @@ jobs: - name: Build reason and rtop run: opam exec -- dune build -p reason,rtop - - name: Setup tmate session (Windows debug) - if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch' - uses: mxschmitt/action-tmate@v3 - - - name: Test - run: opam exec -- dune runtest -p reason,rtop - - name: Install dune-release if: startsWith(github.ref, 'refs/tags/') && matrix.setup.os == 'ubuntu-latest' && matrix.setup.ocaml-compiler == 'ocaml-base-compiler.5.4.0' run: opam install dune-release -y From 7701990e97c9364bf3cf69b6bbd30b512b12d181 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 18:27:35 +0000 Subject: [PATCH 06/11] ci: revert all changes, keep building --- .github/workflows/esy-ci.yml | 12 +----------- .github/workflows/opam-ci.yml | 4 +++- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/esy-ci.yml b/.github/workflows/esy-ci.yml index 2d6d67d07..fb2bc961e 100644 --- a/.github/workflows/esy-ci.yml +++ b/.github/workflows/esy-ci.yml @@ -5,7 +5,6 @@ on: push: branches: - master - workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -78,18 +77,9 @@ jobs: - name: Build run: esy build - - name: Test when not Windows - if: runner.os != 'Windows' + - name: Test run: esy dune runtest - - name: Setup tmate session (Windows debug) - if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch' - uses: mxschmitt/action-tmate@v3 - - - name: Test when Windows - if: runner.os == 'Windows' - run: esy b dune runtest -p "reason,rtop" - - name: Export dependencies if: steps.deps-cache.outputs.cache-hit != 'true' run: esy export-dependencies diff --git a/.github/workflows/opam-ci.yml b/.github/workflows/opam-ci.yml index e264c9946..f8716acd6 100644 --- a/.github/workflows/opam-ci.yml +++ b/.github/workflows/opam-ci.yml @@ -7,7 +7,6 @@ on: - master tags: - '*' - workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -69,6 +68,9 @@ jobs: - name: Build reason and rtop run: opam exec -- dune build -p reason,rtop + - name: Test + run: opam exec -- dune runtest -p reason,rtop + - name: Install dune-release if: startsWith(github.ref, 'refs/tags/') && matrix.setup.os == 'ubuntu-latest' && matrix.setup.ocaml-compiler == 'ocaml-base-compiler.5.4.0' run: opam install dune-release -y From 0b033186c88f07fe0347cc8c96e4e62edc3672ad Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 18:58:04 +0000 Subject: [PATCH 07/11] ci: add -preasonrtop in esy-ci --- .github/workflows/esy-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/esy-ci.yml b/.github/workflows/esy-ci.yml index fb2bc961e..5e8884d9d 100644 --- a/.github/workflows/esy-ci.yml +++ b/.github/workflows/esy-ci.yml @@ -78,7 +78,7 @@ jobs: run: esy build - name: Test - run: esy dune runtest + run: esy dune runtest -p reason,rtop - name: Export dependencies if: steps.deps-cache.outputs.cache-hit != 'true' From 79175105108b0c118fdac8404607ea6959271a7b Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 19:06:06 +0000 Subject: [PATCH 08/11] ci: update cache keys --- .github/workflows/esy-ci.yml | 10 +++++----- .github/workflows/opam-ci.yml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/esy-ci.yml b/.github/workflows/esy-ci.yml index 5e8884d9d..2126d19c8 100644 --- a/.github/workflows/esy-ci.yml +++ b/.github/workflows/esy-ci.yml @@ -44,7 +44,7 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.esy/source - key: esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + key: v0.0.1-esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} - name: Print esy cache id: print_esy_cache @@ -57,8 +57,8 @@ jobs: path: | ${{ steps.print_esy_cache.outputs.ESY_CACHE }} _export - key: esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} - restore-keys: esy-build-${{ matrix.os }}- + key: v0.0.1-esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + restore-keys: v0.0.1-esy-build-${{ matrix.os }}- - name: Install dependencies run: esy install @@ -89,7 +89,7 @@ jobs: if: steps.global-cache.outputs.cache-hit != 'true' with: path: ~/.esy/source - key: esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + key: v0.0.1-esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} - name: Save dependencies cache if: steps.deps-cache.outputs.cache-hit != 'true' @@ -98,7 +98,7 @@ jobs: path: | ${{ steps.print_esy_cache.outputs.ESY_CACHE }} _export - key: esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + key: v0.0.1-esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} # Cleanup build cache in case dependencies have changed - name: Cleanup diff --git a/.github/workflows/opam-ci.yml b/.github/workflows/opam-ci.yml index f8716acd6..f0ebe912d 100644 --- a/.github/workflows/opam-ci.yml +++ b/.github/workflows/opam-ci.yml @@ -52,7 +52,7 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.opam - key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('*.opam') }} + key: v0.0.1-opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('*.opam') }} - name: Load opam cache when Windows if: runner.os == 'Windows' @@ -60,7 +60,7 @@ jobs: uses: actions/cache/restore@v4 with: path: _opam - key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }} + key: v0.0.1-opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }} - name: Install dependencies run: opam install . --deps-only @@ -88,12 +88,12 @@ jobs: if: steps.opam-cache.outputs.cache-hit != 'true' && runner.os != 'Windows' with: path: ~/.opam - key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }} + key: v0.0.1-opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }} - name: Save cache when Windows uses: actions/cache/save@v4 if: steps.opam-cache-windows.outputs.cache-hit != 'true' && runner.os == 'Windows' with: path: _opam - key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }} + key: v0.0.1-opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }} From dfd0d2e408281ccb9e532e6e287297d0362c994d Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 19:45:52 +0000 Subject: [PATCH 09/11] ci: fix Windows CI failures - Disable rtopIntegration test on Windows due to lambda-term segfault when stdout is not a real console handle (ConPTY issue on GH Actions). See: https://github.com/ocaml-community/lambda-term/pull/125 - Add setup-mingw step in esy-ci for Windows to provide x86_64-w64-mingw32-gcc needed to compile lambda-term C stubs. - Bump esy cache keys to v0.0.2 to avoid stale caches. --- .github/workflows/esy-ci.yml | 16 +++++++++++----- test/dune | 11 +++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/esy-ci.yml b/.github/workflows/esy-ci.yml index 2126d19c8..c7a73b92c 100644 --- a/.github/workflows/esy-ci.yml +++ b/.github/workflows/esy-ci.yml @@ -36,6 +36,12 @@ jobs: with: node-version: 20 + - name: Set up MinGW (Windows) + if: runner.os == 'Windows' + uses: egor-tensin/setup-mingw@v2 + with: + platform: x64 + - name: Install esy run: npm install -g esy@0.9.0-beta.1 @@ -44,7 +50,7 @@ jobs: uses: actions/cache/restore@v4 with: path: ~/.esy/source - key: v0.0.1-esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + key: v0.0.2-esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} - name: Print esy cache id: print_esy_cache @@ -57,8 +63,8 @@ jobs: path: | ${{ steps.print_esy_cache.outputs.ESY_CACHE }} _export - key: v0.0.1-esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} - restore-keys: v0.0.1-esy-build-${{ matrix.os }}- + key: v0.0.2-esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + restore-keys: v0.0.2-esy-build-${{ matrix.os }}- - name: Install dependencies run: esy install @@ -89,7 +95,7 @@ jobs: if: steps.global-cache.outputs.cache-hit != 'true' with: path: ~/.esy/source - key: v0.0.1-esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + key: v0.0.2-esy-source-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} - name: Save dependencies cache if: steps.deps-cache.outputs.cache-hit != 'true' @@ -98,7 +104,7 @@ jobs: path: | ${{ steps.print_esy_cache.outputs.ESY_CACHE }} _export - key: v0.0.1-esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} + key: v0.0.2-esy-build-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('esy.lock.json') }} # Cleanup build cache in case dependencies have changed - name: Cleanup diff --git a/test/dune b/test/dune index cde6fdb2e..418b8bf80 100644 --- a/test/dune +++ b/test/dune @@ -12,13 +12,12 @@ ./lib/outcometreePrinter.exe ./lib/fdLeak.exe)) +; rtopIntegration is disabled on Windows due to a segfault in lambda-term's +; Windows C stubs when stdout is not a real console handle (ConPTY issue). +; See: https://github.com/ocaml-community/lambda-term/pull/125 +; Re-enable on Windows once lambda-term ships the fix. (cram (applies_to rtopIntegration) (package rtop) - (enabled_if - (or - (= %{os_type} Unix) - (and - (= %{os_type} Win32) - (>= %{ocaml_version} 5.0.0)))) + (enabled_if (= %{os_type} Unix)) (deps %{bin:ocamlc} %{bin:rtop})) From fd5365bab657e37da67e5da82f931671a759987d Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Wed, 4 Mar 2026 19:57:22 +0000 Subject: [PATCH 10/11] ci: replace setup-mingw action with direct choco install The egor-tensin/setup-mingw@v2 action fails on MinGW 15.2.0 because its cleanup script tries to remove libpthread.dll.a which no longer exists in UCRT-based builds. Use choco directly and add the bin directory to PATH manually. --- .github/workflows/esy-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/esy-ci.yml b/.github/workflows/esy-ci.yml index c7a73b92c..200ff37c1 100644 --- a/.github/workflows/esy-ci.yml +++ b/.github/workflows/esy-ci.yml @@ -38,9 +38,10 @@ jobs: - name: Set up MinGW (Windows) if: runner.os == 'Windows' - uses: egor-tensin/setup-mingw@v2 - with: - platform: x64 + shell: pwsh + run: | + choco upgrade mingw -y --no-progress + echo "C:\ProgramData\mingw64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Install esy run: npm install -g esy@0.9.0-beta.1 From 0eae8742f6f4adc2476a4c59eca4cb1c32b4df27 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Thu, 5 Mar 2026 09:45:04 +0000 Subject: [PATCH 11/11] ci: esy-ci doesn't run rtop tests on windows --- .github/workflows/esy-ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/esy-ci.yml b/.github/workflows/esy-ci.yml index 200ff37c1..124f31998 100644 --- a/.github/workflows/esy-ci.yml +++ b/.github/workflows/esy-ci.yml @@ -84,8 +84,13 @@ jobs: - name: Build run: esy build - - name: Test - run: esy dune runtest -p reason,rtop + - name: Test when not Windows + if: runner.os != 'Windows' + run: esy dune runtest + + - name: Test when Windows + if: runner.os == 'Windows' + run: esy b dune runtest -p "reason,rtop" - name: Export dependencies if: steps.deps-cache.outputs.cache-hit != 'true'