From d99fb7bb7ee4c90aee6652d57a7b332f26222619 Mon Sep 17 00:00:00 2001 From: Trent Small Date: Fri, 12 Jan 2024 11:02:45 -0700 Subject: [PATCH] Add GitHub action for building/testing --- .github/workflows/run-tests.yml | 40 +++++++++++++++++++++++++++++++++ dune-project | 6 ++++- middleware.opam | 3 ++- 3 files changed, 47 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..143236e --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,40 @@ +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.1" + include: + - ocaml-compiler: "5.1.1" + os: macos-latest + - ocaml-compiler: "5.1.1" + os: ubuntu-latest + + 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..5bd407d 100644 --- a/dune-project +++ b/dune-project @@ -17,7 +17,11 @@ (package (name middleware) (synopsis "Composable stacked functions, which can respond to inner calls") - (depends ocaml dune) + (depends + (ocaml (>= 4.14.0)) + (alcotest (and :with-test (>= 1.7.0))) + dune + ) (tags (middleware composition funciton))) diff --git a/middleware.opam b/middleware.opam index 3f8cc2b..6a7de1d 100644 --- a/middleware.opam +++ b/middleware.opam @@ -9,7 +9,8 @@ tags: ["middleware" "composition" "funciton"] homepage: "https://github.com/skolemlabs/midddleware" bug-reports: "https://github.com/skolemlabs/midddleware/issues" depends: [ - "ocaml" + "ocaml" {>= "4.14.0"} + "alcotest" {with-test & >= "1.7.0"} "dune" {>= "3.11"} "odoc" {with-doc} ]