CI, Elixir and mix.lock

Elixir’s mix.lock file is used to store information on all the dependencies for your application. It should be checked into source control just like your mix.exs file.

If you are coming from other languages you probably have seen this same concept. For example, in Python there is the Pipfile and the Pipfile.lock. In Ruby there is the Gemfile and the Gemfile.lock. In Javascript there is the package-lock.json.

I recommend for continuous integration (CI) for Elixir you should use the command:

mix deps.get --check-locked

This is available in v1.15.0 and greater. It will raise if there are pending changes to the lockfile. This works to ensure the lock file that you check into source control is the one that is being used to build your released software.

See the documentation at https://hexdocs.pm/mix/Mix.Tasks.Deps.Get.html.




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Elixir/OTP Supervision
  • Elixir and Ecto's telemetry events
  • Elixir And Design Patterns
  • Elixir and Dependencies
  • Elixir, Phoenix Framework and Datatables