We’re adding continuous integration to our application.
@sorentwo was able to give me some advice to split up the testing into separate stages, but the main issue: compilation time having a huge impact on CI-execution times, remains.
Currently, running the test takes about 20 seconds. However, compiling the project from scratch the first time takes a whopping 140 seconds. On Travis CI, this compilation is done on every test run, significantly slowing down the feedback loop.
I’ve tried to cache the compilation/build artefacts by adding the
_build-directory to the Travis CI cache, but I’m not sure if I either made a mistake in how Travis’ caching configuration should be used, or in how Mix decides to re-compile your dependencies, because it is still compiling everything during every test run.
see for instance this test run
The Travis CI config that is currently being used can be found here.
You have not added
deps to the cache, so you have to re-download the dependencies again each time, and as you have recently downloaded them the compiler will recompile them. And as deps are recompiled, your own application will as well.
Ah, I see!
Awesome! With this change, any build only takes about a minute, rather than almost four .
Ah, of course, caching the deps makes total sense. In our CircleCI builds we cache the deps and _build directories using their powerful but highly obtuse build configuration. It didn’t occur to me to do the same for Travis.