Save opam's build cache on post
This significantly speeds up the build time of dependencies
It needed a tweak on the installer to install the depexts once the opam cache is loaded.
Aside from the step that installs ocaml is quite slow, so I'll look for more opportunities. xen-api's workflow using v1 is still faster when the caches are warm.
Notes:
-
OPAMCOLORis set toneverbecause on my tests it takes precedence over using--color=neverwhen invokingopam list. This ANSI codes appear in the output and cannot be used as parameters foropam depext. I've tried setting options.env for that call only, but failed to configure it correctly (command.env + override). I've also tried stripping the ANSI codes but the code that works locally doesn't work on the action and I'm not well acquainted with the environment to properly debug the issue. This is also avoidable by a command that does both:opam install --depext-only. unfortunately the command is only available in opam 2.1 and I've heard that's another can of worms - When the cache is loaded packages may need to be updated, once the pins have been put in place.
- The number of times pins are processed should be minimized, it's a O(n) operation, on xen-api it takes +20 seconds each time because of the number of opam files
@smorimoto what do I need to run to avoid the differing format for the .js files? None of the commands in package.json I run locally change these files.
EDIT: using yarn produces a different output from pnpm, that doesn't seem the issue, however 😑
I think the problem with doing this is that the cache hit rate is extremely low. I'm sure it easily causes something like thrashing.