There’s a lot of things that could be done with Elixir. In this article, we are going to demonstrate how to use GitHub Actions in an Elixir project.
The Dockerfile for the action is relatively straightforward. It is based on the “elixir” image, and makes just a couple of small changes.
So that’s an overview of how Mix action works:
- Build from the Elixir image.
$MIX_HOMEso that it isn’t overridden at runtime.
- Use an entrypoint script for shell variable expansion.
Adding an action for running the tests is easy. Use the mix action again, except this time “args” is simply “test”, for running
mix test. The final action is adding to this workflow to check our formatting using
mix format. Since the project’s dependencies are not necessary for formatting code, you can run the format action from the root of the workflow, rather than waiting for dependencies to be fetched.
Check here for examples.
Read more about building an Elixir HTTP server.