Runs Dialyxir in your project.
-
Complete Setup Dialyxir in your project.
-
Make sure
actions/checkout
action is used before this action. -
Add this action to your job in your workflow, here is an example:
#... jobs: dialyzer: name: Run Dialyzer runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 # checkout the repository first - uses: straw-hat-team/github-actions-workflows/elixir/dialyzer@master with: elixir-version: '1.11' # optional, fallback to use .tool-versions otp-version: '22.3' # optional, fallback to use .tool-versions version-type: 'loose' # optional, fallback to strict
-
Ensure that Dialyxir dependency is present in your project. Check your
mix.exs
file.defmodule MyLibrary.MixProject do use Mix.Project def project do [ # ... deps: deps() ] end defp deps do [ # ... here, is an example of how to add it {:dialyxir, ">= 0.0.0", only: [:dev], runtime: false} ] end end
-
In your
mix.exs
, you must configure Dialyzer with the following settings:defmodule MyLibrary.MixProject do use Mix.Project def project do [ # ... dialyzer: [ # ... other dialyzer settings plt_file: {:no_warn, "priv/plts/dialyzer.plt"} ] ] end end
-
Make sure that
priv/plts
directory exists before running Dialyzer. Create a file calledpriv/plts/.gitkeep
and commit the file as part of your repository to make sure the directory exists at all time.# Creates priv/plts directory if it doesn't exists mkdir -p priv/plts # Create an empty file touch priv/plts/.gitkeep
-
You probably do not want to commit the
plts
files therefore add the following content to your.gitignore
file:/priv/plts/*.plt /priv/plts/*.plt.hash
If you see the following error:
:dialyzer.run error: No such file, directory or application: ".../_build/dev/dialyxir_erlang-..._elixir-..._deps-dev.plt"
- Verify the Dialyzer configuration. Follow Setup Dialyxir in your project guide.
If you see the following error:
** (Mix) The task "dialyzer" could not be found
- Verify that
dialyxir
dependency was added correctly. Follow Setup Dialyxir in your project guide.