ocaml-opam / Camelus

Bot posting reports on opam-repository pull-request using a web hook
Other
18 stars 9 forks source link

opam-ci: reports on repository pull-requests to guide merge decisions

This bot runs as an HTTP service that wakes up through a GitHub webhook. It's based on cohttp (and lwt) for the server part, ocaml-git for checking out the states corresponding to the pull-request, opam-lib (and dose) for linting and checking installable packages, and ocaml-github to post back the reports.

Dependencies: cohttp, conduit, opam-lib, git, yojson, github. The current version has been tested with:

The program expects a opam-ci.conf in the working directory, with the following format:

name: "opam-ci"
port: 8122
token: "xxx"
secret: "yyy"
repo-user: "ocaml"
repo-name: "opam"

The name and token correspond to the GitHub account and token to use (only public repository access is needed); repo-user: and repo-name: define the repository the service will be running on (here "ocaml/opam"). The port and secret should correspond to the webhook configuration, and the service is at /opam-ci, so your configuration in Github should look like:

The repository is cloned (bare) under name%repo.git/.git in the current directory, e.g. opam%opam-repository.git/.git.

NOTE: due to limitations of the current ocaml-git, cloning the repository may take up a lot of memory. To workaround, you can do it manually using git, but you also need to unpack:

cd opam%opam-repository.git/
git clone --bare https://github.com/ocaml/opam-repository.git .git
mv .git/objects/pack/* .
git unpack-objects <*.pack