From 447f46b45b2b4504a6f998fcc6c1589e307f58c5 Mon Sep 17 00:00:00 2001
From: Trent Small <trent.small@skolem.com>
Date: Fri, 12 Jan 2024 11:02:45 -0700
Subject: [PATCH] Add GitHub action for building/testing

---
 .github/workflows/run-tests.yml | 36 +++++++++++++++++++++++++++++++++
 dune-project                    |  5 ++++-
 middleware.opam                 |  2 +-
 3 files changed, 41 insertions(+), 2 deletions(-)
 create mode 100644 .github/workflows/run-tests.yml

diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
new file mode 100644
index 0000000..ed123e1
--- /dev/null
+++ b/.github/workflows/run-tests.yml
@@ -0,0 +1,36 @@
+name: Run tests
+
+on:
+  pull_request:
+
+permissions: read-all
+
+jobs:
+  build:
+    strategy:
+      fail-fast: false
+      matrix:
+        os:
+          - macos-latest
+          - ubuntu-latest
+          - windows-latest
+        ocaml-compiler:
+          - "4.14"
+          - "5.1"
+
+    runs-on: ${{ matrix.os }}
+
+    steps:
+      - name: Checkout tree
+        uses: actions/checkout@v4
+
+      - name: Set-up OCaml ${{ matrix.ocaml-compiler }}
+        uses: ocaml/setup-ocaml@v2
+        with:
+          ocaml-compiler: ${{ matrix.ocaml-compiler }}
+
+      - run: opam install . --deps-only --with-test
+
+      - run: opam exec -- dune build
+
+      - run: opam exec -- dune runtest
diff --git a/dune-project b/dune-project
index 107d6b8..d9ef7d4 100644
--- a/dune-project
+++ b/dune-project
@@ -17,7 +17,10 @@
 (package
  (name middleware)
  (synopsis "Composable stacked functions, which can respond to inner calls")
- (depends ocaml dune)
+ (depends
+  (ocaml (>= 4.14.0))
+  dune
+ )
  (tags
   (middleware composition funciton)))
 
diff --git a/middleware.opam b/middleware.opam
index 3f8cc2b..e840faa 100644
--- a/middleware.opam
+++ b/middleware.opam
@@ -9,7 +9,7 @@ tags: ["middleware" "composition" "funciton"]
 homepage: "https://github.com/skolemlabs/midddleware"
 bug-reports: "https://github.com/skolemlabs/midddleware/issues"
 depends: [
-  "ocaml"
+  "ocaml" {>= "4.14.0"}
   "dune" {>= "3.11"}
   "odoc" {with-doc}
 ]