From e772008a2e8183366058f97578e345ee84973660 Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Fri, 8 Apr 2022 19:03:46 +0200 Subject: [PATCH] ci: Fix dialyzer cache --- .github/workflows/test.yml | 39 ++++++++++++++++++++++++++++---------- mix.exs | 2 +- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4fbfe9a..c77102f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,13 @@ name: Test -on: push - +on: + pull_request: + types: + - opened + - synchronize + - reopened + push: + branches: + - main jobs: unit-test: runs-on: ubuntu-latest @@ -38,6 +45,7 @@ jobs: - run: mix deps.get - run: mix credo dialyzer: + name: Run Dialyzer for type checking runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -47,15 +55,26 @@ jobs: with: path: deps key: ${{ runner.os }}-deps - - name: Cache PLT - id: cache-plt - uses: actions/cache@v2 - with: - path: priv/plts - key: ${{ runner.os }}-plts - uses: erlef/setup-beam@v1 + id: beam with: otp-version: "22.2" elixir-version: "1.9.4" - - run: mix deps.get - - run: mix dialyzer + - name: Fetch dependencies + run: mix deps.get + - 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 diff --git a/mix.exs b/mix.exs index 88b9216..69e2016 100644 --- a/mix.exs +++ b/mix.exs @@ -36,7 +36,7 @@ defmodule Atomex.MixProject do # Dev {:credo, "~> 1.5", only: [:dev, :test], runtime: false}, - {:dialyxir, "~> 1.0", only: :dev, runtime: false}, + {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}, {:earmark, "~> 1.4", only: :dev, runtime: false}, {:ex_doc, "~> 0.23", only: :dev, runtime: false}, {:excoveralls, "~> 0.13", only: :test},