Towards more reliable CI

Context

It is possible to make CI much more reliable by caching the ~/.elm directory. The directory contains:

  1. Immutable files. All package content is hashed on publication, so downloading requires that the content exactly matches that hash. They will be the same for all downloads.
  2. Deterministic artifacts. Certain build artifacts can be pre-compiled for each package, so those are also stored in ~/.elm. These are deterministic based on the aforementioned immutable files.

Caching these files means that you basically never make HTTP requests to package.elm-lang.org or to github.com, so your builds will be faster and more reliable.

Help with Instructions

This repo is an effort to centralize instructions on how to set up ELM_HOME caching with different CI services:

If you have expertise with a CI system that is not covered, please share a draft recommendation for that system!

Future Plans

It seems that it is fairly easy to detect if elm is running on CI (like here and here) so it may make sense to provide a BIG WARNING in CI when packages are getting downloaded. (This should only happen when new packages are added, so very very rarely.) So it makes sense to try to get the setup instructions in good order before taking more concrete steps in this direction.

18 Likes

:see_no_evil_monkey: Volkswagen detects when your tests are being run in a CI server, and makes them pass.

What a tribute ! Love it.

Great effort thanks a lot.

Anyway I think there might be a problem with some of the recommendations. I’ve opened issue in the repository where we can clarify this.

I think it’s fair to give some head ups in here in case there are people who went and applied some of these setting in their projects - if you see weird behavior go look into issues in the repo.