Skip to content

Commit 9fbc600

Browse files
committed
Merge branch 'master' into lsp
Signed-off-by: Pedro Castro <aspeddro@gmail.com>
2 parents 91f944f + 7928f37 commit 9fbc600

15 files changed

Lines changed: 2787 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,33 @@ jobs:
6868
exe-suffix: ".exe"
6969
dune-profile: release
7070

71+
<<<<<<< HEAD
7172
# Disable for now. eio and eio_main require ocaml >= 5.2.0
7273
# Verify that the compiler still builds with the oldest OCaml version we support.
7374
# - os: ubuntu-24.04
7475
# ocaml_compiler: ocaml-variants.5.0.0+options,ocaml-option-static
7576
# node-target: linux-x64
7677
# rust-target: x86_64-unknown-linux-musl
7778
# dune-profile: static
79+
||||||| 5ec125a91
80+
# Verify that the compiler still builds with older OCaml versions
81+
- os: ubuntu-latest
82+
ocaml_compiler: ocaml-variants.5.0.0+options,ocaml-option-static
83+
- os: ubuntu-latest
84+
ocaml_compiler: ocaml-variants.4.14.2+options,ocaml-option-static
85+
- os: ubuntu-latest
86+
ocaml_compiler: ocaml-variants.4.13.0+options,ocaml-option-static
87+
=======
88+
# Verify that the compiler still builds with the oldest OCaml version we support.
89+
# Steps comparing OCaml and Rust rewatch are skipped on this job; the
90+
# first linux-x64 job runs them. OCaml 5.0 does not build with GCC 15
91+
# (C23 by default), so this job stays on Ubuntu 24.04.
92+
- os: ubuntu-24.04
93+
ocaml_compiler: ocaml-variants.5.0.0+options,ocaml-option-static
94+
node-target: linux-x64
95+
rust-target: x86_64-unknown-linux-musl
96+
dune-profile: static
97+
>>>>>>> master
7898

7999
runs-on: ${{matrix.os}}
80100

@@ -98,6 +118,7 @@ jobs:
98118

99119
- name: Setup Linux dependencies
100120
if: runner.os == 'Linux'
121+
<<<<<<< HEAD
101122
uses: ./.github/actions/setup-linux-dependencies
102123

103124
- name: Build rewatch
@@ -107,22 +128,143 @@ jobs:
107128
rust-target: ${{ matrix.rust-target }}
108129
exe-suffix: ${{ matrix.exe-suffix }}
109130
run-quality-checks: "true"
131+
||||||| 5ec125a91
132+
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
133+
with:
134+
# See https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/unix.ts#L9
135+
packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync
136+
version: v2
137+
=======
138+
uses: ./.github/actions/setup-linux-dependencies
139+
>>>>>>> master
110140

141+
<<<<<<< HEAD
111142
# The static OCaml switch uses musl-gcc. linux-libc-dev installs Linux
112143
# headers under /usr/include, but musl-gcc searches the musl include dir.
113144
# Link the Linux headers into musl's include path so packages with C stubs
114145
# such as uring can include <linux/...> headers.
115146
- name: Make Linux headers visible to musl-gcc
116147
if: runner.os == 'Linux'
148+
||||||| 5ec125a91
149+
# matrix.ocaml_compiler may contain commas
150+
- name: Get OPAM cache key
151+
shell: bash
152+
run: echo "opam_cache_key=opam-env-v5-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}" | sed 's/,/-/g' >> $GITHUB_ENV
153+
154+
- name: Restore OPAM environment
155+
id: cache-opam-env
156+
uses: actions/cache/restore@v4
157+
with:
158+
path: |
159+
${{ runner.tool_cache }}/opam
160+
~/.opam
161+
_opam
162+
.opam-path
163+
D:\cygwin
164+
D:\.opam
165+
key: ${{ env.opam_cache_key }}
166+
167+
- name: Use OCaml ${{matrix.ocaml_compiler}}
168+
uses: ocaml/setup-ocaml@v3.0.15
169+
if: steps.cache-opam-env.outputs.cache-hit != 'true'
170+
with:
171+
ocaml-compiler: ${{matrix.ocaml_compiler}}
172+
opam-pin: false
173+
174+
- name: Get OPAM executable path
175+
if: steps.cache-opam-env.outputs.cache-hit != 'true'
176+
uses: actions/github-script@v7
177+
with:
178+
script: |
179+
const opamPath = await io.which('opam', true);
180+
console.log('opam executable found: %s', opamPath);
181+
182+
const fs = require('fs/promises');
183+
await fs.writeFile('.opam-path', opamPath, 'utf-8');
184+
console.log('stored path to .opam-path');
185+
186+
- name: Install OPAM dependencies
187+
if: steps.cache-opam-env.outputs.cache-hit != 'true'
188+
run: opam install . --deps-only --with-test
189+
190+
- name: Cache OPAM environment
191+
if: steps.cache-opam-env.outputs.cache-hit != 'true'
192+
uses: actions/cache/save@v4
193+
with:
194+
path: |
195+
${{ runner.tool_cache }}/opam
196+
~/.opam
197+
_opam
198+
.opam-path
199+
D:\cygwin
200+
D:\.opam
201+
key: ${{ env.opam_cache_key }}
202+
203+
- name: Use cached OPAM environment
204+
if: steps.cache-opam-env.outputs.cache-hit == 'true'
205+
=======
206+
- name: Build rewatch
207+
uses: ./.github/actions/build-rewatch
208+
with:
209+
cache-target: ${{ matrix.rust-target }}
210+
rust-target: ${{ matrix.rust-target }}
211+
exe-suffix: ${{ matrix.exe-suffix }}
212+
run-quality-checks: "true"
213+
214+
- name: Setup OCaml ${{ matrix.ocaml_compiler }}
215+
id: setup_ocaml
216+
uses: ./.github/actions/setup-ocaml
217+
with:
218+
compiler: ${{ matrix.ocaml_compiler }}
219+
os: ${{ matrix.os }}
220+
cache-prefix: opam-env-v9
221+
222+
- name: Compiler build state key
223+
id: compiler-build-state-key
224+
shell: bash
225+
>>>>>>> master
117226
run: |
227+
<<<<<<< HEAD
118228
set -eux
229+
||||||| 5ec125a91
230+
# https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/installer.ts#L33
231+
echo "OPAMVERBOSE=$RUNNER_DEBUG" >> "$GITHUB_ENV"
232+
echo "OPAMCOLOR=always" >> "$GITHUB_ENV"
233+
echo "OPAMCONFIRMLEVEL=unsafe-yes" >> "$GITHUB_ENV"
234+
echo "OPAMERRLOGLEN=0" >> "$GITHUB_ENV"
235+
echo "OPAMPRECISETRACKING=1" >> "$GITHUB_ENV"
236+
echo "OPAMYES=1" >> "$GITHUB_ENV"
237+
=======
238+
echo "value=compiler-build-state-v1-${{ matrix.os }}-${{ steps.setup_ocaml.outputs.setup_version }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('*.opam') }}" \
239+
| sed 's/,/-/g' >> "$GITHUB_OUTPUT"
240+
>>>>>>> master
119241

242+
<<<<<<< HEAD
120243
# Get the GNU multiarch triplet for the current machine.
121244
# Examples:
122245
# x86_64-linux-gnu
123246
# aarch64-linux-gnu
124247
GNU_MULTIARCH="$(gcc -print-multiarch)"
248+
||||||| 5ec125a91
249+
if [[ "$RUNNER_OS" != "Windows" ]]; then
250+
echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV"
251+
else
252+
echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV"
253+
fi
254+
=======
255+
- name: Restore compiler build state
256+
if: github.base_ref == 'master' || github.ref == 'refs/heads/master'
257+
id: compiler-build-state
258+
uses: actions/cache/restore@v6
259+
with:
260+
path: |
261+
C:\.cache\dune
262+
~/.cache/dune
263+
_build
264+
key: ${{ steps.compiler-build-state-key.outputs.value }}
265+
>>>>>>> master
125266

267+
<<<<<<< HEAD
126268
# Convert the GNU triplet into the musl include directory name.
127269
# Examples:
128270
# x86_64-linux-gnu -> x86_64-linux-musl
@@ -184,6 +326,39 @@ jobs:
184326
_build
185327
key: ${{ steps.compiler-build-state-key.outputs.value }}
186328

329+
||||||| 5ec125a91
330+
OPAM_PATH="$(cat .opam-path)"
331+
chmod +x "$OPAM_PATH"
332+
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
333+
334+
if [[ "$RUNNER_OS" == "Windows" ]]; then
335+
fsutil behavior query SymlinkEvaluation
336+
fsutil behavior set symlinkEvaluation R2L:1 R2R:1
337+
fsutil behavior query SymlinkEvaluation
338+
339+
CYGWIN="winsymlinks:native"
340+
CYGWIN_ROOT="D:\\cygwin"
341+
CYGWIN_ROOT_BIN="D:\\cygwin\\bin"
342+
CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin"
343+
344+
echo "HOME=$USERPROFILE" >> "$GITHUB_ENV"
345+
echo "MSYS=winsymlinks:native" >> "$GITHUB_ENV"
346+
echo "CYGWIN=$CYGWIN" >> "$GITHUB_ENV"
347+
echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV"
348+
echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV"
349+
echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV"
350+
351+
echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH"
352+
fi
353+
shell: bash
354+
355+
# see https://github.com/ocaml/setup-ocaml/issues/815
356+
- name: "Windows: set SHELLOPTS=igncr"
357+
if: runner.os == 'Windows'
358+
run: echo "SHELLOPTS=igncr" >>"$GITHUB_ENV"
359+
360+
=======
361+
>>>>>>> master
187362
- name: Build compiler
188363
run: opam exec -- dune build --display quiet
189364

@@ -283,9 +458,31 @@ jobs:
283458
run: make -C tests/gentype_tests/typescript-react-example clean test
284459
shell: bash
285460

461+
<<<<<<< HEAD
286462
- name: Run LSP tests
287463
run: opam exec -- make test-lsp
464+
||||||| 5ec125a91
465+
- name: Run syntax benchmarks
466+
if: matrix.benchmarks
467+
run: ./_build/install/default/bin/syntax_benchmarks | tee tests/benchmark-output.json
468+
=======
469+
- name: Run OCaml rewatch parity tests
470+
if: ${{ !contains(matrix.ocaml_compiler, '5.0.0') }}
471+
timeout-minutes: 20
472+
run: |
473+
. rewatch-ocaml/tests/process_watchdog.sh
474+
start_process_watchdog
475+
bash rewatch-ocaml/tests/check_canonical_test_coverage.sh
476+
bash rewatch-ocaml/tests/check_config_acceptance.sh \
477+
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
478+
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
479+
bash rewatch-ocaml/tests/check_command_validation.sh \
480+
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
481+
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
482+
shell: bash
483+
>>>>>>> master
288484

485+
<<<<<<< HEAD
289486
- name: Run OCaml rewatch parity tests
290487
if: ${{ !contains(matrix.ocaml_compiler, '5.0.0') }}
291488
timeout-minutes: 20
@@ -347,6 +544,75 @@ jobs:
347544
if: matrix.node-target == 'linux-arm64'
348545
run: ./rewatch/tests/suite.sh packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe
349546
shell: bash
547+
||||||| 5ec125a91
548+
- name: Restore previous benchmark data
549+
if: matrix.benchmarks
550+
uses: actions/cache/restore@v4
551+
with:
552+
path: ./tests/benchmark-cache
553+
key: syntax-benchmark-v1
554+
555+
- name: Create new benchmark data and comment on alert
556+
# Do not run for PRs created from other repos as those won't be able to write to the pull request
557+
if: ${{ matrix.benchmarks && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name) }}
558+
uses: benchmark-action/github-action-benchmark@v1
559+
with:
560+
name: Syntax Benchmarks
561+
tool: customSmallerIsBetter
562+
output-file-path: tests/benchmark-output.json
563+
external-data-json-path: ./tests/benchmark-cache/benchmark-data.json
564+
github-token: ${{ secrets.GITHUB_TOKEN }}
565+
alert-threshold: "105%"
566+
comment-always: false
567+
comment-on-alert: true
568+
=======
569+
- name: Run OCaml rewatch interactive output tests
570+
# Terminal rendering depends on the host OS, not the CPU architecture.
571+
# Use the faster ARM runners for one Linux and one macOS check. Windows
572+
# does not provide a reliable native equivalent of the `script` PTY.
573+
if: matrix.node-target == 'linux-arm64' || matrix.node-target == 'darwin-arm64'
574+
timeout-minutes: 15
575+
run: |
576+
bash rewatch-ocaml/tests/check_interactive_output.sh \
577+
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
578+
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
579+
shell: bash
580+
581+
- name: Run OCaml rewatch verbose output tests
582+
if: ${{ !contains(matrix.ocaml_compiler, '5.0.0') }}
583+
timeout-minutes: 10
584+
run: |
585+
bash rewatch-ocaml/tests/check_verbose_output.sh \
586+
packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe \
587+
packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
588+
shell: bash
589+
590+
- name: Run OCaml rewatch unit tests
591+
timeout-minutes: 10
592+
run: |
593+
opam exec -- dune build tests/rewatch_ounit_tests/rewatch_ounit_tests_main.exe
594+
# Run the executable directly so a stuck test leaves live progress;
595+
# dune otherwise buffers the test output until the action exits.
596+
opam exec -- ./_build/default/tests/rewatch_ounit_tests/rewatch_ounit_tests_main.exe -runner sequential
597+
shell: bash
598+
599+
- name: Run OCaml rewatch focused integration tests
600+
timeout-minutes: 30
601+
run: |
602+
sh rewatch-ocaml/tests/run.sh packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
603+
shell: bash
604+
605+
- name: Run OCaml rewatch canonical tests
606+
run: ./rewatch/tests/suite.sh packages/@rescript/${{ matrix.node-target }}/bin/rescript.exe
607+
shell: bash
608+
609+
# The Rust implementation is kept for comparison. One platform runs its
610+
# shared suite; the parity steps exercise it on every platform.
611+
- name: Run Rust rewatch reference tests
612+
if: matrix.node-target == 'linux-arm64'
613+
run: ./rewatch/tests/suite.sh packages/@rescript/${{ matrix.node-target }}/bin/rescript-rust.exe
614+
shell: bash
615+
>>>>>>> master
350616

351617
- name: Build playground compiler
352618
if: matrix.build_playground
@@ -533,6 +799,7 @@ jobs:
533799
artifact-ids: ${{ needs.build-compiler.outputs.api-docs-artifact-id }}
534800
path: data/api
535801

802+
<<<<<<< HEAD
536803
- name: Check if repo is clean
537804
id: diffcheck
538805
run: |
@@ -570,6 +837,48 @@ jobs:
570837
test-installation-npm:
571838
needs:
572839
- pkg-pr-new
840+
||||||| 5ec125a91
841+
installationTest:
842+
needs: package
843+
=======
844+
- name: Check if repo is clean
845+
id: diffcheck
846+
run: |
847+
git status
848+
if [ -z "$(git status --porcelain)" ]; then
849+
echo "clean=true" >> $GITHUB_OUTPUT
850+
else
851+
echo "clean=false" >> $GITHUB_OUTPUT
852+
fi
853+
854+
- name: Use Node.js
855+
if: steps.diffcheck.outputs.clean == 'false'
856+
uses: actions/setup-node@v7
857+
with:
858+
cache: yarn
859+
node-version-file: .node-version
860+
861+
- name: Build website
862+
if: steps.diffcheck.outputs.clean == 'false'
863+
run: |
864+
yarn
865+
yarn build
866+
867+
test-devcontainer:
868+
runs-on: ubuntu-26.04-arm
869+
steps:
870+
- name: Checkout
871+
uses: actions/checkout@v7
872+
- name: Run make in dev container
873+
uses: devcontainers/ci@v0.3
874+
with:
875+
push: never
876+
runCmd: make
877+
878+
test-installation-npm:
879+
needs:
880+
- pkg-pr-new
881+
>>>>>>> master
573882
strategy:
574883
fail-fast: false
575884
matrix:

0 commit comments

Comments
 (0)