Speeding up Elixir project build times on Travis CI
Elixir is fast, very fast. So fast that a good chunk of Continuous Integration jobs on Travis CI for our Phoenix projects were spent in fetching dependencies (this is very small, but still a few seconds) and then compiling all of the dependencies.
If you’re willing to deal with getting a failed build once in a while
then you can significantly speed up the CI jobs by caching certain
assets. Specifically the
This strategy can be used on any CI service but the example here is for
Travis CI. Simply add the following to your
cache: directories: - _build - deps
We saw a big reduction in total Pull Request CI test run time
Here is a comparison of the individual jobs
If you are getting a failing build when you believe you shouldn’t, the issue could be the cache. You can simply clear the cache and start it from scratch at any time.