Skip to content

Latest commit

 

History

History
51 lines (44 loc) · 1.86 KB

github_actions.md

File metadata and controls

51 lines (44 loc) · 1.86 KB

Github Actions

steps:
  - name: Check out source
    uses: actions/checkout@v2

  - name: Set up Elixir
    id: beam
    uses: erlef/setup-beam@v1
    with:
      otp-version: "24.1" # Define the OTP version
      elixir-version: "1.12.3" # Define the Elixir version

   # Cache key based on Erlang/Elixir version and the mix.lock hash
  - name: Restore PLT cache
    id: plt_cache
    uses: actions/cache/restore@v3
    with:
      key: |
        plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
      restore-keys: |
        plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
      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
     
  # By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
  # so we separate the cache restore and save steps in case running dialyzer fails.
  - name: Save PLT cache
    id: plt_cache_save
    uses: actions/cache/save@v3
    if: steps.plt_cache.outputs.cache-hit != 'true'
    with:
      key: |
        plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
      path: |
        priv/plts

  - name: Run dialyzer
    # Two formats are included for ease of debugging and it is lightly recommended to use both, see https://github.com/jeremyjh/dialyxir/issues/530 for reasoning
    # --format github is helpful to print the warnings in a way that GitHub understands and can place on the /files page of a PR
    # --format dialyxir allows the raw GitHub actions logs to be useful because they have the full warning printed
    run: mix dialyzer --format github --format dialyxir

# ...