Skip to content

Commit 3b228c5

Browse files
Merge branch 'master' into global-completion-config
2 parents 8061577 + 6bb7e0a commit 3b228c5

File tree

614 files changed

+13219
-13693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

614 files changed

+13219
-13693
lines changed

.devcontainer/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ LABEL org.opencontainers.image.description="Docker image for ReScript developmen
44

55
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
66
&& apt-get -y install --no-install-recommends \
7+
yarn \
78
opam \
89
musl-tools \
910
python-is-python3 \

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
*.mli linguist-language=OCaml
33
*.res linguist-language=ReScript
44
*.resi linguist-language=ReScript
5+
6+
.yarn/releases/* binary linguist-vendored

.github/workflows/ci.yml

+53-15
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ jobs:
4545
- name: Checkout
4646
uses: actions/checkout@v4
4747

48+
- name: Use Node.js
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version-file: .nvmrc
52+
4853
- name: Restore build cache
4954
id: build-cache
5055
uses: actions/cache@v4
@@ -109,8 +114,6 @@ jobs:
109114
# Verify that the compiler still builds with older OCaml versions
110115
- os: ubuntu-24.04
111116
ocaml_compiler: ocaml-variants.5.2.1+options,ocaml-option-static
112-
# Reanalyze does not work on OCaml 5.3.0 anymore, therefore run it on 5.2.1
113-
run_reanalyze: true
114117
- os: ubuntu-24.04
115118
ocaml_compiler: ocaml-variants.5.0.0+options,ocaml-option-static
116119
- os: ubuntu-24.04
@@ -137,6 +140,7 @@ jobs:
137140
- name: Use Node.js
138141
uses: actions/setup-node@v4
139142
with:
143+
cache: yarn
140144
node-version-file: .nvmrc
141145

142146
- name: Get artifact dir name
@@ -153,7 +157,7 @@ jobs:
153157
# matrix.ocaml_compiler may contain commas
154158
- name: Get OPAM cache key
155159
shell: bash
156-
run: echo "opam_cache_key=opam-env-v7-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}" | sed 's/,/-/g' >> $GITHUB_ENV
160+
run: echo "opam_cache_key=opam-env-v7-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('*.opam') }}" | sed 's/,/-/g' >> $GITHUB_ENV
157161

158162
- name: Restore OPAM environment
159163
id: cache-opam-env
@@ -191,10 +195,6 @@ jobs:
191195
if: steps.cache-opam-env.outputs.cache-hit != 'true'
192196
run: opam install . --deps-only --with-test
193197

194-
- name: "Install reanalyze"
195-
if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.run_reanalyze
196-
run: opam install reanalyze
197-
198198
- name: Cache OPAM environment
199199
if: steps.cache-opam-env.outputs.cache-hit != 'true'
200200
uses: actions/cache/save@v4
@@ -250,6 +250,24 @@ jobs:
250250
fi
251251
shell: bash
252252

253+
- name: Compiler build state key
254+
id: compiler-build-state-key
255+
shell: bash
256+
run: |
257+
echo "value=compiler-build-state-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('*.opam') }}" \
258+
| sed 's/,/-/g' >> "$GITHUB_OUTPUT"
259+
260+
- name: Restore compiler build state
261+
if: github.base_ref == 'master' || github.ref == 'refs/heads/master'
262+
id: compiler-build-state
263+
uses: actions/cache/restore@v4
264+
with:
265+
path: |
266+
D:\.cache\dune
267+
~/.cache/dune
268+
_build
269+
key: ${{ steps.compiler-build-state-key.outputs.value }}
270+
253271
- name: Build compiler
254272
if: runner.os != 'Linux'
255273
run: opam exec -- dune build --display quiet --profile release
@@ -258,8 +276,30 @@ jobs:
258276
if: runner.os == 'Linux'
259277
run: opam exec -- dune build --display quiet --profile static
260278

279+
- name: Delete stable compiler build state
280+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
281+
shell: bash
282+
run: |
283+
gh extension install actions/gh-actions-cache
284+
gh actions-cache delete ${{ steps.compiler-build-state-key.outputs.value }} \
285+
-R ${{ github.repository }} \
286+
-B ${{ github.ref }} \
287+
--confirm || echo "not exist"
288+
env:
289+
GH_TOKEN: ${{ github.token }}
290+
291+
- name: Save compiler build state
292+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
293+
uses: actions/cache/save@v4
294+
with:
295+
path: |
296+
D:\.cache\dune
297+
~/.cache/dune
298+
_build
299+
key: ${{ steps.compiler-build-state-key.outputs.value }}
300+
261301
- name: Install npm packages
262-
run: npm ci --ignore-scripts
302+
run: yarn install
263303

264304
- name: Copy compiler exes to platform bin dir
265305
run: node ./scripts/copyExes.js -compiler
@@ -305,10 +345,6 @@ jobs:
305345
if: ${{ runner.os == 'Windows' }}
306346
run: opam exec -- make test-syntax
307347

308-
- name: "Syntax: Run reanalyze"
309-
if: matrix.run_reanalyze
310-
run: opam exec -- make reanalyze
311-
312348
- name: Build runtime/stdlib
313349
run: ./scripts/buildRuntime.sh
314350
shell: bash
@@ -370,11 +406,11 @@ jobs:
370406
run: |
371407
opam exec -- node packages/playground-bundling/scripts/generate_cmijs.js
372408
opam exec -- dune build --profile browser
373-
cp ./_build/default/compiler/jsoo/jsoo_playground_main.bc.js playground/compiler.js
409+
cp ./_build/default/compiler/jsoo/jsoo_playground_main.bc.js playground/compiler.cjs
374410
375411
- name: Test playground compiler
376412
if: matrix.build_playground
377-
run: node playground/playground_test.js
413+
run: node playground/playground_test.cjs
378414

379415
- name: Upload playground compiler to CDN
380416
if: ${{ matrix.build_playground && startsWith(github.ref, 'refs/tags/v') }}
@@ -411,10 +447,11 @@ jobs:
411447
- name: Use Node.js
412448
uses: actions/setup-node@v4
413449
with:
450+
cache: yarn
414451
node-version-file: .nvmrc
415452

416453
- name: NPM install
417-
run: npm ci --ignore-scripts
454+
run: yarn install
418455

419456
- name: Download artifacts
420457
uses: actions/download-artifact@v4
@@ -505,6 +542,7 @@ jobs:
505542
- name: Use Node.js
506543
uses: actions/setup-node@v4
507544
with:
545+
cache: yarn
508546
node-version-file: .nvmrc
509547
registry-url: https://registry.npmjs.org # Needed to make auth work for publishing
510548

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const fs = require("fs");
2-
const os = require("os");
1+
import * as fs from "node:fs";
2+
import * as os from "node:os";
33

4-
const { dirName: artifactDirName } = require("../../cli/bin_path.js");
4+
import { platformName } from "#cli/bins";
55

66
// Pass artifactDirName to subsequent GitHub actions
77
fs.appendFileSync(
88
process.env.GITHUB_ENV,
9-
`artifact_dir_name=${artifactDirName}${os.EOL}`,
9+
`artifact_dir_name=${platformName}${os.EOL}`,
1010
);

.github/workflows/prepare_package_upload.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
const fs = require("fs");
2-
const os = require("os");
1+
import * as fs from "node:fs";
2+
import * as os from "node:os";
3+
4+
import packageSpec from "rescript/package.json" with { type: "json" };
35

4-
const packageSpec = require("rescript/package.json");
56
const { version } = packageSpec;
67

78
const commitHash = process.argv[2] || process.env.GITHUB_SHA;

.gitignore

+10-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ playground/stdlib/
7272
playground/*.cmj
7373
playground/*.cmi
7474
playground/.netrc
75-
playground/compiler.js
75+
playground/compiler.*js
7676

7777
rewatch/target/
7878
rewatch/rewatch
@@ -81,3 +81,12 @@ tests/tools_tests/**/*.res.js
8181
tests/tools_tests/lib
8282
tests/analysis_tests*/lib
8383
tests/analysis_tests/**/*.bs.js
84+
85+
.yarn/*
86+
!.yarn/patches
87+
!.yarn/plugins
88+
!.yarn/releases
89+
!.yarn/sdks
90+
!.yarn/versions
91+
92+
*.tsbuildinfo

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20

0 commit comments

Comments
 (0)