diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9e21e27bb..e694ec7e9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,18 +1,7 @@ -FROM node:lts AS node -FROM ocaml/opam:debian-10-ocaml-4.14 +FROM ocaml/opam:debian-12-ocaml-5.4 USER root -# copy node from node container and link commands -COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules -COPY --from=node /usr/local/bin/node /usr/local/bin/node -COPY --from=node /opt /opt -RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ - && ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \ - && ln -s /usr/local/bin/node /usr/local/bin/nodejs \ - && ln -s /opt/yarn-v*/bin/yarn /usr/local/bin/yarn \ - && ln -s /opt/yarn-v*/bin/yarnpkg /usr/local/bin/yarnpkg - # copy hadolint COPY --from=hadolint/hadolint:latest-alpine /bin/hadolint /bin/hadolint @@ -51,7 +40,7 @@ RUN bash -c 'echo "http 80/tcp www # WorldWideWeb HTTP" >> /etc/services' \ && bash -c 'echo "https 443/tcp www # WorldWideWeb HTTPS" >> /etc/services' # link opam version -RUN ln -fs /usr/bin/opam-2.2 /usr/bin/opam +RUN ln -fs /usr/bin/opam-2.3 /usr/bin/opam USER opam diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 1d2a8900e..e10c2d205 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -25,3 +25,7 @@ There is an `Adminer` container added to the development package. To be able to 1. Uncomment its line in the `.devcontainer/devcontainer.json` under `runServices` 1. Use `Remote-Containers: Rebuild Container` that it will also create and startup the `Adminer` container 1. Open your web browser and open `localhost:8080` + +## NOTE + +Installation of packages will downgrade `ocaml-compiler` to version `5.3.0` as of `ppxlib` used by `tyxml-ppx` has currently it's upper bound to `< 5.4.0` (PR in progress: ) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d1e9521ea..4454d7d21 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,12 +25,14 @@ }, "terminal.integrated.defaultProfile.linux": "zsh", "editor.formatOnSave": true, + "files.insertFinalNewline": true, "files.associations": { "*.ml": "ocaml", "*.mli": "ocaml" }, "ocaml.sandbox": { - "kind": "global" + "kind": "opam", + "switch": "5.4.0" } }, // Add the IDs of extensions you want installed when the container is created in the array below. diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 326714386..0b18d7a57 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -8,7 +8,6 @@ services: volumes: # default user is "opam" - ..:/workspace:cached - - node_modules:/workspace/node_modules:cached - opam:/home/opam/.opam:cached - build:/workspace/_build:cached - ${HOME}${USERPROFILE}/.ssh:/home/opam/.ssh @@ -62,5 +61,4 @@ services: volumes: opam: - node_modules: build: diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index 9f7b47ba3..539547e48 100644 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -4,26 +4,8 @@ set -ex sudo chown -R opam: _build -sudo chown -R opam: node_modules opam init -a --shell=zsh - -# get newest opam packages -opam remote remove --all default -opam remote add default https://opam.ocaml.org - -# TODO: remove pins when the packages are released -opam pin add -yn opium https://github.com/mabiede/opium.git#upgrade-packages -opam pin add -yn rock https://github.com/mabiede/opium.git#upgrade-packages - -# install dev dependencies -opam install --yes --with-doc --with-test --deps-only --working-dir . - eval $(opam env) -# install opam packages used for vscode ocaml platform package -# e.g. when developing with emax, add also: utop merlin ocamlformat make deps - -# install yarn packages -yarn diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2dff87c1..fc08a3eda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: - ubuntu-latest ocaml-compiler: - 4.14 + - 5.3 + - 5.4 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index 95af68486..27ff84b86 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,7 @@ all: .PHONY: deps deps: - opam install -y dune-release merlin ocamlformat utop - opam install -y alcotest-lwt mariadb.1.1.6 caqti-driver-postgresql.2.0.1 caqti-driver-mariadb.2.0.1 - opam install . -y --deps-only --locked + opam install --yes --with-doc --with-test --with-dev-setup --working-dir --update-invariant . eval $(opam env) .PHONY: create_switch @@ -44,7 +42,7 @@ clean: ## Clean build artifacts and other generated files opam exec -- dune clean --root . .PHONY: format -format: build ## Format the codebase with ocamlformat +format: ## Format the codebase with ocamlformat opam exec -- dune build --root . --auto-promote @fmt .PHONY: sihl diff --git a/README.md b/README.md index 3cc5b052c..e6040f922 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ * [Contact](#contact) * [Acknowledgements](#acknowledgements) -## About +## About *Note that even though Sihl is being used in production, the API is still under active development.* @@ -44,7 +44,7 @@ Sihl is a batteries-included web framework built on top of [Opium](https://githu Checkout the [getting started](https://oxidizing.github.io/sihl/sihl/index.html#getting-started) section of the documentation. -If you want to jump into code have a look at the [demo project](https://github.com/oxidizing/sihl-demo). +If you want to jump into code have a look at the [demo project](https://github.com/oxidizing/sihl-demo). ## Background @@ -68,43 +68,43 @@ OCaml itself ensures a certain level of correctness at compile-time. In order to These are some of things that Sihl can take care of for you. -- Database handling (pooling, transactions, migrations) -- Configuration (from env variables to configuration services) -- Logging -- User management -- Token management -- Session management -- HTTP routes & middlewares -- Flash Messages -- Authentication -- Authorization -- Emailing -- CLI Commands -- Job Queue -- Schedules -- Block Storage +* Database handling (pooling, transactions, migrations) +* Configuration (from env variables to configuration services) +* Logging +* User management +* Token management +* Session management +* HTTP routes & middlewares +* Flash Messages +* Authentication +* Authorization +* Emailing +* CLI Commands +* Job Queue +* Schedules +* Block Storage ### Do we need another web framework? Yes, because all other frameworks have not been invented here! -On a more serious note, originally we wanted to collect a set of services, libraries, best practices and architecture to quickly and sustainably spin-off our own tools and products. +On a more serious note, originally we wanted to collect a set of services, libraries, best practices and architecture to quickly and sustainably spin-off our own tools and products. An evaluation of languages and tools lead us to build the 5th iteration of what became Sihl with OCaml. We believe OCaml is a phenomenal place to build web apps. Thanks to OCaml, Sihl ... -* ... runs fast -* ... compiles fast +* ... runs fast +* ... compiles fast * ... is pragmatic and safe * ... is fun to use ## Documentation -The API documentation for the latest version can be found here: https://oxidizing.github.io/sihl +The API documentation for the latest version can be found here: ## Ecosystem -- https://github.com/uzh/ask +* ## Roadmap @@ -122,6 +122,6 @@ Distributed under the MIT License. See `LICENSE` for more information. ## Contact -Oxidizing Systems - [@oxidizingsys](https://twitter.com/oxidizingsys) - hello@oxidizing.io +Oxidizing Systems - [@oxidizingsys](https://twitter.com/oxidizingsys) - Project Link: [https://github.com/oxidizing/sihl](https://github.com/oxidizing/sihl) diff --git a/default.nix b/default.nix index c3f7b75ff..84bfff091 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,7 @@ with import { }; mkShell { - buildInputs = [ yarn zlib.dev zlib.out zlib zlib.all gmp gmp.dev pkg-config openssl libev libevdev mariadb-client mariadb-connector-c postgresql ]; + buildInputs = [ zlib.dev zlib.out zlib zlib.all gmp gmp.dev pkg-config openssl libev libevdev mariadb-client mariadb-connector-c postgresql ]; LD_LIBRARY_PATH = "${mariadb-connector-c}/lib/mariadb"; shellHook = "eval $(opam env)"; } diff --git a/dune-project b/dune-project index 793acf66a..cba305f71 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,4 @@ -(lang dune 2.7) +(lang dune 3.0) (generate_opam_files true) @@ -28,76 +28,78 @@ "\nSihl is a batteries-included web framework. Thanks to the modular architecture, included batteries can be swapped out easily. Statically typed functional programming with OCaml makes web development fun, fast and safe. Sihl supports PostgreSQL and MariaDB.\n") (depends dune - (ocaml - (>= 4.12.0)) - (conformist - (>= 0.8.1)) - (dune-build-info - (>= 2.8.4)) - (tsort - (>= 2.0.0)) - (containers - (>= 3.6.1)) - (logs - (>= 0.7.0)) - (fmt - (>= 0.8.8)) + (alcotest-lwt + (and + (>= 1.4.0) + :with-test)) (bos (>= 0.2.0)) - (sexplib - (>= v0.13.0)) - (yojson - (>= 1.7.0)) - (ppx_deriving_yojson - (>= 3.5.2)) - (tls - (>= 1.0.4)) - (ssl - (>= 0.5.9)) - (lwt_ssl - (>= 1.1.3)) - (lwt_ppx - (>= 2.0.1)) (caqti (>= 2.0.1)) + (caqti-driver-mariadb + (and + (>= 2.0.1) + :with-test)) + (caqti-driver-postgresql + (and + (>= 2.0.1) + :with-test)) (caqti-lwt (>= 2.0.1)) - (safepass - (>= 3.0)) + (cohttp-lwt-unix + (and + (>= 2.5.4) + :with-test)) + (conformist + (>= 0.8.1)) + (containers + (>= 3.6.1)) + (dune-build-info + (>= 2.8.4)) + (fmt + (>= 0.8.8)) (jwto (>= 0.3.0)) - (uuidm - (>= 0.9.9)) - (ppx_fields_conv - (>= v0.13.0)) - (ppx_sexp_conv - (>= v0.13.0)) + (logs + (>= 0.7.0)) + (lwt_ppx + (>= 2.0.1)) + (lwt_ssl + (>= 1.1.3)) + (mariadb + (>= 1.1.6)) (mirage-crypto (>= 1.1.0)) (mirage-crypto-rng (>= 1.2.0)) - (cstruct - (>= 6.0.1)) + (ocaml + (>= 4.12.0)) + (ocaml-lsp-server :with-dev-setup) + (ocamlformat :with-dev-setup) (opium (>= 0.20.0)) - (cohttp-lwt-unix - (and - (>= 2.5.4) - :with-test)) - (alcotest-lwt - (and - (>= 1.4.0) - :with-test)) - (mariadb - (>= 1.1.6)) - (caqti-driver-postgresql - (and - (>= 2.0.1) - :with-test)) - (caqti-driver-mariadb - (and - (>= 2.0.1) - :with-test)))) + (rock + (>= 0.20.0)) + (ppx_deriving_yojson + (>= 3.5.2)) + (ppx_fields_conv + (>= v0.13.0)) + (ppx_sexp_conv + (>= v0.13.0)) + (safepass + (>= 3.0)) + (sexplib + (>= v0.13.0)) + (ssl + (>= 0.5.9)) + (tls + (>= 1.0.4)) + (tsort + (>= 2.0.0)) + (uuidm + (>= 0.9.9)) + (yojson + (>= 1.7.0)))) (package (name sihl-user) @@ -106,27 +108,29 @@ "Modules for user management and password reset workflows with support for PostgreSQL and MariaDB.") (depends dune - (ocaml - (>= 4.08.0)) - (sihl - (= :version)) - (sihl-token - (and - (= :version) - :with-test)) (alcotest-lwt (and (>= 1.4.0) :with-test)) - (mariadb - (>= 1.1.6)) - (caqti-driver-postgresql + (caqti-driver-mariadb (and (>= 2.0.1) :with-test)) - (caqti-driver-mariadb + (caqti-driver-postgresql (and (>= 2.0.1) + :with-test)) + (mariadb + (>= 1.1.6)) + (ocaml + (>= 4.08.0)) + (ocaml-lsp-server :with-dev-setup) + (ocamlformat :with-dev-setup) + (sihl + (= :version)) + (sihl-token + (and + (= :version) :with-test)))) (package @@ -135,24 +139,26 @@ (description "A key-value store with support for PostgreSQL and MariaDB.") (depends dune - (ocaml - (>= 4.08.0)) - (sihl - (= :version)) (alcotest-lwt (and (>= 1.4.0) :with-test)) - (mariadb - (>= 1.1.6)) - (caqti-driver-postgresql + (caqti-driver-mariadb (and (>= 2.0.1) :with-test)) - (caqti-driver-mariadb + (caqti-driver-postgresql (and (>= 2.0.1) - :with-test)))) + :with-test)) + (mariadb + (>= 1.1.6)) + (ocaml + (>= 4.08.0)) + (ocaml-lsp-server :with-dev-setup) + (ocamlformat :with-dev-setup) + (sihl + (= :version)))) (package (name sihl-token) @@ -161,24 +167,26 @@ "Modules for token handling with support for JWT blacklisting and server-side stored tokens using PostgreSQL and MariaDB.") (depends dune - (ocaml - (>= 4.08.0)) - (sihl - (= :version)) (alcotest-lwt (and (>= 1.4.0) :with-test)) - (mariadb - (>= 1.1.6)) - (caqti-driver-postgresql + (caqti-driver-mariadb (and (>= 2.0.1) :with-test)) - (caqti-driver-mariadb + (caqti-driver-postgresql (and (>= 2.0.1) - :with-test)))) + :with-test)) + (mariadb + (>= 1.1.6)) + (ocaml + (>= 4.08.0)) + (ocaml-lsp-server :with-dev-setup) + (ocamlformat :with-dev-setup) + (sihl + (= :version)))) (package (name sihl-storage) @@ -187,24 +195,26 @@ "Modules for storing large binary blobs using either PostgreSQL or MariaDB.") (depends dune - (ocaml - (>= 4.08.0)) - (sihl - (= :version)) (alcotest-lwt (and (>= 1.4.0) :with-test)) - (mariadb - (>= 1.1.6)) - (caqti-driver-postgresql + (caqti-driver-mariadb (and (>= 2.0.1) :with-test)) - (caqti-driver-mariadb + (caqti-driver-postgresql (and (>= 2.0.1) - :with-test)))) + :with-test)) + (mariadb + (>= 1.1.6)) + (ocaml + (>= 4.08.0)) + (ocaml-lsp-server :with-dev-setup) + (ocamlformat :with-dev-setup) + (sihl + (= :version)))) (package (name sihl-email) @@ -212,28 +222,30 @@ (description "Modules for sending emails using Lwt and SMTP or Sendgrid.") (depends dune - (ocaml - (>= 4.08.0)) - (letters - (>= 0.4.0)) - (sihl - (= :version)) - (cohttp-lwt-unix - (>= 2.5.4)) (alcotest-lwt (and (>= 1.4.0) :with-test)) - (mariadb - (>= 1.1.6)) - (caqti-driver-postgresql + (caqti-driver-mariadb (and (>= 2.0.1) :with-test)) - (caqti-driver-mariadb + (caqti-driver-postgresql (and (>= 2.0.1) - :with-test)))) + :with-test)) + (cohttp-lwt-unix + (>= 2.5.4)) + (letters + (>= 0.4.0)) + (mariadb + (>= 1.1.6)) + (ocaml + (>= 4.08.0)) + (ocaml-lsp-server :with-dev-setup) + (ocamlformat :with-dev-setup) + (sihl + (= :version)))) (package (name sihl-queue) @@ -242,23 +254,25 @@ "Modules for running tasks in the background on a persistent queue.") (depends dune - (ocaml - (>= 4.08.0)) - (sihl - (= :version)) - (tyxml-ppx - (>= 4.4.0)) (alcotest-lwt (and (>= 1.4.0) :with-test)) - (mariadb - (>= 1.1.6)) - (caqti-driver-postgresql + (caqti-driver-mariadb (and (>= 2.0.1) :with-test)) - (caqti-driver-mariadb + (caqti-driver-postgresql (and (>= 2.0.1) - :with-test)))) + :with-test)) + (mariadb + (>= 1.1.6)) + (ocaml + (>= 4.08.0)) + (ocaml-lsp-server :with-dev-setup) + (ocamlformat :with-dev-setup) + (sihl + (= :version)) + (tyxml-ppx + (>= 4.4.0)))) diff --git a/sihl-cache.opam b/sihl-cache.opam index 0ffb41db9..29d75f2e0 100644 --- a/sihl-cache.opam +++ b/sihl-cache.opam @@ -10,13 +10,15 @@ homepage: "https://github.com/oxidizing/sihl" doc: "https://oxidizing.github.io/sihl/" bug-reports: "https://github.com/oxidizing/sihl/issues" depends: [ - "dune" {>= "2.7"} - "ocaml" {>= "4.08.0"} - "sihl" {= version} + "dune" {>= "3.0"} "alcotest-lwt" {>= "1.4.0" & with-test} - "mariadb" {>= "1.1.6"} - "caqti-driver-postgresql" {>= "2.0.1" & with-test} "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "caqti-driver-postgresql" {>= "2.0.1" & with-test} + "mariadb" {>= "1.1.6"} + "ocaml" {>= "4.08.0"} + "ocaml-lsp-server" {with-dev-setup} + "ocamlformat" {with-dev-setup} + "sihl" {= version} "odoc" {with-doc} ] build: [ diff --git a/sihl-cache.opam.locked b/sihl-cache.opam.locked deleted file mode 100644 index 68acc2697..000000000 --- a/sihl-cache.opam.locked +++ /dev/null @@ -1,154 +0,0 @@ -opam-version: "2.0" -version: "4.0.0" -synopsis: "Cache service implementations for Sihl" -description: "A key-value store with support for PostgreSQL and MariaDB." -maintainer: ["josef@oxidizing.io"] -authors: ["Josef Erben" "Aron Erben" "Miko Nieminen"] -license: "MIT" -homepage: "https://github.com/oxidizing/sihl" -doc: "https://oxidizing.github.io/sihl/" -bug-reports: "https://github.com/oxidizing/sihl/issues" -depends: [ - "alcotest" {= "1.8.0" & with-test} - "alcotest-lwt" {= "1.8.0" & with-test} - "angstrom" {= "0.16.1"} - "asn1-combinators" {= "0.3.2"} - "astring" {= "0.8.5"} - "base" {= "v0.16.3"} - "base-bigarray" {= "base"} - "base-bytes" {= "base"} - "base-threads" {= "base"} - "base-unix" {= "base"} - "base64" {= "3.5.1"} - "bigarray-compat" {= "1.1.0"} - "bigstringaf" {= "0.10.0"} - "bos" {= "0.2.1"} - "camlp-streams" {= "5.0.1" & with-doc} - "caqti" {= "2.1.2"} - "caqti-driver-mariadb" {= "2.1.1" & with-test} - "caqti-driver-postgresql" {= "2.1.2" & with-test} - "caqti-lwt" {= "2.1.1"} - "cmdliner" {= "1.3.0"} - "conf-bash" {= "1"} - "conf-gcc" {= "1.0"} - "conf-gmp" {= "4"} - "conf-gmp-powm-sec" {= "3"} - "conf-libssl" {= "4"} - "conf-mariadb" {= "2"} - "conf-pkg-config" {= "4"} - "conf-postgresql" {= "2" & with-test} - "conformist" {= "0.8.1"} - "containers" {= "3.15"} - "cppo" {= "1.8.0"} - "crunch" {= "3.3.1" & with-doc} - "csexp" {= "1.5.2"} - "cstruct" {= "6.2.0"} - "ctypes" {= "0.23.0"} - "digestif" {= "1.2.0"} - "domain-name" {= "0.4.0"} - "dune" {= "3.17.2"} - "dune-build-info" {= "3.17.2"} - "dune-configurator" {= "3.17.2"} - "dune-private-libs" {= "3.17.2"} - "dune-site" {= "3.17.2"} - "duration" {= "0.2.1"} - "dyn" {= "3.17.2"} - "either" {= "1.0.0"} - "eqaf" {= "0.10"} - "faraday" {= "0.8.2"} - "faraday-lwt" {= "0.8.2"} - "faraday-lwt-unix" {= "0.8.2"} - "fieldslib" {= "v0.16.0"} - "fmt" {= "0.9.0"} - "fpath" {= "0.7.3"} - "gmap" {= "0.3.0"} - "hmap" {= "0.8.1"} - "httpaf" {= "0.7.1"} - "httpaf-lwt-unix" {= "0.7.1"} - "integers" {= "0.7.0"} - "ipaddr" {= "5.6.0"} - "jwto" {= "0.4.0"} - "kdf" {= "1.0.0"} - "logs" {= "0.7.0"} - "lwt" {= "5.9.0"} - "lwt-dllist" {= "1.0.1"} - "lwt_ppx" {= "5.8.0"} - "lwt_ssl" {= "1.2.0"} - "macaddr" {= "5.6.0"} - "magic-mime" {= "1.3.1"} - "mariadb" {= "1.2.0"} - "mirage-crypto" {= "1.2.0"} - "mirage-crypto-ec" {= "1.2.0"} - "mirage-crypto-pk" {= "1.2.0"} - "mirage-crypto-rng" {= "1.2.0"} - "mtime" {= "2.1.0"} - "multipart-form-data" {= "0.3.0"} - "num" {= "1.5-1"} - "ocaml" {= "4.14.2"} - "ocaml-base-compiler" {= "4.14.2"} - "ocaml-compiler-libs" {= "v0.12.4"} - "ocaml-config" {= "2"} - "ocaml-options-vanilla" {= "1"} - "ocaml-syntax-shims" {= "1.0.0"} - "ocamlbuild" {= "0.15.0"} - "ocamlfind" {= "1.9.6"} - "ocplib-endian" {= "1.2"} - "odoc" {= "2.4.4" & with-doc} - "odoc-parser" {= "2.4.4" & with-doc} - "ohex" {= "0.2.0"} - "opium" {= "0.20.0"} - "ordering" {= "3.17.2"} - "parsexp" {= "v0.16.0"} - "postgresql" {= "5.1.3" & with-test} - "pp" {= "2.0.0"} - "ppx_derivers" {= "1.2.1"} - "ppx_deriving" {= "6.0.3"} - "ppx_deriving_yojson" {= "3.9.1"} - "ppx_fields_conv" {= "v0.16.0"} - "ppx_sexp_conv" {= "v0.16.0"} - "ppxlib" {= "0.34.0"} - "ptime" {= "1.2.0"} - "re" {= "1.12.0"} - "result" {= "1.5"} - "rock" {= "0.20.0"} - "rresult" {= "0.7.0"} - "safepass" {= "3.1"} - "seq" {= "base"} - "sexplib" {= "v0.16.0"} - "sexplib0" {= "v0.16.0"} - "sihl" {= "4.0.0"} - "ssl" {= "0.7.0"} - "stdlib-shims" {= "0.3.0"} - "stdune" {= "3.17.2"} - "stringext" {= "1.6.0"} - "tls" {= "1.0.4"} - "topkg" {= "1.0.7"} - "tsort" {= "2.1.0"} - "tyxml" {= "4.6.0"} - "uri" {= "4.4.0"} - "uuidm" {= "0.9.9"} - "uutf" {= "1.0.3"} - "x509" {= "1.0.5"} - "yojson" {= "2.2.2"} - "zarith" {= "1.14"} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/oxidizing/sihl.git" -name: "sihl-cache" -pin-depends: [ - ["opium.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] - ["rock.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] -] diff --git a/sihl-cache/test/dune b/sihl-cache/test/dune index c8db2b46c..6de5db264 100644 --- a/sihl-cache/test/dune +++ b/sihl-cache/test/dune @@ -1,6 +1,10 @@ (executables (names mariadb postgresql) - (libraries sihl sihl-cache alcotest-lwt caqti-driver-mariadb - caqti-driver-postgresql) + (libraries + sihl + sihl-cache + alcotest-lwt + caqti-driver-mariadb + caqti-driver-postgresql) (preprocess (pps lwt_ppx))) diff --git a/sihl-email.opam b/sihl-email.opam index d935b92da..789ae913a 100644 --- a/sihl-email.opam +++ b/sihl-email.opam @@ -10,15 +10,17 @@ homepage: "https://github.com/oxidizing/sihl" doc: "https://oxidizing.github.io/sihl/" bug-reports: "https://github.com/oxidizing/sihl/issues" depends: [ - "dune" {>= "2.7"} - "ocaml" {>= "4.08.0"} - "letters" {>= "0.4.0"} - "sihl" {= version} - "cohttp-lwt-unix" {>= "2.5.4"} + "dune" {>= "3.0"} "alcotest-lwt" {>= "1.4.0" & with-test} - "mariadb" {>= "1.1.6"} - "caqti-driver-postgresql" {>= "2.0.1" & with-test} "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "caqti-driver-postgresql" {>= "2.0.1" & with-test} + "cohttp-lwt-unix" {>= "2.5.4"} + "letters" {>= "0.4.0"} + "mariadb" {>= "1.1.6"} + "ocaml" {>= "4.08.0"} + "ocaml-lsp-server" {with-dev-setup} + "ocamlformat" {with-dev-setup} + "sihl" {= version} "odoc" {with-doc} ] build: [ @@ -36,3 +38,6 @@ build: [ ] ] dev-repo: "git+https://github.com/oxidizing/sihl.git" +pin-depends: [ + ["letters.0.4.0" "git+https://github.com/mabiede/letters.git#bug/connection-close-wait"] +] diff --git a/sihl-email.opam.locked b/sihl-email.opam.locked deleted file mode 100644 index bff9a7994..000000000 --- a/sihl-email.opam.locked +++ /dev/null @@ -1,181 +0,0 @@ -opam-version: "2.0" -version: "4.0.0" -synopsis: "Email service implementations for Sihl" -description: "Modules for sending emails using Lwt and SMTP or Sendgrid." -maintainer: ["josef@oxidizing.io"] -authors: ["Josef Erben" "Aron Erben" "Miko Nieminen"] -license: "MIT" -homepage: "https://github.com/oxidizing/sihl" -doc: "https://oxidizing.github.io/sihl/" -bug-reports: "https://github.com/oxidizing/sihl/issues" -depends: [ - "alcotest" {= "1.8.0" & with-test} - "alcotest-lwt" {= "1.8.0" & with-test} - "angstrom" {= "0.16.1"} - "asn1-combinators" {= "0.3.2"} - "astring" {= "0.8.5"} - "base" {= "v0.16.3"} - "base-bigarray" {= "base"} - "base-bytes" {= "base"} - "base-threads" {= "base"} - "base-unix" {= "base"} - "base64" {= "3.5.1"} - "bigarray-compat" {= "1.1.0"} - "bigarray-overlap" {= "0.2.1"} - "bigstringaf" {= "0.10.0"} - "bos" {= "0.2.1"} - "ca-certs" {= "1.0.0"} - "camlp-streams" {= "5.0.1" & with-doc} - "caqti" {= "2.1.2"} - "caqti-driver-mariadb" {= "2.1.1" & with-test} - "caqti-driver-postgresql" {= "2.1.2" & with-test} - "caqti-lwt" {= "2.1.1"} - "cmdliner" {= "1.3.0"} - "cohttp" {= "6.0.0"} - "cohttp-lwt" {= "6.0.0"} - "cohttp-lwt-unix" {= "6.0.0"} - "coin" {= "0.1.4"} - "colombe" {= "0.11.0"} - "conduit" {= "7.1.0"} - "conduit-lwt" {= "7.1.0"} - "conduit-lwt-unix" {= "7.1.0"} - "conf-bash" {= "1"} - "conf-gcc" {= "1.0"} - "conf-gmp" {= "4"} - "conf-gmp-powm-sec" {= "3"} - "conf-libssl" {= "4"} - "conf-mariadb" {= "2"} - "conf-pkg-config" {= "4"} - "conf-postgresql" {= "2" & with-test} - "conformist" {= "0.8.1"} - "containers" {= "3.15"} - "cppo" {= "1.8.0"} - "crunch" {= "3.3.1" & with-doc} - "csexp" {= "1.5.2"} - "cstruct" {= "6.2.0"} - "ctypes" {= "0.23.0"} - "digestif" {= "1.2.0"} - "domain-name" {= "0.4.0"} - "dune" {= "3.17.2"} - "dune-build-info" {= "3.17.2"} - "dune-configurator" {= "3.17.2"} - "dune-private-libs" {= "3.17.2"} - "dune-site" {= "3.17.2"} - "duration" {= "0.2.1"} - "dyn" {= "3.17.2"} - "either" {= "1.0.0"} - "emile" {= "1.1"} - "eqaf" {= "0.10"} - "faraday" {= "0.8.2"} - "faraday-lwt" {= "0.8.2"} - "faraday-lwt-unix" {= "0.8.2"} - "fieldslib" {= "v0.16.0"} - "fmt" {= "0.9.0"} - "fpath" {= "0.7.3"} - "gmap" {= "0.3.0"} - "hmap" {= "0.8.1"} - "http" {= "6.0.0"} - "httpaf" {= "0.7.1"} - "httpaf-lwt-unix" {= "0.7.1"} - "hxd" {= "0.3.3"} - "integers" {= "0.7.0"} - "ipaddr" {= "5.6.0"} - "ipaddr-sexp" {= "5.6.0"} - "jwto" {= "0.4.0"} - "kdf" {= "1.0.0"} - "ke" {= "0.6"} - "letters" {= "0.4.0"} - "logs" {= "0.7.0"} - "lwt" {= "5.9.0"} - "lwt-dllist" {= "1.0.1"} - "lwt_ppx" {= "5.8.0"} - "lwt_ssl" {= "1.2.0"} - "macaddr" {= "5.6.0"} - "magic-mime" {= "1.3.1"} - "mariadb" {= "1.2.0"} - "mirage-crypto" {= "1.2.0"} - "mirage-crypto-ec" {= "1.2.0"} - "mirage-crypto-pk" {= "1.2.0"} - "mirage-crypto-rng" {= "1.2.0"} - "mirage-crypto-rng-lwt" {= "1.2.0"} - "mrmime" {= "0.6.1"} - "mtime" {= "2.1.0"} - "multipart-form-data" {= "0.3.0"} - "num" {= "1.5-1"} - "ocaml" {= "4.14.2"} - "ocaml-base-compiler" {= "4.14.2"} - "ocaml-compiler-libs" {= "v0.12.4"} - "ocaml-config" {= "2"} - "ocaml-options-vanilla" {= "1"} - "ocaml-syntax-shims" {= "1.0.0"} - "ocamlbuild" {= "0.15.0"} - "ocamlfind" {= "1.9.6"} - "ocplib-endian" {= "1.2"} - "odoc" {= "2.4.4" & with-doc} - "odoc-parser" {= "2.4.4" & with-doc} - "ohex" {= "0.2.0"} - "opium" {= "0.20.0"} - "ordering" {= "3.17.2"} - "parsexp" {= "v0.16.0"} - "pecu" {= "0.7"} - "postgresql" {= "5.1.3" & with-test} - "pp" {= "2.0.0"} - "ppx_derivers" {= "1.2.1"} - "ppx_deriving" {= "6.0.3"} - "ppx_deriving_yojson" {= "3.9.1"} - "ppx_fields_conv" {= "v0.16.0"} - "ppx_sexp_conv" {= "v0.16.0"} - "ppxlib" {= "0.34.0"} - "prettym" {= "0.0.3"} - "ptime" {= "1.2.0"} - "re" {= "1.12.0"} - "result" {= "1.5"} - "rock" {= "0.20.0"} - "rosetta" {= "0.3.0"} - "rresult" {= "0.7.0"} - "safepass" {= "3.1"} - "sendmail" {= "0.11.0"} - "seq" {= "base"} - "sexplib" {= "v0.16.0"} - "sexplib0" {= "v0.16.0"} - "sihl" {= "4.0.0"} - "ssl" {= "0.7.0"} - "stdlib-shims" {= "0.3.0"} - "stdune" {= "3.17.2"} - "stringext" {= "1.6.0"} - "tls" {= "1.0.4"} - "tls-lwt" {= "1.0.4"} - "topkg" {= "1.0.7"} - "tsort" {= "2.1.0"} - "tyxml" {= "4.6.0"} - "unstrctrd" {= "0.4"} - "uri" {= "4.4.0"} - "uri-sexp" {= "4.4.0"} - "uuidm" {= "0.9.9"} - "uutf" {= "1.0.3"} - "uuuu" {= "0.3.0"} - "x509" {= "1.0.5"} - "yojson" {= "2.2.2"} - "yuscii" {= "0.3.0"} - "zarith" {= "1.14"} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/oxidizing/sihl.git" -name: "sihl-email" -pin-depends: [ - ["opium.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] - ["rock.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] -] diff --git a/sihl-email.opam.template b/sihl-email.opam.template new file mode 100644 index 000000000..69c59f99f --- /dev/null +++ b/sihl-email.opam.template @@ -0,0 +1,3 @@ +pin-depends: [ + ["letters.0.4.0" "git+https://github.com/mabiede/letters.git#bug/connection-close-wait"] +] diff --git a/sihl-email/test/dune b/sihl-email/test/dune index 97b8990dc..b3a14c4a8 100644 --- a/sihl-email/test/dune +++ b/sihl-email/test/dune @@ -1,6 +1,10 @@ (executables (names template email_mariadb email_postgresql) - (libraries sihl sihl-email alcotest-lwt caqti-driver-mariadb - caqti-driver-postgresql) + (libraries + sihl + sihl-email + alcotest-lwt + caqti-driver-mariadb + caqti-driver-postgresql) (preprocess (pps lwt_ppx))) diff --git a/sihl-queue.opam b/sihl-queue.opam index 73f4de08a..1c3d7ddaa 100644 --- a/sihl-queue.opam +++ b/sihl-queue.opam @@ -11,14 +11,16 @@ homepage: "https://github.com/oxidizing/sihl" doc: "https://oxidizing.github.io/sihl/" bug-reports: "https://github.com/oxidizing/sihl/issues" depends: [ - "dune" {>= "2.7"} + "dune" {>= "3.0"} + "alcotest-lwt" {>= "1.4.0" & with-test} + "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "caqti-driver-postgresql" {>= "2.0.1" & with-test} + "mariadb" {>= "1.1.6"} "ocaml" {>= "4.08.0"} + "ocaml-lsp-server" {with-dev-setup} + "ocamlformat" {with-dev-setup} "sihl" {= version} "tyxml-ppx" {>= "4.4.0"} - "alcotest-lwt" {>= "1.4.0" & with-test} - "mariadb" {>= "1.1.6"} - "caqti-driver-postgresql" {>= "2.0.1" & with-test} - "caqti-driver-mariadb" {>= "2.0.1" & with-test} "odoc" {with-doc} ] build: [ diff --git a/sihl-queue.opam.locked b/sihl-queue.opam.locked deleted file mode 100644 index 5f8b9a0b8..000000000 --- a/sihl-queue.opam.locked +++ /dev/null @@ -1,159 +0,0 @@ -opam-version: "2.0" -version: "4.0.0" -synopsis: "Queue service implementations for Sihl" -description: - "Modules for running tasks in the background on a persistent queue." -maintainer: ["josef@oxidizing.io"] -authors: ["Josef Erben" "Aron Erben" "Miko Nieminen"] -license: "MIT" -homepage: "https://github.com/oxidizing/sihl" -doc: "https://oxidizing.github.io/sihl/" -bug-reports: "https://github.com/oxidizing/sihl/issues" -depends: [ - "alcotest" {= "1.8.0" & with-test} - "alcotest-lwt" {= "1.8.0" & with-test} - "angstrom" {= "0.16.1"} - "asn1-combinators" {= "0.3.2"} - "astring" {= "0.8.5"} - "base" {= "v0.16.3"} - "base-bigarray" {= "base"} - "base-bytes" {= "base"} - "base-threads" {= "base"} - "base-unix" {= "base"} - "base64" {= "3.5.1"} - "bigarray-compat" {= "1.1.0"} - "bigstringaf" {= "0.10.0"} - "bos" {= "0.2.1"} - "camlp-streams" {= "5.0.1" & with-doc} - "caqti" {= "2.1.2"} - "caqti-driver-mariadb" {= "2.1.1" & with-test} - "caqti-driver-postgresql" {= "2.1.2" & with-test} - "caqti-lwt" {= "2.1.1"} - "cmdliner" {= "1.3.0"} - "conf-bash" {= "1"} - "conf-gcc" {= "1.0"} - "conf-gmp" {= "4"} - "conf-gmp-powm-sec" {= "3"} - "conf-libssl" {= "4"} - "conf-mariadb" {= "2"} - "conf-pkg-config" {= "4"} - "conf-postgresql" {= "2" & with-test} - "conformist" {= "0.8.1"} - "containers" {= "3.15"} - "cppo" {= "1.8.0"} - "crunch" {= "3.3.1" & with-doc} - "csexp" {= "1.5.2"} - "cstruct" {= "6.2.0"} - "ctypes" {= "0.23.0"} - "digestif" {= "1.2.0"} - "domain-name" {= "0.4.0"} - "dune" {= "3.17.2"} - "dune-build-info" {= "3.17.2"} - "dune-configurator" {= "3.17.2"} - "dune-private-libs" {= "3.17.2"} - "dune-site" {= "3.17.2"} - "duration" {= "0.2.1"} - "dyn" {= "3.17.2"} - "either" {= "1.0.0"} - "eqaf" {= "0.10"} - "faraday" {= "0.8.2"} - "faraday-lwt" {= "0.8.2"} - "faraday-lwt-unix" {= "0.8.2"} - "fieldslib" {= "v0.16.0"} - "fmt" {= "0.9.0"} - "fpath" {= "0.7.3"} - "gmap" {= "0.3.0"} - "hmap" {= "0.8.1"} - "httpaf" {= "0.7.1"} - "httpaf-lwt-unix" {= "0.7.1"} - "integers" {= "0.7.0"} - "ipaddr" {= "5.6.0"} - "jwto" {= "0.4.0"} - "kdf" {= "1.0.0"} - "logs" {= "0.7.0"} - "lwt" {= "5.9.0"} - "lwt-dllist" {= "1.0.1"} - "lwt_ppx" {= "5.8.0"} - "lwt_ssl" {= "1.2.0"} - "macaddr" {= "5.6.0"} - "magic-mime" {= "1.3.1"} - "mariadb" {= "1.2.0"} - "markup" {= "1.0.3"} - "mirage-crypto" {= "1.2.0"} - "mirage-crypto-ec" {= "1.2.0"} - "mirage-crypto-pk" {= "1.2.0"} - "mirage-crypto-rng" {= "1.2.0"} - "mtime" {= "2.1.0"} - "multipart-form-data" {= "0.3.0"} - "num" {= "1.5-1"} - "ocaml" {= "4.14.2"} - "ocaml-base-compiler" {= "4.14.2"} - "ocaml-compiler-libs" {= "v0.12.4"} - "ocaml-config" {= "2"} - "ocaml-options-vanilla" {= "1"} - "ocaml-syntax-shims" {= "1.0.0"} - "ocamlbuild" {= "0.15.0"} - "ocamlfind" {= "1.9.6"} - "ocplib-endian" {= "1.2"} - "odoc" {= "2.4.4" & with-doc} - "odoc-parser" {= "2.4.4" & with-doc} - "ohex" {= "0.2.0"} - "opium" {= "0.20.0"} - "ordering" {= "3.17.2"} - "parsexp" {= "v0.16.0"} - "postgresql" {= "5.1.3" & with-test} - "pp" {= "2.0.0"} - "ppx_derivers" {= "1.2.1"} - "ppx_deriving" {= "6.0.3"} - "ppx_deriving_yojson" {= "3.9.1"} - "ppx_fields_conv" {= "v0.16.0"} - "ppx_sexp_conv" {= "v0.16.0"} - "ppxlib" {= "0.34.0"} - "ptime" {= "1.2.0"} - "re" {= "1.12.0"} - "result" {= "1.5"} - "rock" {= "0.20.0"} - "rresult" {= "0.7.0"} - "safepass" {= "3.1"} - "seq" {= "base"} - "sexplib" {= "v0.16.0"} - "sexplib0" {= "v0.16.0"} - "sihl" {= "4.0.0"} - "ssl" {= "0.7.0"} - "stdlib-shims" {= "0.3.0"} - "stdune" {= "3.17.2"} - "stringext" {= "1.6.0"} - "tls" {= "1.0.4"} - "topkg" {= "1.0.7"} - "tsort" {= "2.1.0"} - "tyxml" {= "4.6.0"} - "tyxml-ppx" {= "4.6.0"} - "tyxml-syntax" {= "4.6.0"} - "uchar" {= "0.0.2"} - "uri" {= "4.4.0"} - "uuidm" {= "0.9.9"} - "uutf" {= "1.0.3"} - "x509" {= "1.0.5"} - "yojson" {= "2.2.2"} - "zarith" {= "1.14"} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/oxidizing/sihl.git" -name: "sihl-queue" -pin-depends: [ - ["opium.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] - ["rock.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] -] diff --git a/sihl-queue/test/dune b/sihl-queue/test/dune index cc3c99412..d5c3567dd 100644 --- a/sihl-queue/test/dune +++ b/sihl-queue/test/dune @@ -1,6 +1,10 @@ (executables (names queue_inmemory queue_mariadb queue_postgresql) - (libraries sihl sihl-queue alcotest-lwt caqti-driver-mariadb - caqti-driver-postgresql) + (libraries + sihl + sihl-queue + alcotest-lwt + caqti-driver-mariadb + caqti-driver-postgresql) (preprocess (pps ppx_deriving_yojson lwt_ppx))) diff --git a/sihl-storage.opam b/sihl-storage.opam index a775be66c..6f01c13e3 100644 --- a/sihl-storage.opam +++ b/sihl-storage.opam @@ -11,13 +11,15 @@ homepage: "https://github.com/oxidizing/sihl" doc: "https://oxidizing.github.io/sihl/" bug-reports: "https://github.com/oxidizing/sihl/issues" depends: [ - "dune" {>= "2.7"} - "ocaml" {>= "4.08.0"} - "sihl" {= version} + "dune" {>= "3.0"} "alcotest-lwt" {>= "1.4.0" & with-test} - "mariadb" {>= "1.1.6"} - "caqti-driver-postgresql" {>= "2.0.1" & with-test} "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "caqti-driver-postgresql" {>= "2.0.1" & with-test} + "mariadb" {>= "1.1.6"} + "ocaml" {>= "4.08.0"} + "ocaml-lsp-server" {with-dev-setup} + "ocamlformat" {with-dev-setup} + "sihl" {= version} "odoc" {with-doc} ] build: [ diff --git a/sihl-storage.opam.locked b/sihl-storage.opam.locked deleted file mode 100644 index 1444d91bd..000000000 --- a/sihl-storage.opam.locked +++ /dev/null @@ -1,155 +0,0 @@ -opam-version: "2.0" -version: "4.0.0" -synopsis: "Storage service implementations for Sihl" -description: - "Modules for storing large binary blobs using either PostgreSQL or MariaDB." -maintainer: ["josef@oxidizing.io"] -authors: ["Josef Erben" "Aron Erben" "Miko Nieminen"] -license: "MIT" -homepage: "https://github.com/oxidizing/sihl" -doc: "https://oxidizing.github.io/sihl/" -bug-reports: "https://github.com/oxidizing/sihl/issues" -depends: [ - "alcotest" {= "1.8.0" & with-test} - "alcotest-lwt" {= "1.8.0" & with-test} - "angstrom" {= "0.16.1"} - "asn1-combinators" {= "0.3.2"} - "astring" {= "0.8.5"} - "base" {= "v0.16.3"} - "base-bigarray" {= "base"} - "base-bytes" {= "base"} - "base-threads" {= "base"} - "base-unix" {= "base"} - "base64" {= "3.5.1"} - "bigarray-compat" {= "1.1.0"} - "bigstringaf" {= "0.10.0"} - "bos" {= "0.2.1"} - "camlp-streams" {= "5.0.1" & with-doc} - "caqti" {= "2.1.2"} - "caqti-driver-mariadb" {= "2.1.1" & with-test} - "caqti-driver-postgresql" {= "2.1.2" & with-test} - "caqti-lwt" {= "2.1.1"} - "cmdliner" {= "1.3.0"} - "conf-bash" {= "1"} - "conf-gcc" {= "1.0"} - "conf-gmp" {= "4"} - "conf-gmp-powm-sec" {= "3"} - "conf-libssl" {= "4"} - "conf-mariadb" {= "2"} - "conf-pkg-config" {= "4"} - "conf-postgresql" {= "2" & with-test} - "conformist" {= "0.8.1"} - "containers" {= "3.15"} - "cppo" {= "1.8.0"} - "crunch" {= "3.3.1" & with-doc} - "csexp" {= "1.5.2"} - "cstruct" {= "6.2.0"} - "ctypes" {= "0.23.0"} - "digestif" {= "1.2.0"} - "domain-name" {= "0.4.0"} - "dune" {= "3.17.2"} - "dune-build-info" {= "3.17.2"} - "dune-configurator" {= "3.17.2"} - "dune-private-libs" {= "3.17.2"} - "dune-site" {= "3.17.2"} - "duration" {= "0.2.1"} - "dyn" {= "3.17.2"} - "either" {= "1.0.0"} - "eqaf" {= "0.10"} - "faraday" {= "0.8.2"} - "faraday-lwt" {= "0.8.2"} - "faraday-lwt-unix" {= "0.8.2"} - "fieldslib" {= "v0.16.0"} - "fmt" {= "0.9.0"} - "fpath" {= "0.7.3"} - "gmap" {= "0.3.0"} - "hmap" {= "0.8.1"} - "httpaf" {= "0.7.1"} - "httpaf-lwt-unix" {= "0.7.1"} - "integers" {= "0.7.0"} - "ipaddr" {= "5.6.0"} - "jwto" {= "0.4.0"} - "kdf" {= "1.0.0"} - "logs" {= "0.7.0"} - "lwt" {= "5.9.0"} - "lwt-dllist" {= "1.0.1"} - "lwt_ppx" {= "5.8.0"} - "lwt_ssl" {= "1.2.0"} - "macaddr" {= "5.6.0"} - "magic-mime" {= "1.3.1"} - "mariadb" {= "1.2.0"} - "mirage-crypto" {= "1.2.0"} - "mirage-crypto-ec" {= "1.2.0"} - "mirage-crypto-pk" {= "1.2.0"} - "mirage-crypto-rng" {= "1.2.0"} - "mtime" {= "2.1.0"} - "multipart-form-data" {= "0.3.0"} - "num" {= "1.5-1"} - "ocaml" {= "4.14.2"} - "ocaml-base-compiler" {= "4.14.2"} - "ocaml-compiler-libs" {= "v0.12.4"} - "ocaml-config" {= "2"} - "ocaml-options-vanilla" {= "1"} - "ocaml-syntax-shims" {= "1.0.0"} - "ocamlbuild" {= "0.15.0"} - "ocamlfind" {= "1.9.6"} - "ocplib-endian" {= "1.2"} - "odoc" {= "2.4.4" & with-doc} - "odoc-parser" {= "2.4.4" & with-doc} - "ohex" {= "0.2.0"} - "opium" {= "0.20.0"} - "ordering" {= "3.17.2"} - "parsexp" {= "v0.16.0"} - "postgresql" {= "5.1.3" & with-test} - "pp" {= "2.0.0"} - "ppx_derivers" {= "1.2.1"} - "ppx_deriving" {= "6.0.3"} - "ppx_deriving_yojson" {= "3.9.1"} - "ppx_fields_conv" {= "v0.16.0"} - "ppx_sexp_conv" {= "v0.16.0"} - "ppxlib" {= "0.34.0"} - "ptime" {= "1.2.0"} - "re" {= "1.12.0"} - "result" {= "1.5"} - "rock" {= "0.20.0"} - "rresult" {= "0.7.0"} - "safepass" {= "3.1"} - "seq" {= "base"} - "sexplib" {= "v0.16.0"} - "sexplib0" {= "v0.16.0"} - "sihl" {= "4.0.0"} - "ssl" {= "0.7.0"} - "stdlib-shims" {= "0.3.0"} - "stdune" {= "3.17.2"} - "stringext" {= "1.6.0"} - "tls" {= "1.0.4"} - "topkg" {= "1.0.7"} - "tsort" {= "2.1.0"} - "tyxml" {= "4.6.0"} - "uri" {= "4.4.0"} - "uuidm" {= "0.9.9"} - "uutf" {= "1.0.3"} - "x509" {= "1.0.5"} - "yojson" {= "2.2.2"} - "zarith" {= "1.14"} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/oxidizing/sihl.git" -name: "sihl-storage" -pin-depends: [ - ["opium.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] - ["rock.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] -] diff --git a/sihl-token.opam b/sihl-token.opam index c0badaead..55236f920 100644 --- a/sihl-token.opam +++ b/sihl-token.opam @@ -11,13 +11,15 @@ homepage: "https://github.com/oxidizing/sihl" doc: "https://oxidizing.github.io/sihl/" bug-reports: "https://github.com/oxidizing/sihl/issues" depends: [ - "dune" {>= "2.7"} - "ocaml" {>= "4.08.0"} - "sihl" {= version} + "dune" {>= "3.0"} "alcotest-lwt" {>= "1.4.0" & with-test} - "mariadb" {>= "1.1.6"} - "caqti-driver-postgresql" {>= "2.0.1" & with-test} "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "caqti-driver-postgresql" {>= "2.0.1" & with-test} + "mariadb" {>= "1.1.6"} + "ocaml" {>= "4.08.0"} + "ocaml-lsp-server" {with-dev-setup} + "ocamlformat" {with-dev-setup} + "sihl" {= version} "odoc" {with-doc} ] build: [ diff --git a/sihl-token.opam.locked b/sihl-token.opam.locked deleted file mode 100644 index 3d736b044..000000000 --- a/sihl-token.opam.locked +++ /dev/null @@ -1,155 +0,0 @@ -opam-version: "2.0" -version: "4.0.0" -synopsis: "Token service implementations for Sihl" -description: - "Modules for token handling with support for JWT blacklisting and server-side stored tokens using PostgreSQL and MariaDB." -maintainer: ["josef@oxidizing.io"] -authors: ["Josef Erben" "Aron Erben" "Miko Nieminen"] -license: "MIT" -homepage: "https://github.com/oxidizing/sihl" -doc: "https://oxidizing.github.io/sihl/" -bug-reports: "https://github.com/oxidizing/sihl/issues" -depends: [ - "alcotest" {= "1.8.0" & with-test} - "alcotest-lwt" {= "1.8.0" & with-test} - "angstrom" {= "0.16.1"} - "asn1-combinators" {= "0.3.2"} - "astring" {= "0.8.5"} - "base" {= "v0.16.3"} - "base-bigarray" {= "base"} - "base-bytes" {= "base"} - "base-threads" {= "base"} - "base-unix" {= "base"} - "base64" {= "3.5.1"} - "bigarray-compat" {= "1.1.0"} - "bigstringaf" {= "0.10.0"} - "bos" {= "0.2.1"} - "camlp-streams" {= "5.0.1" & with-doc} - "caqti" {= "2.1.2"} - "caqti-driver-mariadb" {= "2.1.1" & with-test} - "caqti-driver-postgresql" {= "2.1.2" & with-test} - "caqti-lwt" {= "2.1.1"} - "cmdliner" {= "1.3.0"} - "conf-bash" {= "1"} - "conf-gcc" {= "1.0"} - "conf-gmp" {= "4"} - "conf-gmp-powm-sec" {= "3"} - "conf-libssl" {= "4"} - "conf-mariadb" {= "2"} - "conf-pkg-config" {= "4"} - "conf-postgresql" {= "2" & with-test} - "conformist" {= "0.8.1"} - "containers" {= "3.15"} - "cppo" {= "1.8.0"} - "crunch" {= "3.3.1" & with-doc} - "csexp" {= "1.5.2"} - "cstruct" {= "6.2.0"} - "ctypes" {= "0.23.0"} - "digestif" {= "1.2.0"} - "domain-name" {= "0.4.0"} - "dune" {= "3.17.2"} - "dune-build-info" {= "3.17.2"} - "dune-configurator" {= "3.17.2"} - "dune-private-libs" {= "3.17.2"} - "dune-site" {= "3.17.2"} - "duration" {= "0.2.1"} - "dyn" {= "3.17.2"} - "either" {= "1.0.0"} - "eqaf" {= "0.10"} - "faraday" {= "0.8.2"} - "faraday-lwt" {= "0.8.2"} - "faraday-lwt-unix" {= "0.8.2"} - "fieldslib" {= "v0.16.0"} - "fmt" {= "0.9.0"} - "fpath" {= "0.7.3"} - "gmap" {= "0.3.0"} - "hmap" {= "0.8.1"} - "httpaf" {= "0.7.1"} - "httpaf-lwt-unix" {= "0.7.1"} - "integers" {= "0.7.0"} - "ipaddr" {= "5.6.0"} - "jwto" {= "0.4.0"} - "kdf" {= "1.0.0"} - "logs" {= "0.7.0"} - "lwt" {= "5.9.0"} - "lwt-dllist" {= "1.0.1"} - "lwt_ppx" {= "5.8.0"} - "lwt_ssl" {= "1.2.0"} - "macaddr" {= "5.6.0"} - "magic-mime" {= "1.3.1"} - "mariadb" {= "1.2.0"} - "mirage-crypto" {= "1.2.0"} - "mirage-crypto-ec" {= "1.2.0"} - "mirage-crypto-pk" {= "1.2.0"} - "mirage-crypto-rng" {= "1.2.0"} - "mtime" {= "2.1.0"} - "multipart-form-data" {= "0.3.0"} - "num" {= "1.5-1"} - "ocaml" {= "4.14.2"} - "ocaml-base-compiler" {= "4.14.2"} - "ocaml-compiler-libs" {= "v0.12.4"} - "ocaml-config" {= "2"} - "ocaml-options-vanilla" {= "1"} - "ocaml-syntax-shims" {= "1.0.0"} - "ocamlbuild" {= "0.15.0"} - "ocamlfind" {= "1.9.6"} - "ocplib-endian" {= "1.2"} - "odoc" {= "2.4.4" & with-doc} - "odoc-parser" {= "2.4.4" & with-doc} - "ohex" {= "0.2.0"} - "opium" {= "0.20.0"} - "ordering" {= "3.17.2"} - "parsexp" {= "v0.16.0"} - "postgresql" {= "5.1.3" & with-test} - "pp" {= "2.0.0"} - "ppx_derivers" {= "1.2.1"} - "ppx_deriving" {= "6.0.3"} - "ppx_deriving_yojson" {= "3.9.1"} - "ppx_fields_conv" {= "v0.16.0"} - "ppx_sexp_conv" {= "v0.16.0"} - "ppxlib" {= "0.34.0"} - "ptime" {= "1.2.0"} - "re" {= "1.12.0"} - "result" {= "1.5"} - "rock" {= "0.20.0"} - "rresult" {= "0.7.0"} - "safepass" {= "3.1"} - "seq" {= "base"} - "sexplib" {= "v0.16.0"} - "sexplib0" {= "v0.16.0"} - "sihl" {= "4.0.0"} - "ssl" {= "0.7.0"} - "stdlib-shims" {= "0.3.0"} - "stdune" {= "3.17.2"} - "stringext" {= "1.6.0"} - "tls" {= "1.0.4"} - "topkg" {= "1.0.7"} - "tsort" {= "2.1.0"} - "tyxml" {= "4.6.0"} - "uri" {= "4.4.0"} - "uuidm" {= "0.9.9"} - "uutf" {= "1.0.3"} - "x509" {= "1.0.5"} - "yojson" {= "2.2.2"} - "zarith" {= "1.14"} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/oxidizing/sihl.git" -name: "sihl-token" -pin-depends: [ - ["opium.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] - ["rock.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] -] diff --git a/sihl-token/test/dune b/sihl-token/test/dune index 059988c4c..63fab8993 100644 --- a/sihl-token/test/dune +++ b/sihl-token/test/dune @@ -1,6 +1,10 @@ (executables (names mariadb postgresql jwt_inmemory jwt_mariadb jwt_postgresql) - (libraries sihl sihl-token alcotest-lwt caqti-driver-mariadb - caqti-driver-postgresql) + (libraries + sihl + sihl-token + alcotest-lwt + caqti-driver-mariadb + caqti-driver-postgresql) (preprocess (pps lwt_ppx))) diff --git a/sihl-user.opam b/sihl-user.opam index 5fa601417..5fc5534ca 100644 --- a/sihl-user.opam +++ b/sihl-user.opam @@ -11,14 +11,16 @@ homepage: "https://github.com/oxidizing/sihl" doc: "https://oxidizing.github.io/sihl/" bug-reports: "https://github.com/oxidizing/sihl/issues" depends: [ - "dune" {>= "2.7"} + "dune" {>= "3.0"} + "alcotest-lwt" {>= "1.4.0" & with-test} + "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "caqti-driver-postgresql" {>= "2.0.1" & with-test} + "mariadb" {>= "1.1.6"} "ocaml" {>= "4.08.0"} + "ocaml-lsp-server" {with-dev-setup} + "ocamlformat" {with-dev-setup} "sihl" {= version} "sihl-token" {= version & with-test} - "alcotest-lwt" {>= "1.4.0" & with-test} - "mariadb" {>= "1.1.6"} - "caqti-driver-postgresql" {>= "2.0.1" & with-test} - "caqti-driver-mariadb" {>= "2.0.1" & with-test} "odoc" {with-doc} ] build: [ diff --git a/sihl-user.opam.locked b/sihl-user.opam.locked deleted file mode 100644 index 773a20750..000000000 --- a/sihl-user.opam.locked +++ /dev/null @@ -1,156 +0,0 @@ -opam-version: "2.0" -version: "4.0.0" -synopsis: "User service implementations for Sihl" -description: - "Modules for user management and password reset workflows with support for PostgreSQL and MariaDB." -maintainer: ["josef@oxidizing.io"] -authors: ["Josef Erben" "Aron Erben" "Miko Nieminen"] -license: "MIT" -homepage: "https://github.com/oxidizing/sihl" -doc: "https://oxidizing.github.io/sihl/" -bug-reports: "https://github.com/oxidizing/sihl/issues" -depends: [ - "alcotest" {= "1.8.0" & with-test} - "alcotest-lwt" {= "1.8.0" & with-test} - "angstrom" {= "0.16.1"} - "asn1-combinators" {= "0.3.2"} - "astring" {= "0.8.5"} - "base" {= "v0.16.3"} - "base-bigarray" {= "base"} - "base-bytes" {= "base"} - "base-threads" {= "base"} - "base-unix" {= "base"} - "base64" {= "3.5.1"} - "bigarray-compat" {= "1.1.0"} - "bigstringaf" {= "0.10.0"} - "bos" {= "0.2.1"} - "camlp-streams" {= "5.0.1" & with-doc} - "caqti" {= "2.1.2"} - "caqti-driver-mariadb" {= "2.1.1" & with-test} - "caqti-driver-postgresql" {= "2.1.2" & with-test} - "caqti-lwt" {= "2.1.1"} - "cmdliner" {= "1.3.0"} - "conf-bash" {= "1"} - "conf-gcc" {= "1.0"} - "conf-gmp" {= "4"} - "conf-gmp-powm-sec" {= "3"} - "conf-libssl" {= "4"} - "conf-mariadb" {= "2"} - "conf-pkg-config" {= "4"} - "conf-postgresql" {= "2" & with-test} - "conformist" {= "0.8.1"} - "containers" {= "3.15"} - "cppo" {= "1.8.0"} - "crunch" {= "3.3.1" & with-doc} - "csexp" {= "1.5.2"} - "cstruct" {= "6.2.0"} - "ctypes" {= "0.23.0"} - "digestif" {= "1.2.0"} - "domain-name" {= "0.4.0"} - "dune" {= "3.17.2"} - "dune-build-info" {= "3.17.2"} - "dune-configurator" {= "3.17.2"} - "dune-private-libs" {= "3.17.2"} - "dune-site" {= "3.17.2"} - "duration" {= "0.2.1"} - "dyn" {= "3.17.2"} - "either" {= "1.0.0"} - "eqaf" {= "0.10"} - "faraday" {= "0.8.2"} - "faraday-lwt" {= "0.8.2"} - "faraday-lwt-unix" {= "0.8.2"} - "fieldslib" {= "v0.16.0"} - "fmt" {= "0.9.0"} - "fpath" {= "0.7.3"} - "gmap" {= "0.3.0"} - "hmap" {= "0.8.1"} - "httpaf" {= "0.7.1"} - "httpaf-lwt-unix" {= "0.7.1"} - "integers" {= "0.7.0"} - "ipaddr" {= "5.6.0"} - "jwto" {= "0.4.0"} - "kdf" {= "1.0.0"} - "logs" {= "0.7.0"} - "lwt" {= "5.9.0"} - "lwt-dllist" {= "1.0.1"} - "lwt_ppx" {= "5.8.0"} - "lwt_ssl" {= "1.2.0"} - "macaddr" {= "5.6.0"} - "magic-mime" {= "1.3.1"} - "mariadb" {= "1.2.0"} - "mirage-crypto" {= "1.2.0"} - "mirage-crypto-ec" {= "1.2.0"} - "mirage-crypto-pk" {= "1.2.0"} - "mirage-crypto-rng" {= "1.2.0"} - "mtime" {= "2.1.0"} - "multipart-form-data" {= "0.3.0"} - "num" {= "1.5-1"} - "ocaml" {= "4.14.2"} - "ocaml-base-compiler" {= "4.14.2"} - "ocaml-compiler-libs" {= "v0.12.4"} - "ocaml-config" {= "2"} - "ocaml-options-vanilla" {= "1"} - "ocaml-syntax-shims" {= "1.0.0"} - "ocamlbuild" {= "0.15.0"} - "ocamlfind" {= "1.9.6"} - "ocplib-endian" {= "1.2"} - "odoc" {= "2.4.4" & with-doc} - "odoc-parser" {= "2.4.4" & with-doc} - "ohex" {= "0.2.0"} - "opium" {= "0.20.0"} - "ordering" {= "3.17.2"} - "parsexp" {= "v0.16.0"} - "postgresql" {= "5.1.3" & with-test} - "pp" {= "2.0.0"} - "ppx_derivers" {= "1.2.1"} - "ppx_deriving" {= "6.0.3"} - "ppx_deriving_yojson" {= "3.9.1"} - "ppx_fields_conv" {= "v0.16.0"} - "ppx_sexp_conv" {= "v0.16.0"} - "ppxlib" {= "0.34.0"} - "ptime" {= "1.2.0"} - "re" {= "1.12.0"} - "result" {= "1.5"} - "rock" {= "0.20.0"} - "rresult" {= "0.7.0"} - "safepass" {= "3.1"} - "seq" {= "base"} - "sexplib" {= "v0.16.0"} - "sexplib0" {= "v0.16.0"} - "sihl" {= "4.0.0"} - "sihl-token" {= "4.0.0" & with-test} - "ssl" {= "0.7.0"} - "stdlib-shims" {= "0.3.0"} - "stdune" {= "3.17.2"} - "stringext" {= "1.6.0"} - "tls" {= "1.0.4"} - "topkg" {= "1.0.7"} - "tsort" {= "2.1.0"} - "tyxml" {= "4.6.0"} - "uri" {= "4.4.0"} - "uuidm" {= "0.9.9"} - "uutf" {= "1.0.3"} - "x509" {= "1.0.5"} - "yojson" {= "2.2.2"} - "zarith" {= "1.14"} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/oxidizing/sihl.git" -name: "sihl-user" -pin-depends: [ - ["opium.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] - ["rock.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] -] diff --git a/sihl-user/test/dune b/sihl-user/test/dune index bb4a03906..52d719992 100644 --- a/sihl-user/test/dune +++ b/sihl-user/test/dune @@ -1,7 +1,15 @@ (executables - (names password_reset_mariadb password_reset_postgresql user_mariadb - user_postgresql) - (libraries sihl sihl-user sihl-token alcotest-lwt caqti-driver-mariadb - caqti-driver-postgresql) + (names + password_reset_mariadb + password_reset_postgresql + user_mariadb + user_postgresql) + (libraries + sihl + sihl-user + sihl-token + alcotest-lwt + caqti-driver-mariadb + caqti-driver-postgresql) (preprocess (pps lwt_ppx))) diff --git a/sihl.opam b/sihl.opam index d31978ced..b8c1b04d7 100644 --- a/sihl.opam +++ b/sihl.opam @@ -13,38 +13,40 @@ homepage: "https://github.com/oxidizing/sihl" doc: "https://oxidizing.github.io/sihl/" bug-reports: "https://github.com/oxidizing/sihl/issues" depends: [ - "dune" {>= "2.7"} - "ocaml" {>= "4.12.0"} - "conformist" {>= "0.8.1"} - "dune-build-info" {>= "2.8.4"} - "tsort" {>= "2.0.0"} - "containers" {>= "3.6.1"} - "logs" {>= "0.7.0"} - "fmt" {>= "0.8.8"} + "dune" {>= "3.0"} + "alcotest-lwt" {>= "1.4.0" & with-test} "bos" {>= "0.2.0"} - "sexplib" {>= "v0.13.0"} - "yojson" {>= "1.7.0"} - "ppx_deriving_yojson" {>= "3.5.2"} - "tls" {>= "1.0.4"} - "ssl" {>= "0.5.9"} - "lwt_ssl" {>= "1.1.3"} - "lwt_ppx" {>= "2.0.1"} "caqti" {>= "2.0.1"} + "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "caqti-driver-postgresql" {>= "2.0.1" & with-test} "caqti-lwt" {>= "2.0.1"} - "safepass" {>= "3.0"} + "cohttp-lwt-unix" {>= "2.5.4" & with-test} + "conformist" {>= "0.8.1"} + "containers" {>= "3.6.1"} + "dune-build-info" {>= "2.8.4"} + "fmt" {>= "0.8.8"} "jwto" {>= "0.3.0"} - "uuidm" {>= "0.9.9"} - "ppx_fields_conv" {>= "v0.13.0"} - "ppx_sexp_conv" {>= "v0.13.0"} + "logs" {>= "0.7.0"} + "lwt_ppx" {>= "2.0.1"} + "lwt_ssl" {>= "1.1.3"} + "mariadb" {>= "1.1.6"} "mirage-crypto" {>= "1.1.0"} "mirage-crypto-rng" {>= "1.2.0"} - "cstruct" {>= "6.0.1"} + "ocaml" {>= "4.12.0"} + "ocaml-lsp-server" {with-dev-setup} + "ocamlformat" {with-dev-setup} "opium" {>= "0.20.0"} - "cohttp-lwt-unix" {>= "2.5.4" & with-test} - "alcotest-lwt" {>= "1.4.0" & with-test} - "mariadb" {>= "1.1.6"} - "caqti-driver-postgresql" {>= "2.0.1" & with-test} - "caqti-driver-mariadb" {>= "2.0.1" & with-test} + "rock" {>= "0.20.0"} + "ppx_deriving_yojson" {>= "3.5.2"} + "ppx_fields_conv" {>= "v0.13.0"} + "ppx_sexp_conv" {>= "v0.13.0"} + "safepass" {>= "3.0"} + "sexplib" {>= "v0.13.0"} + "ssl" {>= "0.5.9"} + "tls" {>= "1.0.4"} + "tsort" {>= "2.0.0"} + "uuidm" {>= "0.9.9"} + "yojson" {>= "1.7.0"} "odoc" {with-doc} ] build: [ @@ -62,3 +64,7 @@ build: [ ] ] dev-repo: "git+https://github.com/oxidizing/sihl.git" +pin-depends: [ + ["opium.0.20.0" "git+https://github.com/rgrinberg/opium.git#73b16f0487497e02750c1123ead377a56be3be43"] + ["rock.0.20.0" "git+https://github.com/rgrinberg/opium.git#73b16f0487497e02750c1123ead377a56be3be43"] +] diff --git a/sihl.opam.locked b/sihl.opam.locked deleted file mode 100644 index 095799ffa..000000000 --- a/sihl.opam.locked +++ /dev/null @@ -1,166 +0,0 @@ -opam-version: "2.0" -version: "4.0.0" -synopsis: "The Sihl web framework" -description: """ - -Sihl is a batteries-included web framework. Thanks to the modular architecture, included batteries can be swapped out easily. Statically typed functional programming with OCaml makes web development fun, fast and safe. Sihl supports PostgreSQL and MariaDB. -""" -maintainer: ["josef@oxidizing.io"] -authors: ["Josef Erben" "Aron Erben" "Miko Nieminen"] -license: "MIT" -homepage: "https://github.com/oxidizing/sihl" -doc: "https://oxidizing.github.io/sihl/" -bug-reports: "https://github.com/oxidizing/sihl/issues" -depends: [ - "alcotest" {= "1.8.0" & with-test} - "alcotest-lwt" {= "1.8.0" & with-test} - "angstrom" {= "0.16.1"} - "asn1-combinators" {= "0.3.2"} - "astring" {= "0.8.5"} - "base" {= "v0.16.3"} - "base-bigarray" {= "base"} - "base-bytes" {= "base"} - "base-threads" {= "base"} - "base-unix" {= "base"} - "base64" {= "3.5.1"} - "bigarray-compat" {= "1.1.0"} - "bigstringaf" {= "0.10.0"} - "bos" {= "0.2.1"} - "ca-certs" {= "1.0.0" & with-test} - "camlp-streams" {= "5.0.1" & with-doc} - "caqti" {= "2.1.2"} - "caqti-driver-mariadb" {= "2.1.1" & with-test} - "caqti-driver-postgresql" {= "2.1.2" & with-test} - "caqti-lwt" {= "2.1.1"} - "cmdliner" {= "1.3.0"} - "cohttp" {= "6.0.0" & with-test} - "cohttp-lwt" {= "6.0.0" & with-test} - "cohttp-lwt-unix" {= "6.0.0" & with-test} - "conduit" {= "7.1.0" & with-test} - "conduit-lwt" {= "7.1.0" & with-test} - "conduit-lwt-unix" {= "7.1.0" & with-test} - "conf-bash" {= "1"} - "conf-gcc" {= "1.0"} - "conf-gmp" {= "4"} - "conf-gmp-powm-sec" {= "3"} - "conf-libssl" {= "4"} - "conf-mariadb" {= "2"} - "conf-pkg-config" {= "4"} - "conf-postgresql" {= "2" & with-test} - "conformist" {= "0.8.1"} - "containers" {= "3.15"} - "cppo" {= "1.8.0"} - "crunch" {= "3.3.1" & with-doc} - "csexp" {= "1.5.2"} - "cstruct" {= "6.2.0"} - "ctypes" {= "0.23.0"} - "digestif" {= "1.2.0"} - "domain-name" {= "0.4.0"} - "dune" {= "3.17.2"} - "dune-build-info" {= "3.17.2"} - "dune-configurator" {= "3.17.2"} - "dune-private-libs" {= "3.17.2"} - "dune-site" {= "3.17.2"} - "duration" {= "0.2.1"} - "dyn" {= "3.17.2"} - "either" {= "1.0.0"} - "eqaf" {= "0.10"} - "faraday" {= "0.8.2"} - "faraday-lwt" {= "0.8.2"} - "faraday-lwt-unix" {= "0.8.2"} - "fieldslib" {= "v0.16.0"} - "fmt" {= "0.9.0"} - "fpath" {= "0.7.3"} - "gmap" {= "0.3.0"} - "hmap" {= "0.8.1"} - "http" {= "6.0.0" & with-test} - "httpaf" {= "0.7.1"} - "httpaf-lwt-unix" {= "0.7.1"} - "integers" {= "0.7.0"} - "ipaddr" {= "5.6.0"} - "ipaddr-sexp" {= "5.6.0" & with-test} - "jwto" {= "0.4.0"} - "kdf" {= "1.0.0"} - "logs" {= "0.7.0"} - "lwt" {= "5.9.0"} - "lwt-dllist" {= "1.0.1"} - "lwt_ppx" {= "5.8.0"} - "lwt_ssl" {= "1.2.0"} - "macaddr" {= "5.6.0"} - "magic-mime" {= "1.3.1"} - "mariadb" {= "1.2.0"} - "mirage-crypto" {= "1.2.0"} - "mirage-crypto-ec" {= "1.2.0"} - "mirage-crypto-pk" {= "1.2.0"} - "mirage-crypto-rng" {= "1.2.0"} - "mtime" {= "2.1.0"} - "multipart-form-data" {= "0.3.0"} - "num" {= "1.5-1"} - "ocaml" {= "4.14.2"} - "ocaml-base-compiler" {= "4.14.2"} - "ocaml-compiler-libs" {= "v0.12.4"} - "ocaml-config" {= "2"} - "ocaml-options-vanilla" {= "1"} - "ocaml-syntax-shims" {= "1.0.0"} - "ocamlbuild" {= "0.15.0"} - "ocamlfind" {= "1.9.6"} - "ocplib-endian" {= "1.2"} - "odoc" {= "2.4.4" & with-doc} - "odoc-parser" {= "2.4.4" & with-doc} - "ohex" {= "0.2.0"} - "opium" {= "0.20.0"} - "ordering" {= "3.17.2"} - "parsexp" {= "v0.16.0"} - "postgresql" {= "5.1.3" & with-test} - "pp" {= "2.0.0"} - "ppx_derivers" {= "1.2.1"} - "ppx_deriving" {= "6.0.3"} - "ppx_deriving_yojson" {= "3.9.1"} - "ppx_fields_conv" {= "v0.16.0"} - "ppx_sexp_conv" {= "v0.16.0"} - "ppxlib" {= "0.34.0"} - "ptime" {= "1.2.0"} - "re" {= "1.12.0"} - "result" {= "1.5"} - "rock" {= "0.20.0"} - "rresult" {= "0.7.0"} - "safepass" {= "3.1"} - "seq" {= "base"} - "sexplib" {= "v0.16.0"} - "sexplib0" {= "v0.16.0"} - "ssl" {= "0.7.0"} - "stdlib-shims" {= "0.3.0"} - "stdune" {= "3.17.2"} - "stringext" {= "1.6.0"} - "tls" {= "1.0.4"} - "topkg" {= "1.0.7"} - "tsort" {= "2.1.0"} - "tyxml" {= "4.6.0"} - "uri" {= "4.4.0"} - "uri-sexp" {= "4.4.0" & with-test} - "uuidm" {= "0.9.9"} - "uutf" {= "1.0.3"} - "x509" {= "1.0.5"} - "yojson" {= "2.2.2"} - "zarith" {= "1.14"} -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/oxidizing/sihl.git" -name: "sihl" -pin-depends: [ - ["opium.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] - ["rock.0.20.0" "git+https://github.com/mabiede/opium.git#upgrade-packages"] -] diff --git a/sihl.opam.template b/sihl.opam.template new file mode 100644 index 000000000..98b34a573 --- /dev/null +++ b/sihl.opam.template @@ -0,0 +1,4 @@ +pin-depends: [ + ["opium.0.20.0" "git+https://github.com/rgrinberg/opium.git#73b16f0487497e02750c1123ead377a56be3be43"] + ["rock.0.20.0" "git+https://github.com/rgrinberg/opium.git#73b16f0487497e02750c1123ead377a56be3be43"] +] diff --git a/sihl/src/dune b/sihl/src/dune index 4c4322505..b4822f3f2 100644 --- a/sihl/src/dune +++ b/sihl/src/dune @@ -1,13 +1,44 @@ (library (name sihl) (public_name sihl) - (libraries sexplib fmt fmt.tty logs logs.fmt lwt lwt.unix tsort conformist - base64 yojson ppx_deriving_yojson.runtime safepass ptime ptime.clock.os - jwto uuidm opium caqti-lwt caqti-lwt.unix str dune-build-info bos - containers mirage-crypto mirage-crypto-rng mirage-crypto-rng.unix cstruct) + (libraries + base64 + bos + caqti-lwt + caqti-lwt.unix + conformist + containers + dune-build-info + fmt + fmt.tty + jwto + logs + logs.fmt + lwt + lwt.unix + mirage-crypto + mirage-crypto-rng + mirage-crypto-rng.unix + opium + ppx_deriving_yojson.runtime + ptime + ptime.clock.os + rock + safepass + sexplib + str + tsort + uuidm + yojson) (preprocess - (pps ppx_fields_conv ppx_deriving_yojson ppx_deriving.eq ppx_deriving.show - ppx_deriving.make ppx_sexp_conv lwt_ppx))) + (pps + lwt_ppx + ppx_deriving_yojson + ppx_deriving.eq + ppx_deriving.make + ppx_deriving.show + ppx_fields_conv + ppx_sexp_conv))) (documentation (package sihl)) diff --git a/sihl/src/web_csrf.ml b/sihl/src/web_csrf.ml index 4c87773d7..4a65cb313 100644 --- a/sihl/src/web_csrf.ml +++ b/sihl/src/web_csrf.ml @@ -48,18 +48,12 @@ module Crypto = struct work. *) val make : string -> t - (** [to_raw secret] turns a [secret] into a [Cstruct.t]. *) - val to_raw : t -> Cstruct.t + (** [to_raw secret] turns a [secret] into a string. *) + val to_raw : t -> string end = struct - type t = Cstruct.t - - let make secret = - secret - |> Digestif.SHA256.digest_string - |> Digestif.SHA256.to_raw_string - |> Cstruct.of_string - ;; + type t = string + let make secret = Digestif.SHA256.(digest_string secret |> to_raw_string) let to_raw = CCFun.id end @@ -80,56 +74,50 @@ module Crypto = struct decrypted. *) val of_uri_safe_string : string -> t option - (** [to_struct tkn] turns an encrypted token [tkn] to a raw format. *) - val to_struct : t -> Cstruct.t + (** [to_string tkn] turns an encrypted token [tkn] to a raw string. *) + val to_string : t -> string - (** [from_struct ~with_secret tkn] encrypts a raw token [tkn] using AES in + (** [from_string ~with_secret tkn] encrypts a raw token [tkn] using AES in ECB mode given a secret [with_secret]. *) - val from_struct : with_secret:Secret.t -> Cstruct.t -> t + val from_string : with_secret:Secret.t -> string -> t - (** [from_struct_random ~with_secret tkn] encrypts a raw token [tkn]. + (** [from_string_random ~with_secret tkn] encrypts a raw token [tkn]. Additionally the encrypted result is scrambled with a random salt (IV) using AES in CBC mode given a secret [with_secret].*) - val from_struct_random : with_secret:Secret.t -> Cstruct.t -> t + val from_string_random : with_secret:Secret.t -> string -> t end = struct - type t = Cstruct.t + type t = string - let equal = Cstruct.equal + let equal = String.equal let to_uri_safe_string t = - t - |> Cstruct.to_string - |> Base64.encode_string ~alphabet:Base64.uri_safe_alphabet + Base64.encode_string ~alphabet:Base64.uri_safe_alphabet t ;; let of_uri_safe_string t = - t - |> Base64.decode ~alphabet:Base64.uri_safe_alphabet - |> CCResult.to_opt - |> CCOption.map Cstruct.of_string + t |> Base64.decode ~alphabet:Base64.uri_safe_alphabet |> CCResult.to_opt ;; - let to_struct = CCFun.id + let to_string = CCFun.id - let from_struct ~with_secret value = - let open Cstruct in - let open Mirage_crypto.AES.ECB in - let key = with_secret |> Secret.to_raw |> to_string |> of_secret in - encrypt ~key (to_string value) |> of_string + let from_string ~with_secret value = + let key = + with_secret |> Secret.to_raw |> Mirage_crypto.AES.ECB.of_secret + in + Mirage_crypto.AES.ECB.encrypt ~key value ;; - let from_struct_random ~with_secret value = - let open Cstruct in - let open Mirage_crypto.AES.CBC in - let key = with_secret |> Secret.to_raw |> to_string |> of_secret in + let from_string_random ~with_secret value = + let key = + with_secret |> Secret.to_raw |> Mirage_crypto.AES.CBC.of_secret + in let iv = Mirage_crypto_rng.generate block_size in - append (of_string iv) @@ (encrypt ~key ~iv (to_string value) |> of_string) + iv ^ Mirage_crypto.AES.CBC.encrypt ~key ~iv value ;; end (** This module does not provide an API to read a decrypted token (by turning - it into a string, Cstruct.t or similar). This is to prevent leaking CSRF - tokens. *) + it into a string or similar). This is to prevent leaking CSRF tokens. *) module Decrypted_token : sig type t @@ -137,9 +125,9 @@ module Crypto = struct equal. *) val equal : t -> t -> bool - (** [equal_struct tkn raw] checks if a decrypted token [tkn] is equal to a + (** [equal_string tkn raw] checks if a decrypted token [tkn] is equal to a raw token [raw]. *) - val equal_struct : t -> Cstruct.t -> bool + val equal_string : t -> string -> bool (** [from_encrypted ~with_secret tkn] decrypts an encrypted token [tkn] using AES in ECB mode given a secret [with_secret]. *) @@ -147,48 +135,46 @@ module Crypto = struct (** [from_encrypted_random ~with_secret tkn] decrypts a randomized encrypted token [tkn] given a secret [with_secret]. This function reverses - [Encrypted_token.from_struct_random] since a specific format is + [Encrypted_token.from_string_random] since a specific format is required. *) val from_encrypted_random : with_secret:Secret.t -> Encrypted_token.t -> t (** [from_encrypted_to_encrypted_random ~with_secret tkn] turns a normal encrypted token [tkn] into a randomly encrypted token by first decrypting it and then re-encrypting it with - [Encrypted_token.from_struct_random].*) + [Encrypted_token.from_string_random].*) val from_encrypted_to_encrypted_random : with_secret:Secret.t -> Encrypted_token.t -> Encrypted_token.t end = struct - type t = Cstruct.t + type t = string - let equal = Cstruct.equal - let equal_struct = equal + let equal = String.equal + let equal_string = equal - let from_encrypted ~with_secret (value : Encrypted_token.t) : Cstruct.t = - let open Cstruct in - let open Mirage_crypto.AES.ECB in - let key = with_secret |> Secret.to_raw |> to_string |> of_secret in - decrypt ~key (Encrypted_token.to_struct value |> to_string) |> of_string + let from_encrypted ~with_secret value = + let key = + with_secret |> Secret.to_raw |> Mirage_crypto.AES.ECB.of_secret + in + Mirage_crypto.AES.ECB.decrypt ~key (Encrypted_token.to_string value) ;; - let from_encrypted_random ~with_secret (value : Encrypted_token.t) - : Cstruct.t - = - let open Cstruct in - let open Mirage_crypto.AES.CBC in - let key = with_secret |> Secret.to_raw |> to_string |> of_secret in - let iv, value = - value - |> Encrypted_token.to_struct - |> CCFun.flip Cstruct.split block_size + let from_encrypted_random ~with_secret value = + let key = + with_secret |> Secret.to_raw |> Mirage_crypto.AES.CBC.of_secret + in + let value_str = Encrypted_token.to_string value in + let iv = String.sub value_str 0 block_size in + let encrypted = + String.sub value_str block_size (String.length value_str - block_size) in - decrypt ~key ~iv:(to_string iv) (to_string value) |> of_string + Mirage_crypto.AES.CBC.decrypt ~key ~iv encrypted ;; let from_encrypted_to_encrypted_random ~with_secret value = from_encrypted ~with_secret value - |> Encrypted_token.from_struct_random ~with_secret + |> Encrypted_token.from_string_random ~with_secret ;; end end @@ -244,11 +230,9 @@ let middleware ~with_secret:block_secret tkn ) | None -> - let value = - Mirage_crypto_rng.generate token_length |> Cstruct.of_string - in - ( Encrypted_token.from_struct ~with_secret:block_secret value - , Encrypted_token.from_struct_random ~with_secret:block_secret value ) + let value = Mirage_crypto_rng.generate token_length in + ( Encrypted_token.from_string ~with_secret:block_secret value + , Encrypted_token.from_string_random ~with_secret:block_secret value ) in let req = set diff --git a/sihl/test/core_app.ml b/sihl/test/core_app.ml index 453a5749c..c716415dd 100644 --- a/sihl/test/core_app.ml +++ b/sihl/test/core_app.ml @@ -13,7 +13,6 @@ module Database = struct ;; let lifecycle = Sihl.Container.create_lifecycle ~start ~stop "database" - let register () = Sihl.Container.Service.create lifecycle end let user_service_running = ref false diff --git a/sihl/test/core_configuration.ml b/sihl/test/core_configuration.ml index 03f242610..7fc631d74 100644 --- a/sihl/test/core_configuration.ml +++ b/sihl/test/core_configuration.ml @@ -192,6 +192,7 @@ let suite = , [ test_case "read empty" `Quick read_empty_value ; test_case "read non-existing" `Quick read_non_existing ; test_case "read existing" `Quick read_existing + ; test_case "read updated" `Quick read_updated ; test_case "read schema invalid" `Quick read_schema_invalid ; test_case "read schema" `Quick read_schema ; test_case diff --git a/sihl/test/dune b/sihl/test/dune index 541b09d11..346cb7944 100644 --- a/sihl/test/dune +++ b/sihl/test/dune @@ -1,10 +1,64 @@ +(library + (name test_support) + (modules database database_migration) + (wrapped false) + (libraries + alcotest-lwt + caqti-driver-mariadb + caqti-driver-postgresql + lwt_ppx + sihl) + (preprocess + (pps lwt_ppx))) + (executables - (names core_app core_configuration core_container core_utils - database_migration database_mariadb database_postgresql - database_migration_mariadb database_migration_postgresql web web_csrf - web_http web_session web_flash web_id web_trailing_slash) - (libraries sihl alcotest-lwt caqti-driver-mariadb caqti-driver-postgresql - cohttp-lwt-unix lwt_ppx) + (names + core_app + core_configuration + core_container + core_utils + database_mariadb + database_migration_mariadb + database_migration_postgresql + database_postgresql + web + web_csrf + web_flash + web_http + web_id + web_session + web_trailing_slash) + (modules + core_app + core_configuration + core_container + core_utils + database_mariadb + database_migration_mariadb + database_migration_postgresql + database_postgresql + web + web_csrf + web_flash + web_http + web_id + web_session + web_trailing_slash) + (libraries + alcotest-lwt + caqti-driver-mariadb + caqti-driver-postgresql + cohttp-lwt-unix + lwt_ppx + rock + sihl + test_support) (preprocess - (pps ppx_fields_conv ppx_deriving_yojson ppx_deriving.eq ppx_deriving.show - ppx_deriving.make ppx_sexp_conv lwt_ppx))) + (pps + lwt_ppx + ppx_deriving_yojson + ppx_deriving.eq + ppx_deriving.make + ppx_deriving.show + ppx_fields_conv + ppx_sexp_conv))) diff --git a/sihl/test/web_csrf.ml b/sihl/test/web_csrf.ml index 6f3b221f2..88ef6e4c0 100644 --- a/sihl/test/web_csrf.ml +++ b/sihl/test/web_csrf.ml @@ -4,8 +4,8 @@ open Sihl.Web let can_parse_uri_safe _ () = let open Csrf.Crypto in let with_secret = Sihl.Configuration.read_secret () |> Secret.make in - let value = Mirage_crypto_rng.generate token_length |> Cstruct.of_string in - let enc = Encrypted_token.from_struct ~with_secret value in + let value = Mirage_crypto_rng.generate token_length in + let enc = Encrypted_token.from_string ~with_secret value in let parsed = enc |> Encrypted_token.to_uri_safe_string @@ -21,33 +21,33 @@ let can_parse_uri_safe _ () = let crypto_undo_helper encrypt decrypt = let open Csrf.Crypto in let with_secret = Sihl.Configuration.read_secret () |> Secret.make in - let value = Mirage_crypto_rng.generate token_length |> Cstruct.of_string in + let value = Mirage_crypto_rng.generate token_length in let dec = encrypt ~with_secret value |> decrypt ~with_secret in let open Alcotest in check bool "Same decrypted CSRF tokens" true - @@ Decrypted_token.equal_struct dec value; + @@ Decrypted_token.equal_string dec value; Lwt.return () ;; let decrypt_random_undoes_encrypt_random _ () = let open Csrf.Crypto in crypto_undo_helper - Encrypted_token.from_struct_random + Encrypted_token.from_string_random Decrypted_token.from_encrypted_random ;; let decrypt_undoes_encrypt _ () = let open Csrf.Crypto in - crypto_undo_helper Encrypted_token.from_struct Decrypted_token.from_encrypted + crypto_undo_helper Encrypted_token.from_string Decrypted_token.from_encrypted ;; let csrf_simulation _ () = let open Csrf.Crypto in let with_secret = Sihl.Configuration.read_secret () |> Secret.make in (* GET request generates value *) - let value = Mirage_crypto_rng.generate token_length |> Cstruct.of_string in + let value = Mirage_crypto_rng.generate token_length in (* Encrypt value for cookie token *) - let enc = Encrypted_token.from_struct ~with_secret value in + let enc = Encrypted_token.from_string ~with_secret value in (* Encrypt value with randomness for body token (take already encrypted cookie token because in middleware no access to original value *) let req = @@ -67,13 +67,13 @@ let csrf_simulation _ () = let dec_stored = stored |> Decrypted_token.from_encrypted ~with_secret in let open Alcotest in let non_empty tkn = - check bool "Non empty encrypted token" false (Cstruct.is_empty @@ tkn) + check bool "Non empty encrypted token" false (String.length tkn = 0) in (* Make sure no token is empty *) - non_empty @@ Encrypted_token.to_struct received; - non_empty @@ Encrypted_token.to_struct stored; - non_empty @@ Cstruct.of_string req; - non_empty @@ Cstruct.of_string ck; + non_empty @@ Encrypted_token.to_string received; + non_empty @@ Encrypted_token.to_string stored; + non_empty @@ req; + non_empty @@ ck; check bool "Same decrypted CSRF tokens" true @@ Decrypted_token.equal dec_stored dec_received; Lwt.return () @@ -124,7 +124,7 @@ let get_request_yields_token _ () = in let wrapped_handler = apply_middlewares handler in let%lwt response = wrapped_handler req in - (* New encrypted token set in cookie *) + (* New token set in cookie *) let value = Sihl.Test.Session.find_resp csrf_name response in let open Alcotest in check bool "Has CSRF token" true (not @@ CCString.is_empty !token); @@ -332,8 +332,7 @@ let post_request_with_nonmatching_token_fails _ () = (* Generate a random encrypted token *) let tkn = Mirage_crypto_rng.generate token_length - |> Cstruct.of_string - |> Encrypted_token.from_struct_random ~with_secret + |> Encrypted_token.from_string_random ~with_secret |> Encrypted_token.to_uri_safe_string in let post_req = @@ -363,8 +362,7 @@ let post_request_with_nonmatching_cookie_fails _ () = let with_secret = Sihl.Configuration.read_secret () |> Secret.make in let tkn = Mirage_crypto_rng.generate token_length - |> Cstruct.of_string - |> Encrypted_token.from_struct ~with_secret + |> Encrypted_token.from_string ~with_secret |> Encrypted_token.to_uri_safe_string in (* New request with same token in body but non-matching token in cookie *) @@ -523,6 +521,10 @@ let suite = "two post requests yield different CSRF token" `Quick two_post_requests_yield_different_token + ; test_case + "post requests yield CSRF token" + `Quick + post_request_yields_token ; test_case "post request with invalid CSRF token in cookie and request fails" `Quick diff --git a/template/.devcontainer/Dockerfile b/template/.devcontainer/Dockerfile index fbb2f9004..24f648cf4 100644 --- a/template/.devcontainer/Dockerfile +++ b/template/.devcontainer/Dockerfile @@ -1,6 +1,6 @@ FROM node:lts AS node FROM hadolint/hadolint:latest-alpine AS hadolint -FROM ocaml/opam:debian-10-ocaml-4.14 +FROM ocaml/opam:debian-12-ocaml-5.4 USER root @@ -51,6 +51,9 @@ RUN ln -fs /usr/share/zoneinfo/Europe/Zurich /etc/localtime RUN bash -c 'echo "http 80/tcp www # WorldWideWeb HTTP" >> /etc/services' \ && bash -c 'echo "https 443/tcp www # WorldWideWeb HTTPS" >> /etc/services' +# link opam version +RUN ln -fs /usr/bin/opam-2.3 /usr/bin/opam + USER opam # install oh-my-zsh diff --git a/template/.devcontainer/devcontainer.json b/template/.devcontainer/devcontainer.json index 17704cfd4..729a32241 100644 --- a/template/.devcontainer/devcontainer.json +++ b/template/.devcontainer/devcontainer.json @@ -15,23 +15,34 @@ "postCreateCommand": "bash .devcontainer/postCreate.sh", // Use 'settings' to set *default* container specific settings.json values on container create. // You can edit these settings after create using File > Preferences > Settings > Remote. - "settings": { - "terminal.integrated.shell.linux": "/bin/zsh", - "editor.formatOnSave": true, - "files.associations": { - "*.ml": "ocaml", - "*.mli": "ocaml" - }, - "ocaml.sandbox": { - "kind": "global" + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/bin/zsh" + } + }, + "terminal.integrated.defaultProfile.linux": "zsh", + "editor.formatOnSave": true, + "files.associations": { + "*.ml": "ocaml", + "*.mli": "ocaml" + }, + "ocaml.sandbox": { + "kind": "global" + } + }, + // Add the IDs of extensions you want installed when the container is created in the array below. + "extensions": [ + "donjayamanne.githistory", + "eamodio.gitlens", + "exiasr.hadolint", + "irongeek.vscode-env", + "ocamllabs.ocaml-platform", + "DavidAnson.vscode-markdownlint", + "ms-vscode.makefile-tools" + ] } - }, - // Add the IDs of extensions you want installed when the container is created in the array below. - "extensions": [ - "donjayamanne.githistory", - "eamodio.gitlens", - "exiasr.hadolint", - "irongeek.vscode-env", - "ocamllabs.ocaml-platform" - ] + } } diff --git a/template/.devcontainer/postCreate.sh b/template/.devcontainer/postCreate.sh index 1846b5248..7dd1fc87b 100644 --- a/template/.devcontainer/postCreate.sh +++ b/template/.devcontainer/postCreate.sh @@ -1,4 +1,7 @@ -# ocaml/opam post create script +#!/bin/sh + +# immediately when a command fails and print each command +set -ex sudo chown -R opam: _build sudo chown -R opam: node_modules @@ -7,10 +10,6 @@ sudo chown -R opam: node_modules opam init -a --shell=zsh eval $(opam env) -# ensure all system dependencies are installed -opam pin add . --yes --no-action -opam depext -y app --with-doc - -# install opam packages used for vscode ocaml platform package -# e.g. when developing with emax, add also: utop merlin ocamlformat make deps + +yarn install diff --git a/template/.github/workflows/ci.yml b/template/.github/workflows/ci.yml index 71f546ec7..fc08a3eda 100644 --- a/template/.github/workflows/ci.yml +++ b/template/.github/workflows/ci.yml @@ -1,62 +1,65 @@ name: CI - on: [push, pull_request] - jobs: build: name: Build and test - runs-on: ${{ matrix.os }} - + services: + postgres: + image: postgres:12.2 + env: + POSTGRES_USER: admin + POSTGRES_PASSWORD: password + POSTGRES_DB: dev + ports: + - 5432:5432 + mariadb: + image: mariadb:10.3 + env: + MYSQL_USER: admin + MYSQL_PASSWORD: password + MYSQL_DATABASE: dev + MYSQL_RANDOM_ROOT_PASSWORD: "yes" + ports: + - 3306:3306 strategy: fail-fast: false matrix: os: - - macos-latest - ubuntu-latest - - windows-latest - ocaml-version: - - 4.11.1 - + ocaml-compiler: + - 4.14 + - 5.3 + - 5.4 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Retrieve opam cache - uses: actions/cache@v2 + uses: actions/cache@v4 if: runner.os != 'Windows' id: cache-opam with: path: ~/.opam - key: v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-${{ hashFiles('app.opam.locked') }} - restore-keys: | - v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}- + key: v1-${{ runner.os }}-opam-${{ matrix.ocaml-compiler }}-${{ hashFiles('*.opam.locked') }} - name: Use OCaml ${{ matrix.ocaml-version }} - uses: avsm/setup-ocaml@v1 + uses: ocaml/setup-ocaml@v3 with: - ocaml-version: ${{ matrix.ocaml-version }} - - - name: Update opam repository - if: steps.cache-opam.outputs.cache-hit != 'true' - run: opam update - - - name: Pin package - run: opam pin add app.dev . --no-action + ocaml-compiler: ${{ matrix.ocaml-compiler }} - - name: Query and install external dependencies - run: opam depext app --yes --with-doc --with-test + - name: Install system dependencies + run: sudo apt-get update -y && sudo apt-get install -y libmariadb-dev - name: Install dependencies - if: steps.cache-opam.outputs.cache-hit != 'true' - run: | - opam install . --deps-only --with-doc --with-test --locked --unlock-base - opam install ocamlformat --skip-updates + run: make deps - - name: Upgrade dependencies - run: opam upgrade --fixup + - name: Recover from an Opam broken state if: steps.cache-opam.outputs.cache-hit == 'true' + run: | + opam install -y dune + opam upgrade --fixup - name: Build run: make build @@ -65,5 +68,23 @@ jobs: run: make format - name: Run tests - run: make test + run: make test-all + + - name: Pin current Sihl + run: opam pin add sihl . + - name: Generate PostgreSQL model + run: | + cd template + ROOT_PATH=. LOGS_DIR=. make sihl gen.model postgresql employee title:string is_premium:bool age:int shipped_at:datetime + DATABASE_URL=postgres://admin:password@127.0.0.1:5432/dev ENV_FILES_PATH=. ROOT_PATH=. LOGS_DIR=. make test + + - name: Generate MariaDB model + run: | + cd template + rm -r app/domain/employee database/employee.ml test/employee + ROOT_PATH=. LOGS_DIR=. make sihl gen.model mariadb employee title:string is_premium:bool age:int shipped_at:datetime + echo "module Migration = Sihl.Database.Migration.MariaDb" > service/service.ml + echo "(executable (name run) (libraries sihl service routes database schedule command caqti-driver-mariadb))" > run/dune + opam install caqti-driver-mariadb + DATABASE_URL=mariadb://admin:password@127.0.0.1:3306/dev ENV_FILES_PATH=. ROOT_PATH=. LOGS_DIR=. make test diff --git a/template/Makefile b/template/Makefile index 4a290dabd..e36cb463f 100644 --- a/template/Makefile +++ b/template/Makefile @@ -10,8 +10,7 @@ all: .PHONY: deps deps: ## Install development dependencies - opam install -y dune-release merlin ocamlformat utop ocaml-lsp-server - opam install --deps-only --with-test --with-doc -y . + opam install --yes --with-doc --with-test --with-dev-setup --working-dir --update-invariant . npm install .PHONY: create_switch diff --git a/template/docker/Dockerfile b/template/docker/Dockerfile index 04b73258c..c1d740d16 100644 --- a/template/docker/Dockerfile +++ b/template/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ocaml/opam2:4.11 as builder +FROM ocaml/opam:debian-12-ocaml-5.4 as builder WORKDIR app COPY app.opam . COPY dune-project . @@ -10,15 +10,16 @@ COPY database database COPY public public COPY resources resources -RUN sudo apt-get update -y && \ - opam remote remove --all default && \ - opam remote add default https://opam.ocaml.org && \ - opam pin add -yn app . && \ - OPAMSOLVERTIMEOUT=180 opam depext -y app && \ - opam install --deps-only -y app && \ - sudo chown -R opam:nogroup . +USER root -RUN opam config exec -- dune build +RUN apt-get update -y \ + && ln -fs /usr/bin/opam-2.3 /usr/bin/opam \ + && chown -R opam:nogroup . + +USER opam + +RUN opam install --yes --working-dir --update-invariant . \ + && dune config exec -- dune build FROM debian:10 WORKDIR /app