Pleroma's CI is slow. This change makes is considerably faster. I'm using it in my fork and figured I'd share.
The following directories are cacheable:
Currently we invalidate cache based on the commit hash (
$CI_COMMIT_REF_SLUG). In other words, things are only cached across jobs of the same pipeline.
Instead of using the commit hash, we can use the
mix.lock file itself as the key. As long as
mix.lock is the same, we can safely assume the deps will be the same, and cache them across multiple pipelines.
_build is where it gets trickier. Building dependencies (phoenix, ecto, pbkdf2, etc) adds considerable build time. But we can cache
mix.lock too, and dependencies don't need to be recompiled unless
mix.lock changes. The downside is that Pleroma's build is also cached in
_build. Minor inconsistencies could potentially arise from that, but mix is smart enough to deal with it, so I think it's worth it for the speed boost.