ocaml / ocaml-ci-scripts

Skeletons for CI scripts
ISC License
101 stars 57 forks source link

Add documentation for Travis CI caches #251

Open hongchangwu opened 5 years ago

hongchangwu commented 5 years ago

The default configuration takes too long without caches. People have come with different caching configurations in practice. It will be good to document this.

liyishuai commented 5 years ago

Caching doesn't work, as the dependencies are always removed: https://github.com/ocaml/ocaml-ci-scripts/blob/c812b816699dbb5764e97c7235ce98dc8f1b6c1a/.travis-opam.sh#L31

ELLIOTTCABLE commented 5 years ago

What about for .travis-ocaml.sh? I'm not building an opam package. I was thinking about setting up a local opam switch, instead of a global one using the provided scripts here, and then cacheing _opam in the build-dir … but @hongchangwu mentions that other people have come up with other solutions?

Lysxia commented 5 years ago

I've been doing something like that. I didn't need to create a switch, just using the environment coming straight out of .travis-ocaml.sh, and handwriting the bare essential commands that would be performed afterwards by .travis-opam.sh. It's a bit less robust than what .travis-opam.sh does but it works 99% of the time and if something goes wrong the simplicity makes it easy to debug (in contrast, I have no idea of the right way to fix .travis-opam.sh to support caching).

Example .travis.yaml: https://github.com/DeepSpec/InteractionTrees/blob/f12aa7ce787ee0726433d48876b2ca0987d60b03/.travis.yml#L29-L43

If you're not building an opam package you can replace the last few lines with your own build commands.