Skip to content

Commit 87dc9cf

Browse files
authored
Remove Esy (#569)
* remove esy * fix * fix * log files modified * gitignore opam dir
1 parent 9318d4f commit 87dc9cf

12 files changed

Lines changed: 275 additions & 105 deletions

File tree

.github/workflows/bindings.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@ jobs:
2020
node-version: 20
2121
env:
2222
CI: true
23-
- name: Install esy
24-
run: npm install -g esy@latest
25-
- name: Install and build PPX dependencies
23+
- name: Set up OCaml
24+
uses: ocaml/setup-ocaml@v3
25+
with:
26+
ocaml-compiler: "4.14"
27+
dune-cache: true
28+
cache-prefix: "v1"
29+
- name: Install PPX dependencies
2630
working-directory: packages/rescript-relay/rescript-relay-ppx
27-
run: esy install
31+
run: opam install . --deps-only
2832
- name: Build PPX
2933
working-directory: packages/rescript-relay/rescript-relay-ppx
30-
run: esy build
34+
run: opam exec -- dune build bin/RescriptRelayPpxApp.exe
3135
- name: Install
3236
run: |
3337
yarn --frozen-lockfile

.github/workflows/build-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-linux
4848
- name: Strip binary
4949
run: |
50+
chmod +w ppx-linux
5051
strip ppx-linux
5152
- name: Upload PPX artifact
5253
uses: actions/upload-artifact@v4
@@ -84,6 +85,7 @@ jobs:
8485
if: runner.os != 'Windows'
8586
working-directory: packages/rescript-relay/rescript-relay-ppx
8687
run: |
88+
chmod +w _build/default/bin/RescriptRelayPpxApp.exe
8789
strip _build/default/bin/RescriptRelayPpxApp.exe
8890
- name: Copy built PPX file
8991
working-directory: packages/rescript-relay/rescript-relay-ppx

.github/workflows/integration-tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ jobs:
2323
with:
2424
toolchain: 1.76.0
2525
override: true
26-
- name: Install esy
27-
run: npm install -g esy@latest
28-
- name: Install and build PPX dependencies
26+
- name: Set up OCaml
27+
uses: ocaml/setup-ocaml@v3
28+
with:
29+
ocaml-compiler: "4.14"
30+
dune-cache: true
31+
cache-prefix: "v1"
32+
- name: Install PPX dependencies
2933
working-directory: packages/rescript-relay/rescript-relay-ppx
30-
run: esy install
34+
run: opam install . --deps-only
3135
- name: Build PPX
3236
working-directory: packages/rescript-relay/rescript-relay-ppx
33-
run: esy build
37+
run: opam exec -- dune build bin/RescriptRelayPpxApp.exe
3438
- name: Install - bindings
3539
working-directory: packages/rescript-relay
3640
run: |
@@ -45,6 +49,8 @@ jobs:
4549
echo "::set-output name=status::$( git status --porcelain )"
4650
- name: Exit if files modified
4751
run: |
52+
echo "Files have been modified during the build process:"
53+
echo "${{ steps.git_status.outputs.status }}"
4854
exit 1
4955
if: steps.git_status.outputs.status
5056
- name: Build - bindings

.github/workflows/ppx.yml

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,73 +12,62 @@ jobs:
1212
matrix:
1313
platform: [ubuntu-latest]
1414

15-
name: PPX
15+
name: PPX Linux
1616
runs-on: ${{ matrix.platform }}
17-
defaults:
18-
run:
19-
working-directory: packages/rescript-relay/rescript-relay-ppx
20-
container:
21-
image: alexfedoseev/alpine-node-yarn-esy:0.0.9
2217
steps:
2318
- uses: actions/checkout@v4
24-
- uses: actions/setup-node@v4
25-
with:
26-
node-version: 20.x
27-
env:
28-
CI: true
29-
- name: Esy install
30-
run: esy install
31-
- name: Print esy cache
32-
id: print_esy_cache
33-
run: node $GITHUB_WORKSPACE/.github/workflows/print_esy_cache.js
34-
- name: Try to restore dependencies cache
35-
uses: actions/cache@v4
36-
id: deps-cache
19+
- name: Set up OCaml
20+
uses: ocaml/setup-ocaml@v3
3721
with:
38-
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
39-
key: ${{ matrix.platform }}---v1${{ hashFiles('**/index.json') }}
40-
restore-keys: |
41-
${{ matrix.platform }}---v1
22+
ocaml-compiler: "4.14"
23+
dune-cache: true
24+
cache-prefix: "v1"
25+
- name: Install dependencies
26+
working-directory: packages/rescript-relay/rescript-relay-ppx
27+
run: opam install . --deps-only
4228
- name: Build PPX
43-
run: esy linux-release-static
44-
- name: Copy built PPX file
29+
working-directory: packages/rescript-relay/rescript-relay-ppx
4530
run: |
31+
opam exec -- dune build --profile release-static bin/RescriptRelayPpxApp.exe
4632
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-linux
4733
- name: Strip binary
34+
working-directory: packages/rescript-relay/rescript-relay-ppx
4835
run: |
36+
chmod +w ppx-linux
4937
strip ppx-linux
5038
- name: Upload PPX artifact
5139
uses: actions/upload-artifact@v4
5240
with:
5341
name: ppx-${{ matrix.platform }}
5442
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
5543
if-no-files-found: error
44+
5645
ppx:
5746
strategy:
5847
matrix:
5948
platform: [macos-latest, windows-latest]
6049

6150
name: PPX
6251
runs-on: ${{ matrix.platform }}
63-
defaults:
64-
run:
65-
working-directory: packages/rescript-relay/rescript-relay-ppx
6652
steps:
6753
- uses: actions/checkout@v4
68-
- uses: actions/setup-node@v4
54+
- name: Set up OCaml
55+
uses: ocaml/setup-ocaml@v3
6956
with:
70-
node-version: 20.x
71-
env:
72-
CI: true
73-
- name: Install esy
74-
run: npm install -g esy@latest
75-
- name: Install and build dependencies
76-
run: esy install
57+
ocaml-compiler: "4.14"
58+
dune-cache: true
59+
cache-prefix: "v1"
60+
- name: Install dependencies
61+
working-directory: packages/rescript-relay/rescript-relay-ppx
62+
run: opam install . --deps-only
7763
- name: Build PPX
78-
run: esy build
64+
working-directory: packages/rescript-relay/rescript-relay-ppx
65+
run: opam exec -- dune build bin/RescriptRelayPpxApp.exe
7966
- name: Strip PPX binary
8067
if: runner.os != 'Windows'
68+
working-directory: packages/rescript-relay/rescript-relay-ppx
8169
run: |
70+
chmod +w _build/default/bin/RescriptRelayPpxApp.exe
8271
strip _build/default/bin/RescriptRelayPpxApp.exe
8372
- name: Upload PPX artifact ${{ matrix.platform }}
8473
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules
55
_build
66
_esy
77
_release
8+
_opam
89
*.byte
910
*.native
1011
*.install
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
.merlin
22
node_modules/
33
_build
4-
_esy
5-
_release
4+
_opam
65
*.byte
76
*.native
87
*.install
98
**/.merlin
9+
# Built binaries
10+
ppx-*
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# ReScript Relay PPX Makefile
2+
3+
.PHONY: help deps build clean rebuild test dev-setup build-release check env
4+
5+
# Default target - just build the binary like before
6+
all: build
7+
8+
# Show help
9+
help:
10+
@echo "ReScript Relay PPX Build Commands:"
11+
@echo ""
12+
@echo "Main Commands:"
13+
@echo " build - Build the PPX executable (default)"
14+
@echo " rebuild - Clean and build from scratch"
15+
@echo " clean - Clean build artifacts"
16+
@echo ""
17+
@echo "Setup:"
18+
@echo " dev-setup - Set up development environment (OCaml 4.14 + dependencies)"
19+
@echo " deps - Install project dependencies only"
20+
@echo ""
21+
@echo "Release:"
22+
@echo " build-release - Build with release profile"
23+
@echo ""
24+
@echo "Utilities:"
25+
@echo " check - Check if binary builds and works"
26+
@echo " env - Show current OCaml environment"
27+
@echo " test - Run tests (if any)"
28+
@echo ""
29+
30+
# Development setup - ensures we have the right OCaml version and dependencies
31+
dev-setup:
32+
@echo "Setting up development environment..."
33+
@if ! opam switch list | grep -q "4.14"; then \
34+
echo "Installing OCaml 4.14.0..."; \
35+
opam switch create 4.14.0 4.14.0; \
36+
fi
37+
@echo "Switching to OCaml 4.14.0..."
38+
@opam switch 4.14.0
39+
@eval $$(opam env)
40+
@echo "Installing dependencies..."
41+
@opam install . --deps-only --yes
42+
@echo "Development environment ready!"
43+
44+
# Install dependencies only
45+
deps:
46+
@echo "Installing project dependencies..."
47+
@opam install . --deps-only --yes
48+
49+
# Build the project - produces binary at _build/default/bin/RescriptRelayPpxApp.exe
50+
build:
51+
@echo "Building PPX..."
52+
@opam exec -- dune build bin/RescriptRelayPpxApp.exe
53+
@echo "✓ PPX binary built at: _build/default/bin/RescriptRelayPpxApp.exe"
54+
55+
# Build release version
56+
build-release:
57+
@echo "Building PPX in release mode..."
58+
@opam exec -- dune build --profile release bin/RescriptRelayPpxApp.exe
59+
@echo "✓ Release binary built at: _build/default/bin/RescriptRelayPpxApp.exe"
60+
61+
# Clean build artifacts
62+
clean:
63+
@echo "Cleaning build artifacts..."
64+
@opam exec -- dune clean
65+
@echo "Clean complete!"
66+
67+
# Clean and rebuild
68+
rebuild: clean build
69+
70+
# Run tests (placeholder for when tests are added)
71+
test:
72+
@echo "Running tests..."
73+
@if [ -d "__tests__" ]; then \
74+
echo "No test runner configured yet"; \
75+
else \
76+
echo "No tests found"; \
77+
fi
78+
79+
# Check if the binary builds and works
80+
check:
81+
@echo "Checking PPX build..."
82+
@opam exec -- dune build bin/RescriptRelayPpxApp.exe
83+
@echo "✓ Build successful"
84+
@if [ -f "_build/default/bin/RescriptRelayPpxApp.exe" ]; then \
85+
echo "✓ Binary available at: _build/default/bin/RescriptRelayPpxApp.exe"; \
86+
_build/default/bin/RescriptRelayPpxApp.exe --help | head -1; \
87+
else \
88+
echo "✗ Binary not found"; \
89+
exit 1; \
90+
fi
91+
92+
# Show current OCaml environment
93+
env:
94+
@echo "Current OCaml environment:"
95+
@echo "OCaml version: $$(ocaml --version)"
96+
@echo "Opam switch: $$(opam switch show)"
97+
@echo "Dune version: $$(opam exec -- dune --version)"

0 commit comments

Comments
 (0)