From cc418dd2303634a95a8a9ffb405ea70d7dbdc9e6 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sun, 25 Oct 2026 21:40:27 -0700 Subject: [PATCH 1/3] Update CI and development setup to OCaml 5.5 --- .github/workflows/nix.yml | 5 ++-- .github/workflows/opam.yml | 48 +++++++------------------------------- Makefile | 7 +++--- dune-project | 4 ---- flake.lock | 14 +++++------ flake.nix | 6 ++--- reason-react.opam | 4 ---- reason-react.opam.template | 3 --- test/blackbox-tests/dune | 3 ++- test/dune | 1 + 10 files changed, 28 insertions(+), 67 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index e30e48b73..35e1eba94 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -19,6 +19,5 @@ jobs: extra_nix_config: | extra-substituters = https://anmonteiro.nix-cache.workers.dev extra-trusted-public-keys = ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY= - - name: "Run Nix tests" - run: nix build .#reason-react-ppx .#reason-react - + - name: "Build and test with OCaml 5.5" + run: nix build --no-link .#reason-react-ppx .#reason-react diff --git a/.github/workflows/opam.yml b/.github/workflows/opam.yml index e031f9c51..563bfdd14 100644 --- a/.github/workflows/opam.yml +++ b/.github/workflows/opam.yml @@ -3,8 +3,8 @@ name: opam CI on: pull_request: push: - branches: - - main + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -19,12 +19,9 @@ jobs: os: - ubuntu-latest - macos-latest - # - windows-latest - # It seems like dune 3.8 isn't available under opam-repository-mingw for Windows - # disabling this for now ocaml-compiler: - - ocaml-base-compiler.5.4.0 + - ocaml-base-compiler.5.5.2 runs-on: ${{ matrix.os }} @@ -32,35 +29,22 @@ jobs: - name: Checkout code uses: actions/checkout@v6 - - name: Load opam cache when not Windows - if: runner.os != 'Windows' - id: opam-cache - uses: actions/cache/restore@v5 - with: - path: ~/.opam - key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} - - - name: Load opam cache when Windows - if: runner.os == 'Windows' - id: opam-cache-windows - uses: actions/cache/restore@v5 - with: - path: _opam - key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} - - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} - dune-cache: true - name: Use Node.js uses: actions/setup-node@v6 with: node-version: 24 + cache: npm + + - name: Install OCaml dependencies + run: opam install . --deps-only --with-test -y - - name: Install dependencies - run: make install + - name: Install JavaScript dependencies + run: npm ci - name: Build run: make build @@ -70,17 +54,3 @@ jobs: - name: Jest run: make jest - - - name: Save cache when not Windows - uses: actions/cache/save@v5 - if: steps.opam-cache.outputs.cache-hit != 'true' && runner.os != 'Windows' - with: - path: ~/.opam - key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} - - - name: Save cache when Windows - uses: actions/cache/save@v5 - if: steps.opam-cache-windows.outputs.cache-hit != 'true' && runner.os == 'Windows' - with: - path: _opam - key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} diff --git a/Makefile b/Makefile index 4389424e3..6bf1a2a5a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ DUNE = opam exec -- dune +OCAML_VERSION ?= 5.5.2 .PHONY: help help: ## Print this help message @@ -59,11 +60,11 @@ format-check: ## Checks if format is correct .PHONY: install install: ## Update the package dependencies when new deps are added to dune-project @opam install . --deps-only --with-test --with-dev-setup -y - @npm install --force + @npm ci -.PHONY: init +.PHONY: create-switch create-switch: ## Create a local opam switch - @opam switch create . 5.2.0 --no-install -y + @opam switch create . $(OCAML_VERSION) --no-install -y .PHONY: init init: create-switch install ## Create a local opam switch, install deps diff --git a/dune-project b/dune-project index 13a81fbf7..14f795be1 100644 --- a/dune-project +++ b/dune-project @@ -40,10 +40,6 @@ (reason (>= 3.12.0)) (ocaml-lsp-server :with-dev-setup) - (opam-check-npm-deps - (and - :dev - :with-dev-setup)) (ocamlformat (and (= 0.28.1) diff --git a/flake.lock b/flake.lock index bc62ad060..b6873baa1 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1769895423, - "narHash": "sha256-TrMaENJ5V+2zNUGrb6dj11rNiQGaRzu/S79dKeOJVyU=", + "lastModified": 1792972641, + "narHash": "sha256-zN77Jq1yPE3l8pCa65ZFzpzTq3HWC1TPWFTCD5feCOo=", "owner": "nix-ocaml", "repo": "nix-overlays", - "rev": "1ccfa0c4e189b360af5efd4a97bdcdb8ba06c532", + "rev": "75604672d0796836d59060a50dc14dee6a21e226", "type": "github" }, "original": { @@ -20,17 +20,17 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1769857600, - "narHash": "sha256-OD08gxDrlLYQQSKzM1lprIYBbzE69E+p0JYImLUNbHk=", + "lastModified": 1792925778, + "narHash": "sha256-aCg6fAHZszDX68IsLPUm/NQ7ZVXMHk74bjHAIr8K5dM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fbecbb2032376ee9bd3e95c14a3b070cf3f4e079", + "rev": "acc2ec71996e90e6e011fa14979b13cdc070ec79", "type": "github" }, "original": { "owner": "NixOS", "repo": "nixpkgs", - "rev": "fbecbb2032376ee9bd3e95c14a3b070cf3f4e079", + "rev": "acc2ec71996e90e6e011fa14979b13cdc070ec79", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 228d9d89d..809373233 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ let pkgs = nixpkgs.legacyPackages.${system}.extend ( self: super: { - ocamlPackages = super.ocaml-ng.ocamlPackages_5_4; + ocamlPackages = super.ocaml-ng.ocamlPackages_5_5; } ); in @@ -30,7 +30,7 @@ buildDunePackage melange merlin - ppxlib_gt_0_37 + ppxlib reason ; packages = rec { @@ -58,7 +58,7 @@ merlin pkgs.jq ]; - propagatedBuildInputs = [ ppxlib_gt_0_37 ]; + propagatedBuildInputs = [ ppxlib ]; }; reason-react = buildDunePackage { diff --git a/reason-react.opam b/reason-react.opam index fda16342c..3212c6d79 100644 --- a/reason-react.opam +++ b/reason-react.opam @@ -23,7 +23,6 @@ depends: [ "reason-react-ppx" {= version} "reason" {>= "3.12.0"} "ocaml-lsp-server" {with-dev-setup} - "opam-check-npm-deps" {dev & with-dev-setup} "ocamlformat" {= "0.28.1" & with-dev-setup} "odoc" {with-doc} ] @@ -46,6 +45,3 @@ depexts: [ ["react"] {npm-version = "^19.1.0"} ["react-dom"] {npm-version = "^19.1.0"} ] -pin-depends: [ - [ "opam-check-npm-deps.dev" "git+https://github.com/ahrefs/opam-check-npm-deps.git#4.1.0"] -] diff --git a/reason-react.opam.template b/reason-react.opam.template index e6a453ca1..71bb69881 100644 --- a/reason-react.opam.template +++ b/reason-react.opam.template @@ -2,6 +2,3 @@ depexts: [ ["react"] {npm-version = "^19.1.0"} ["react-dom"] {npm-version = "^19.1.0"} ] -pin-depends: [ - [ "opam-check-npm-deps.dev" "git+https://github.com/ahrefs/opam-check-npm-deps.git#4.1.0"] -] diff --git a/test/blackbox-tests/dune b/test/blackbox-tests/dune index 83224c3c1..8840bbc51 100644 --- a/test/blackbox-tests/dune +++ b/test/blackbox-tests/dune @@ -1,4 +1,5 @@ (cram (package reason-react) (deps - (package reason-react))) + (package reason-react) + (package reason-react-ppx))) diff --git a/test/dune b/test/dune index 0dde05c81..be549402e 100644 --- a/test/dune +++ b/test/dune @@ -1,6 +1,7 @@ (melange.emit (alias runtest) (target test) + (package reason-react) (module_systems (commonjs bs.js)) (libraries From 450ea3dc3348cd78ed3a448cf89c8881f3f386bf Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sun, 25 Oct 2026 21:49:01 -0700 Subject: [PATCH 2/3] Restore the existing Nix CI workflow --- .github/workflows/nix.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 35e1eba94..e30e48b73 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -19,5 +19,6 @@ jobs: extra_nix_config: | extra-substituters = https://anmonteiro.nix-cache.workers.dev extra-trusted-public-keys = ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY= - - name: "Build and test with OCaml 5.5" - run: nix build --no-link .#reason-react-ppx .#reason-react + - name: "Run Nix tests" + run: nix build .#reason-react-ppx .#reason-react + From 1daebba96dcbe924690ffb74e08f3556707c3cdc Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sun, 25 Oct 2026 21:52:28 -0700 Subject: [PATCH 3/3] Keep the OCaml upgrade focused on required changes --- .github/workflows/opam.yml | 46 +++++++++++++++++++++++++++++++------- Makefile | 7 +++--- flake.nix | 4 ++-- test/dune | 1 - 4 files changed, 43 insertions(+), 15 deletions(-) diff --git a/.github/workflows/opam.yml b/.github/workflows/opam.yml index 563bfdd14..b1ba2e39c 100644 --- a/.github/workflows/opam.yml +++ b/.github/workflows/opam.yml @@ -3,8 +3,8 @@ name: opam CI on: pull_request: push: - branches: - - main + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -19,6 +19,9 @@ jobs: os: - ubuntu-latest - macos-latest + # - windows-latest + # It seems like dune 3.8 isn't available under opam-repository-mingw for Windows + # disabling this for now ocaml-compiler: - ocaml-base-compiler.5.5.2 @@ -29,22 +32,35 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Load opam cache when not Windows + if: runner.os != 'Windows' + id: opam-cache + uses: actions/cache/restore@v5 + with: + path: ~/.opam + key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} + + - name: Load opam cache when Windows + if: runner.os == 'Windows' + id: opam-cache-windows + uses: actions/cache/restore@v5 + with: + path: _opam + key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} + - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} + dune-cache: true - name: Use Node.js uses: actions/setup-node@v6 with: node-version: 24 - cache: npm - - - name: Install OCaml dependencies - run: opam install . --deps-only --with-test -y - - name: Install JavaScript dependencies - run: npm ci + - name: Install dependencies + run: make install - name: Build run: make build @@ -54,3 +70,17 @@ jobs: - name: Jest run: make jest + + - name: Save cache when not Windows + uses: actions/cache/save@v5 + if: steps.opam-cache.outputs.cache-hit != 'true' && runner.os != 'Windows' + with: + path: ~/.opam + key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} + + - name: Save cache when Windows + uses: actions/cache/save@v5 + if: steps.opam-cache-windows.outputs.cache-hit != 'true' && runner.os == 'Windows' + with: + path: _opam + key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }} diff --git a/Makefile b/Makefile index 6bf1a2a5a..4f3f58500 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ DUNE = opam exec -- dune -OCAML_VERSION ?= 5.5.2 .PHONY: help help: ## Print this help message @@ -60,11 +59,11 @@ format-check: ## Checks if format is correct .PHONY: install install: ## Update the package dependencies when new deps are added to dune-project @opam install . --deps-only --with-test --with-dev-setup -y - @npm ci + @npm install --force -.PHONY: create-switch +.PHONY: init create-switch: ## Create a local opam switch - @opam switch create . $(OCAML_VERSION) --no-install -y + @opam switch create . 5.5.2 --no-install -y .PHONY: init init: create-switch install ## Create a local opam switch, install deps diff --git a/flake.nix b/flake.nix index 809373233..e3df6964f 100644 --- a/flake.nix +++ b/flake.nix @@ -30,7 +30,7 @@ buildDunePackage melange merlin - ppxlib + ppxlib_gt_0_37 reason ; packages = rec { @@ -58,7 +58,7 @@ merlin pkgs.jq ]; - propagatedBuildInputs = [ ppxlib ]; + propagatedBuildInputs = [ ppxlib_gt_0_37 ]; }; reason-react = buildDunePackage { diff --git a/test/dune b/test/dune index be549402e..0dde05c81 100644 --- a/test/dune +++ b/test/dune @@ -1,7 +1,6 @@ (melange.emit (alias runtest) (target test) - (package reason-react) (module_systems (commonjs bs.js)) (libraries