diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..18d8f90 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + spec_lint: + name: Compile and spec_lint + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + elixir-version: '1.20.4' + otp-version: '29' + - uses: actions/cache@v4 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix- + - run: mix deps.get + - run: mix compile --warnings-as-errors + - run: mix format --check-formatted + - run: mix spec_lint + - uses: actions/cache@v4 + with: + path: priv/plts + key: ${{ runner.os }}-plt-29-1.20.4-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-plt-29-1.20.4- + - run: mix dialyzer --format github diff --git a/.gitignore b/.gitignore index a11738a..83c24eb 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ dap_codegen-*.tar # Temporary files, for example, from tests. /tmp/ +/priv/plts/ diff --git a/mix.exs b/mix.exs index 7bae229..72dd1ad 100644 --- a/mix.exs +++ b/mix.exs @@ -7,7 +7,8 @@ defmodule DAPCodegen.MixProject do version: "0.1.0", elixir: "~> 1.14", start_permanent: Mix.env() == :prod, - deps: deps() + deps: deps(), + dialyzer: [plt_local_path: "priv/plts", plt_core_path: "priv/plts"] ] end @@ -23,7 +24,8 @@ defmodule DAPCodegen.MixProject do [ {:jason, "~> 1.4"}, {:typed_struct, "~> 0.3"}, - {:dialyxir, "~> 1.4", only: [:dev], runtime: false} + {:dialyxir, "~> 1.4", only: [:dev], runtime: false}, + {:spec_lint, "~> 0.1", only: [:dev, :test], runtime: false} ] end end diff --git a/mix.lock b/mix.lock index 8d8644f..51ed829 100644 --- a/mix.lock +++ b/mix.lock @@ -2,5 +2,6 @@ "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, + "spec_lint": {:hex, :spec_lint, "0.1.1", "e40649140dc96a32a2d4a7b98e8fbd3035d138b87154a35716f2cca76955cdae", [:mix], [], "hexpm", "67d7cc8d2e2cb29595518ee042b470a71de619ca250440e526c7987e06adeada"}, "typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"}, }