tweag / cooked-validators

MIT License
39 stars 11 forks source link

Make our development environment not depend on Ormolu 0.5.0.1 #356

Closed Niols closed 3 months ago

Niols commented 1 year ago

Problem

Our CI environment currently depends on Ormolu 0.5.0.1 via Haskell Language Server 1.8.0.0. This version of Ormolu requires a big amount of RAM to build correctly; too much for some machines and definitely too much for the GitHub Actions runner. This causes CI (and in particular the job CI / Cache all Nix dependencies) to fail when it needs to build Ormolu.

We should update our environment to use a more recent of Ormolu without this issue. Sadly, as of today, there is still not a recent-enough version of Haskell Language Server that bumped the dependency in Ormolu. We might actually be blocked here by the use of GHC 8.10.7 -- possibly there will not be a more recent version of HLS supporting it?

cf https://github.com/tweag/cooked-validators/issues/224 for some context and https://github.com/tweag/cooked-validators/pull/353 for a recent example

Mitigation

For now, we are using the fact that we can build Ormolu on other machines (eg. Tweag laptops or builders) that have enough RAM, push it to our Cachix instance, and then the other machines (including the GitHub Actions runners) will pull from that instead of trying to build. This is what made us mark https://github.com/tweag/cooked-validators/issues/224 as fixed at the time. Sometimes, Ormolu can get cleaned from the cache; this is what caused https://github.com/tweag/cooked-validators/pull/353 to cause issues recently. The mitigations are:

  1. If a PR does not have anything to do with the environment, then it is safe to ignore errors in CI / Cache all Nix dependencies.

  2. One can build Ormolu again and push it back to Cachix, with:

    $ nix develop --profile dev-profile -c true
    $ cachix push tweag-cooked-validators dev-profile