Skip to content

Compile runtime with rewatch and add rewatch tests to the compiler repo #7422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
43b1196
change config
jfrolich May 3, 2025
4a0de83
still need -make-runtime
jfrolich May 3, 2025
f68c527
add make lib-rewatch
jfrolich May 4, 2025
4102492
update rewatch
jfrolich May 4, 2025
dbcedd2
test rewatch in Makefile
jfrolich May 4, 2025
c723cb0
test
jfrolich May 4, 2025
6c756ab
add install state
jfrolich May 4, 2025
373417d
upstream new version of rewatch
jfrolich May 5, 2025
4706c4b
make it work!
jfrolich May 5, 2025
6a8d721
make rewatch default for building the runtime
jfrolich May 5, 2025
7be0619
run rewatch tests
jfrolich May 5, 2025
73105c7
see error
jfrolich May 5, 2025
5a1a786
install packages as part of the ci test suite
jfrolich May 5, 2025
ed60167
cat the changes
jfrolich May 5, 2025
c5e39b1
empty commit
jfrolich May 5, 2025
f6319c8
immutable install
jfrolich May 5, 2025
46b14c8
remove install state
jfrolich May 5, 2025
f2c7988
install state ignore
jfrolich May 5, 2025
1484c3f
run on mac os due to subtle diffs
jfrolich May 5, 2025
59edb1a
fix
jfrolich May 5, 2025
e77b6a7
use ci version of rescript
jfrolich May 5, 2025
c32740c
fix diff
jfrolich May 5, 2025
df352ea
trigger
jfrolich May 5, 2025
b597700
fix
jfrolich May 5, 2025
e7af0b9
show rescript version
jfrolich May 5, 2025
e1c36d0
update snapshots
jfrolich May 5, 2025
88e8b61
end to end tests
jfrolich May 5, 2025
3ff6cb0
fix
jfrolich May 5, 2025
8a397d1
fix
jfrolich May 5, 2025
8925187
fix
jfrolich May 5, 2025
1fcde23
propagate bsc path
jfrolich May 5, 2025
69d0089
fix
jfrolich May 5, 2025
d191e3b
empty commit
jfrolich May 5, 2025
e05a6a5
don't run unit tests if we don't build a new rewatch binary
jfrolich May 5, 2025
175cffd
other instance
jfrolich May 5, 2025
89316aa
empty commit
jfrolich May 5, 2025
391f785
find correct bsc
jfrolich May 8, 2025
aced9b1
if the lockfile is deleted, stop running the watcher
jfrolich May 8, 2025
5d0e318
fix lock tests
jfrolich May 8, 2025
408e082
More informative test
jfrolich May 8, 2025
78f16af
fix watch
jfrolich May 8, 2025
71b39d4
make tests work correctly
jfrolich May 8, 2025
c772dd9
fix
jfrolich May 8, 2025
d3809a9
upstream changes
jfrolich May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,32 @@ env:
OCAMLRUNPARAM: b

jobs:
test-rewatch-integration:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a real integration test of both rewatch + bsc packaged up in the test repo, to make sure it works end to end

needs:
- pkg-pr-new
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: "1"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install ReScript package
run: |
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
shell: bash
working-directory: rewatch/testrepo

- name: Run rewatch integration tests
run: |
make test-rewatch-ci
build-rewatch:
strategy:
fail-fast: false
Expand Down Expand Up @@ -78,6 +104,11 @@ jobs:
run: |
cargo build --manifest-path rewatch/Cargo.toml --target ${{ matrix.rust-target }} --release
- name: Run rewatch unit tests
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
cargo test --manifest-path rewatch/Cargo.toml
- name: Copy rewatch binary
run: |
cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch.exe
Expand Down Expand Up @@ -440,7 +471,7 @@ jobs:
path: lib/ocaml

pkg-pr-new:
needs:
needs:
- build-rewatch
- build-compiler
runs-on: ubuntu-24.04-arm
Expand Down
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dce:
reanalyze.exe -dce-cmt _build/default/compiler

rewatch:
cargo build --manifest-path rewatch/Cargo.toml
cp rewatch/target/debug/rewatch rewatch
cargo build --manifest-path rewatch/Cargo.toml --release
cp rewatch/target/release/rewatch rewatch
./scripts/copyExes.js --rewatch

ninja/ninja:
Expand Down Expand Up @@ -46,15 +46,25 @@ test-syntax-roundtrip:
test-gentype:
make -C tests/gentype_tests/typescript-react-example clean test

test-all: test test-gentype test-analysis test-tools
test-rewatch:
bash ./rewatch/tests/suite-ci.sh

test-rewatch-ci:
bash ./rewatch/tests/suite-ci.sh node_modules/.bin/rewatch

test-all: test test-gentype test-analysis test-tools test-rewatch

reanalyze:
reanalyze.exe -set-exit-code -all-cmt _build/default/compiler _build/default/tests -exclude-paths compiler/outcome_printer,compiler/ml,compiler/frontend,compiler/ext,compiler/depends,compiler/core,compiler/common,compiler/cmij,compiler/bsb_helper,compiler/bsb

lib:
lib-bsb:
./scripts/buildRuntime.sh
./scripts/prebuilt.js

lib:
./scripts/buildRuntimeRewatch.sh
./scripts/prebuilt.js

artifacts: lib
./scripts/npmPack.js --updateArtifactList

Expand Down
6 changes: 4 additions & 2 deletions cli/rewatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
// @ts-check

import * as child_process from "node:child_process";
import { rewatch_exe } from "./common/bins.js";
import { rewatch_exe, bsc_exe } from "./common/bins.js";

const args = process.argv.slice(2);

child_process.spawnSync(rewatch_exe, args, { stdio: "inherit" });
child_process.spawnSync(rewatch_exe, [...args, "--bsc-path", bsc_exe], {
stdio: "inherit",
});
4 changes: 4 additions & 0 deletions rewatch/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
build-m1-release = "RUSTFLAGS=\"-C target-cpu=apple-m1\" cargo build --release"
build-docs = "cargo doc --no-deps --document-private-items --target-dir ./docs"

3 changes: 3 additions & 0 deletions rewatch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
.DS_Store
/docs
Loading
Loading