Is there a way to run the OPAM CI battery of tests locally?

Before I release a package, I’d like to run all the tests that the opam CI process will run, to whatever extent that’s possible on my machine. I understand that I can’t run (e.g.) the MacOS test on my Linux box, and ditto the arm/powerpc/s390 tests on my x86 box, but there’s a large battery of tests (all the lower/upper bounds tests, all the revdeps, all the compiler versions) that ought to be runnable on my laptop. Is there some way to do that locally?

I hate the idea of submitting a PR and having to revise it a few times, b/c I screwed things up, forgot a dep/revdep, etc, etc. Just wasted cycles in the CI cloud, when I have the cycles right here on my dev server.

1 Like

A first step would be (the details may be slightly wrong):

cd mylib
opam pin add . 
opam install --best-effort --with-test $(opam list -s --depends-on mylib)

Oh, I do that. What I really want, is all the high/low-version tests, and building with multiple compilers, etc. I do the latter manually – with scripts to teardown/setup N different compiler versions, then do installs of packages in those switches, etc. And sure, I could figure out how to compute all the various deps/version-ranges/revdeps but that’s what the OPAM-CI does, so I figured, it might be nice if there were a way to piggyback on that.

Aha. Then you might get something out of the instructions in this README.

ah, yes. Time to roll up my sleeves and get this running! Thank you!

Start with the dune exec -- ocaml-ci-local command, which will run some of the steps as local builds against docker (Linux x86). Running the full stack with a remote cluster is more involved and probably not useful for simple use cases. I can provide a docker-compose to run a full stack if you are interested in what that looks like.

For example running ocaml-ci-local against ocaml-ci gives this build graph.