Skip to content

Commit

Permalink
add dialyzer and split formatter to one version only (#66)
Browse files Browse the repository at this point in the history
* add dialyzer and split formatter to one version only

* fix formatter to use proper MIX_ENV

* update mix to support cache. hopefully no issue long terms
  • Loading branch information
epinault authored Dec 4, 2024
1 parent 6ca7609 commit 2f6fd4e
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 7 deletions.
90 changes: 85 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ jobs:
matrix:
os: [ubuntu-22.04]
elixir_version: [1.15, 1.16, 1.17]
otp_version: [25, 26, 27]
otp_version: [ 25, 26, 27]
exclude:
- otp_version: 27
elixir_version: 1.15
- otp_version: 27
elixir_version: 1.16

steps:
- uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp_version}}
elixir-version: ${{matrix.elixir_version}}
Expand All @@ -44,8 +47,6 @@ jobs:
- run: mix deps.get

- run: mix format --check-formatted

- run: mix deps.unlock --check-unused

- run: mix deps.compile
Expand All @@ -56,5 +57,84 @@ jobs:

- run: mix test --warnings-as-errors --cover

dialyzer:
runs-on: ubuntu-22.04
env:
MIX_ENV: dev

steps:
- uses: actions/checkout@v4

- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: 1.16
otp-version: 26

- uses: actions/cache@v4
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}
- run: mix deps.get

- name: Restore PLT cache
id: plt_cache_restore
uses: actions/cache/restore@v3
with:
key: |
plts-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
plts-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
path: |
priv/plts
- name: Create PLTs
if: steps.plt_cache_restore.outputs.cache-hit != 'true'
run: mix dialyzer --plt

- name: Save PLT cache
id: plt_cache_save
if: steps.plt_cache_restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
key: |
plts-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
path: |
priv/plts
- name: Run dialyzer
run: mix dialyzer --format github
run: mix dialyzer --format github --format dialyxir

check_format:
runs-on: ubuntu-22.04
env:
MIX_ENV: dev

steps:
- uses: actions/checkout@v4

- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: 1.16
otp-version: 26

- uses: actions/cache@v4
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}
- run: mix deps.get

- run: mix format --check-formatted
10 changes: 8 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ defmodule GraphqlMarkdown.MixProject do
docs: docs(),
package: package(),
test_coverage: [summary: [threshold: 85]],
dialyzer: [plt_add_apps: [:mix]]
dialyzer: [
ignore_warnings: ".dialyzer.ignore-warnings",
list_unused_filters: true,
plt_add_apps: [:mix],
plt_file: {:no_warn, "priv/plts/project.plt"},
plt_core_path: "priv/plts/core.plt"
]
]
end

Expand All @@ -31,7 +37,7 @@ defmodule GraphqlMarkdown.MixProject do
defp deps do
[
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev], runtime: false},
{:ex_doc, "~> 0.30", only: [:dev, :test], runtime: false},
{:jason, "~> 1.4"}
]
Expand Down

0 comments on commit 2f6fd4e

Please sign in to comment.