From a72bcfc1847656febde4248359889a4682b994a2 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sun, 25 Oct 2026 21:53:54 -0700 Subject: [PATCH] Simplify CI caching and development setup --- .github/workflows/opam.yml | 46 +++++++------------------------------- Makefile | 7 +++--- flake.nix | 4 ++-- 3 files changed, 14 insertions(+), 43 deletions(-) diff --git a/.github/workflows/opam.yml b/.github/workflows/opam.yml index b1ba2e39c..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,9 +19,6 @@ 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 @@ -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 4f3f58500..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.5.2 --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/flake.nix b/flake.nix index e3df6964f..809373233 100644 --- a/flake.nix +++ b/flake.nix @@ -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 {