diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..54d7d11 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: build + +on: + pull_request: + workflow_dispatch: + push: + branches: + - main + +jobs: + build: + strategy: + matrix: + os: + # - ubuntu-latest (already in test) + - macos-latest + # - windows-latest (libmongoc not available through cygwin) + ocaml-compiler: + - 5.3.0 + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Setup OCaml ${{ matrix.ocaml-version }} + uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + + - name: Opam dependencies + run: opam install --deps-only -t . + + - name: Runtest + run: opam exec -- dune build @all diff --git a/.github/workflows/deploy-odoc.yml b/.github/workflows/deploy-odoc.yml new file mode 100644 index 0000000..d349f5e --- /dev/null +++ b/.github/workflows/deploy-odoc.yml @@ -0,0 +1,54 @@ +name: Deploy documentation to GitHub Pages + +on: + push: + branches: + - main + +permissions: read-all + +concurrency: + group: deploy-odoc + cancel-in-progress: true + +jobs: + deploy-odoc: + name: Deploy odoc to GitHub Pages + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + permissions: + contents: read + id-token: write + pages: write + + runs-on: ubuntu-latest + + steps: + - name: Checkout tree + uses: actions/checkout@v4 + + - name: Set-up OCaml + uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: "5.3.0" + + - name: Install dependencies + run: opam install . --deps-only --with-doc + + - name: Build documentation + run: opam exec -- dune build @doc + + - name: Set-up Pages + uses: actions/configure-pages@v4 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: _build/default/_doc/_html + + - name: Deploy odoc to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..505e67a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: test + +on: + pull_request: + workflow_dispatch: + push: + branches: + - main + +jobs: + build: + strategy: + matrix: + os: + - ubuntu-latest + ocaml-compiler: + - 5.3.0 + + runs-on: ${{ matrix.os }} + + steps: + - name: Install mongosh + run: | + sudo apt-get install -y wget gnupg + wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list + sudo apt-get update + sudo apt-get install -y mongodb-mongosh + + - uses: actions/checkout@v2 + + - name: Setup OCaml ${{ matrix.ocaml-version }} + uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + + - name: Opam dependencies + run: opam install --deps-only -t . + + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.12.0 + with: + mongodb-version: "8.0" + + - name: Runtest + run: opam exec -- dune runtest diff --git a/bin/omont.t b/bin/omont.t index 2c17fb0..10c7440 100644 --- a/bin/omont.t +++ b/bin/omont.t @@ -3,7 +3,6 @@ $ ./omong.exe list admin.system.version - bitcoin.price_2017_2023 config.system.sessions local.startup_log @@ -124,7 +123,6 @@ $ mongosh list.js admin.system.version - bitcoin.price_2017_2023 config.system.sessions local.startup_log diff --git a/conf-libmongoc.opam b/conf-libmongoc.opam new file mode 100644 index 0000000..91edb93 --- /dev/null +++ b/conf-libmongoc.opam @@ -0,0 +1,19 @@ +# This file is generated by dune, edit dune-project instead + +opam-version: "2.0" +maintainer: "Tarides " +bug-reports: "https://github.com/ocaml/opam-repository/issues" +authors: ["MongoDB"] +homepage: "https://www.mongodb.com/docs/drivers/c/" +license: "Apache-2.0" +build: ["pkg-config" "libmongoc"] +depends: ["conf-pkg-config" {build}] +depexts: [ + ["libmongoc-dev"] {os-family = "debian" | os-family = "ubuntu"} + ["mongo-c-driver-devel"] {os-distribution = "fedora"} + ["mongo-c-driver"] {os-distribution = "arch" | os = "freebsd" | os = "macos"} + ["mongo-c-driver-dev"] {os-distribution = "alpine"} +] +synopsis: "Virtual package relying on a libmongoc system installation" +description: "This package can only install if libmongoc is installed on the system." +flags: conf diff --git a/conf-libmongoc.opam.template b/conf-libmongoc.opam.template new file mode 100644 index 0000000..4ebc686 --- /dev/null +++ b/conf-libmongoc.opam.template @@ -0,0 +1,17 @@ +opam-version: "2.0" +maintainer: "Tarides " +bug-reports: "https://github.com/ocaml/opam-repository/issues" +authors: ["MongoDB"] +homepage: "https://www.mongodb.com/docs/drivers/c/" +license: "Apache-2.0" +build: ["pkg-config" "libmongoc"] +depends: ["conf-pkg-config" {build}] +depexts: [ + ["libmongoc-dev"] {os-family = "debian" | os-family = "ubuntu"} + ["mongo-c-driver-devel"] {os-distribution = "fedora"} + ["mongo-c-driver"] {os-distribution = "arch" | os = "freebsd" | os = "macos"} + ["mongo-c-driver-dev"] {os-distribution = "alpine"} +] +synopsis: "Virtual package relying on a libmongoc system installation" +description: "This package can only install if libmongoc is installed on the system." +flags: conf diff --git a/dune-project b/dune-project index 2655fd7..1fe03a3 100644 --- a/dune-project +++ b/dune-project @@ -1,17 +1,27 @@ (lang dune 3.16) + (using ctypes 0.3) + (name mongoc) + (generate_opam_files true) + (package (name mongoc) (synopsis "OCaml binding of the libmongoc library") (description "OCaml binding of the MongoDB client library for C, libmongoc") (maintainers "Cuihtlauac ALVARADO") (authors "Cuihtlauac ALVARADO") - (source (github tarides/mongoc-ocaml)) + (source + (github tarides/mongoc-ocaml)) (license ISC) (depends (dune :build) (ocamlformat :build) cmdliner - ctypes)) + ctypes + conf-libmongoc)) + +(package + (name conf-libmongoc) + (allow_empty)) diff --git a/mongoc.opam b/mongoc.opam index 56f32f9..773acd9 100644 --- a/mongoc.opam +++ b/mongoc.opam @@ -12,6 +12,7 @@ depends: [ "ocamlformat" {build} "cmdliner" "ctypes" + "conf-libmongoc" "odoc" {with-doc} ] build: [