diff --git a/.github/workflows/composite/test-code/action.yml b/.github/workflows/composite/test-code/action.yml index 1e9174df..44ebe3b9 100644 --- a/.github/workflows/composite/test-code/action.yml +++ b/.github/workflows/composite/test-code/action.yml @@ -11,6 +11,9 @@ runs: shell: bash run: mix compile --warnings-as-errors + - name: Run dialyzer + run: mix dialyzer --format github + - name: Check formatting shell: bash run: mix format --check-formatted diff --git a/.github/workflows/composite/test-setup/action.yml b/.github/workflows/composite/test-setup/action.yml index 0bb889d8..8f7e0bf3 100644 --- a/.github/workflows/composite/test-setup/action.yml +++ b/.github/workflows/composite/test-setup/action.yml @@ -5,6 +5,7 @@ runs: using: "composite" steps: - name: Set up Elixir + id: elixir-install uses: erlef/setup-beam@3ba5b86a2a6916f8cb0e64dcca30a56732a34bdf with: version-file: .tool-versions @@ -20,3 +21,33 @@ runs: - name: Install dependencies shell: bash run: mix deps.get --check-locked + + # Taken from dialyxir's documentation + # https://github.com/jeremyjh/dialyxir/blob/0091928de1ec01e30f82c50856f2dfe0a8f918ce/docs/github_actions.md + - name: Restore PLT cache + id: plt_cache + uses: actions/cache/restore@v3 + with: + key: | + plt-${{ runner.os }}-${{ steps.elixir-install.outputs.otp-version }}-${{ steps.elixir-install.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + plt-${{ runner.os }}-${{ steps.elixir-install.outputs.otp-version }}-${{ steps.elixir-install.outputs.elixir-version }}- + path: | + priv/plts + + # Create dialyzer's 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.elixir-install.outputs.otp-version }}-${{ steps.elixir-install.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }} + path: | + priv/plts