Qqwy

Qqwy

TypeCheck Core Team

How to cache the Elixir compilation on Travic CI?

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.

Marked As Solved

NobbZ

NobbZ

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.

Also Liked

Qqwy

Qqwy

TypeCheck Core Team

Ah, I see! :heart_eyes:

Awesome! With this change, any build only takes about a minute, rather than almost four :sunglasses:.

sorentwo

sorentwo

Oban Core Team

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.

Where Next?

Popular in Questions Top

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement