How to cache erlang builds on CI?

So are you running the “cache pull deps” step twice?

Once for each stage, yes. Otherwise mix complains about missing dependencies.

2 Likes

I can confirm that caching deps in addition to _build after running mix compile does result in no more recompilations. Lead to nice speed boost in our CircleCI builds.

Is this something which should be brought up with the rebar team? I think it’s counter intuitive that rebar places in deps on recompilation.

We were made aware of this recently and got it fixed. Didn’t realize all compilation wasn’t done to deps by mix :slight_smile:

The rebar3 version installed by mix should now be 3.13.1 which supports an additional argument of where to send output.

I’m not sure what version of mix uses the new output option… Will go look in a bit.

2 Likes

I’m not seeing a patch in elixir repo actually, so this may not be supported yet, but it is supported in rebar3.

Verified this is not yet supported in mix and likely won’t get attention until the end of May.

So if someone has time and wants to patch mix before then it’d be a great help. The change is to add -o <outputdir> where outputdir is the path to the dep under _build/ to the rebar3 bare compile command mix runs, if rebar3 version is >= 3.13.1 (or error if it fails with “invalid option” and tell the user to upgrade rebar3 I guess).

2 Likes