diff --git a/README.md b/README.md index 9bff5a1..1c3c600 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ To use Dialyzer in CI, you must be aware of several things: 2) The PLT should be cached using the CI caching system 3) The PLT will need to be rebuilt whenever adding a new Erlang or Elixir version to build matrix -Using Travis, this would look like: +### Travis `.travis.yml` ```markdown @@ -101,6 +101,43 @@ cache: - priv/plts ``` +### Github Actions + +`dialyzer.yml` +```yaml +... + steps: + - uses: actions/checkout@v2 + - name: Set up Elixir + id: beam + uses: erlef/setup-beam@v1 + with: + elixir-version: "1.12.3" # Define the elixir version + otp-version: "24.1" # Define the OTP version + + # Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones + # Cache key based on Elixir & Erlang version (also usefull when running in matrix) + - name: Restore PLT cache + uses: actions/cache@v2 + id: plt_cache + with: + key: | + ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt + restore-keys: | + ${{ runner.os }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt + path: | + priv/plts + + # Create PLTs if no cache was found + - name: Create PLTs + if: steps.plt_cache.outputs.cache-hit != 'true' + run: mix dialyzer --plt + + - name: Run dialyzer + run: mix dialyzer + +``` + `mix.exs` ```elixir def project do