From 86b4c433b964fb6f26e7904aa88fcde09526b92d Mon Sep 17 00:00:00 2001 From: Andreas Lappe Date: Fri, 17 Apr 2020 16:35:51 +0200 Subject: [PATCH 01/30] fix: Keep `_` in patterns --- lib/erlex.ex | 2 +- test/literals_pretty_print_test.exs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/erlex.ex b/lib/erlex.ex index a234614..e8a9a16 100644 --- a/lib/erlex.ex +++ b/lib/erlex.ex @@ -572,7 +572,7 @@ defmodule Erlex do end end - defp atomize(<>) when is_number(atom) do + defp atomize(<>) when is_number(atom) and atom != 95 do "#{atom}" end diff --git a/test/literals_pretty_print_test.exs b/test/literals_pretty_print_test.exs index 4f5e827..503b3b2 100644 --- a/test/literals_pretty_print_test.exs +++ b/test/literals_pretty_print_test.exs @@ -131,4 +131,11 @@ defmodule Erlex.Test.LiteralsPretyPrintTest do assert pretty_printed == "<<_ :: 8, _ :: size(1)>>, false" end + + test "keep underscore in pattern" do + input = "{'embed', __@3, __@4}" + pretty_printed = Erlex.pretty_print_type(input) + + assert pretty_printed == "{:embed, _, _}" + end end From 0af59aba9b64bda57ab00ebe233273b2595cb97d Mon Sep 17 00:00:00 2001 From: Marcel Otto Date: Wed, 20 Dec 2023 20:36:51 +0100 Subject: [PATCH 02/30] Rename lexer and parser to prevent conflicts --- .gitignore | 4 ++-- lib/erlex.ex | 4 ++-- mix.exs | 4 ++-- src/{lexer.xrl => erlex_lexer.xrl} | 0 src/{parser.yrl => erlex_parser.yrl} | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename src/{lexer.xrl => erlex_lexer.xrl} (100%) rename src/{parser.yrl => erlex_parser.yrl} (100%) diff --git a/.gitignore b/.gitignore index a816991..77c5d95 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ erl_crash.dump *.ez erlex-*.tar .elixir_ls -src/parser.erl -src/lexer.erl +src/erlex_parser.erl +src/erlex_lexer.erl /priv/plts/ \ No newline at end of file diff --git a/lib/erlex.ex b/lib/erlex.ex index 624af8a..cde954e 100644 --- a/lib/erlex.ex +++ b/lib/erlex.ex @@ -42,7 +42,7 @@ defmodule Erlex do defp lex(str) do try do - {:ok, tokens, _} = :lexer.string(str) + {:ok, tokens, _} = :erlex_lexer.string(str) tokens rescue _ -> @@ -52,7 +52,7 @@ defmodule Erlex do defp parse(tokens) do try do - {:ok, [first | _]} = :parser.parse(tokens) + {:ok, [first | _]} = :erlex_parser.parse(tokens) first rescue _ -> diff --git a/mix.exs b/mix.exs index ca7cb01..1102f19 100644 --- a/mix.exs +++ b/mix.exs @@ -66,8 +66,8 @@ defmodule Erlex.MixProject do "mix.exs", "README.md", "LICENSE.md", - "src/lexer.xrl", - "src/parser.yrl" + "src/erlex_lexer.xrl", + "src/erlex_parser.yrl" ], maintainers: ["Andrew Summers"], licenses: ["Apache-2.0"], diff --git a/src/lexer.xrl b/src/erlex_lexer.xrl similarity index 100% rename from src/lexer.xrl rename to src/erlex_lexer.xrl diff --git a/src/parser.yrl b/src/erlex_parser.yrl similarity index 100% rename from src/parser.yrl rename to src/erlex_parser.yrl From d324893cea2b3b4d8dac8f87d8f9de5b225f0d8b Mon Sep 17 00:00:00 2001 From: Brad Hanks Date: Mon, 1 Jan 2024 14:21:15 -0700 Subject: [PATCH 03/30] replace '' with ~c to silence warnings --- lib/erlex.ex | 64 ++++++++++++++++++++++++-------------- test/pretty_print_test.exs | 6 ++-- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/lib/erlex.ex b/lib/erlex.ex index 624af8a..7be2461 100644 --- a/lib/erlex.ex +++ b/lib/erlex.ex @@ -70,10 +70,10 @@ defmodule Erlex do end @spec pretty_print_infix(infix :: String.t()) :: String.t() - def pretty_print_infix('=:='), do: "===" - def pretty_print_infix('=/='), do: "!==" - def pretty_print_infix('/='), do: "!=" - def pretty_print_infix('=<'), do: "<=" + def pretty_print_infix(~c"=:="), do: "===" + def pretty_print_infix(~c"=/="), do: "!==" + def pretty_print_infix(~c"/="), do: "!=" + def pretty_print_infix(~c"=<"), do: "<=" def pretty_print_infix(infix), do: to_string(infix) @spec pretty_print(str :: String.t()) :: String.t() @@ -93,7 +93,7 @@ defmodule Erlex do end @spec pretty_print_pattern(pattern :: String.t()) :: String.t() - def pretty_print_pattern('pattern ' ++ rest) do + def pretty_print_pattern(~c"pattern " ++ rest) do pretty_print_type(rest) end @@ -217,7 +217,7 @@ defmodule Erlex do "_" end - defp do_pretty_print({:atom, ['_']}) do + defp do_pretty_print({:atom, [~c"_"]}) do "_" end @@ -291,7 +291,7 @@ defmodule Erlex do {:list, :square, [ tuple: [ - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}, {:atom, [:_]} ] ]} @@ -303,7 +303,7 @@ defmodule Erlex do {:list, :square, [ tuple: [ - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}, t ] ]} @@ -322,7 +322,7 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__struct__\''}, {:atom, [:_]}}, + {:map_entry, {:atom, ~c{'__struct__'}}, {:atom, [:_]}}, {:map_entry, {:atom, [:_]}, {:atom, [:_]}} ]} ) do @@ -332,9 +332,10 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__struct__\''}, - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}}, - {:map_entry, {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}, {:atom, [:_]}} + {:map_entry, {:atom, ~c{'__struct__'}}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}}, + {:map_entry, {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}, + {:atom, [:_]}} ]} ) do "struct()" @@ -343,8 +344,8 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__struct__\''}, - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}}, + {:map_entry, {:atom, ~c{'__struct__'}}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}}, {:map_entry, {:atom, [:_]}, {:atom, [:_]}} ]} ) do @@ -354,8 +355,8 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__exception__\''}, {:atom, '\'true\''}}, - {:map_entry, {:atom, '\'__struct__\''}, {:atom, [:_]}}, + {:map_entry, {:atom, ~c{'__exception__'}}, {:atom, ~c{'true'}}}, + {:map_entry, {:atom, ~c{'__struct__'}}, {:atom, [:_]}}, {:map_entry, {:atom, [:_]}, {:atom, [:_]}} ]} ) do @@ -396,7 +397,7 @@ defmodule Erlex do defp do_pretty_print({:named_type, named_type, type}) when is_tuple(named_type) do case named_type do - {:atom, name = '\'Elixir' ++ _} -> + {:atom, name = ~c{'Elixir} ++ _} -> "#{atomize(name)}.#{deatomize(type)}()" {:atom, name} -> @@ -417,15 +418,32 @@ defmodule Erlex do end defp do_pretty_print( - {:pipe_list, {:atom, ['f', 'a', 'l', 's', 'e']}, {:atom, ['t', 'r', 'u', 'e']}} + {:pipe_list, {:atom, [~c"f", ~c"a", ~c"l", ~c"s", ~c"e"]}, + {:atom, [~c"t", ~c"r", ~c"u", ~c"e"]}} ) do "boolean()" end defp do_pretty_print( - {:pipe_list, {:atom, '\'infinity\''}, - {:type_list, ['n', 'o', 'n', :_, 'n', 'e', 'g', :_, 'i', 'n', 't', 'e', 'g', 'e', 'r'], - {:list, :paren, []}}} + {:pipe_list, {:atom, ~c{'infinity'}}, + {:type_list, + [ + ~c"n", + ~c"o", + ~c"n", + :_, + ~c"n", + ~c"e", + ~c"g", + :_, + ~c"i", + ~c"n", + ~c"t", + ~c"e", + ~c"g", + ~c"e", + ~c"r" + ], {:list, :paren, []}}} ) do "timeout()" end @@ -580,7 +598,7 @@ defmodule Erlex do %{name: name, entries: Enum.reverse(entries)} end - defp struct_part({:map_entry, {:atom, '\'__struct__\''}, {:atom, name}}, struct_parts) do + defp struct_part({:map_entry, {:atom, ~c{'__struct__'}}, {:atom, name}}, struct_parts) do name = name |> atomize() @@ -593,7 +611,7 @@ defmodule Erlex do Map.put(struct_parts, :entries, [entry | entries]) end - defp deatomize([:_, :_, '@', {:int, _}]) do + defp deatomize([:_, :_, ~c"@", {:int, _}]) do "_" end diff --git a/test/pretty_print_test.exs b/test/pretty_print_test.exs index 2943f92..079b401 100644 --- a/test/pretty_print_test.exs +++ b/test/pretty_print_test.exs @@ -114,7 +114,7 @@ defmodule Erlex.Test.PretyPrintTest do end test "patterns get pretty printed appropriately" do - input = 'pattern {\'ok\', Vuser@1}' + input = ~c"pattern {\'ok\', Vuser@1}" pretty_printed = Erlex.pretty_print_pattern(input) expected_output = "{:ok, user}" @@ -221,7 +221,7 @@ defmodule Erlex.Test.PretyPrintTest do end test "modules with numbers are pretty printed appropriately" do - input = 'Elixir.Project.Resources.Components.V1.Actions' + input = ~c"Elixir.Project.Resources.Components.V1.Actions" pretty_printed = Erlex.pretty_print(input) @@ -250,7 +250,7 @@ defmodule Erlex.Test.PretyPrintTest do end test "elixir SSA numbered variables get pretty printed appropriately" do - input = '_money@1' + input = ~c"_money@1" pretty_printed = Erlex.pretty_print(input) From dd19b2d8e13ae1cfa975b4a0a151966673fe58f1 Mon Sep 17 00:00:00 2001 From: Brad Hanks Date: Mon, 1 Jan 2024 14:24:59 -0700 Subject: [PATCH 04/30] warning: in order to compile .xrl files, you must add "compilers: [:leex] ++ Mix.compilers()" to the "def project" section of erlex's mix.exs \n warning: in order to compile .yrl files, you must add "compilers: [:yecc] ++ Mix.compilers()" to the "def project" section of erlex's mix.exs \n warning: use Mix.Config is deprecated. Use the Config module instead --- config/config.exs | 2 +- mix.exs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/config.exs b/config/config.exs index d2d855e..becde76 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1 +1 @@ -use Mix.Config +import Config diff --git a/mix.exs b/mix.exs index ca7cb01..5ba3105 100644 --- a/mix.exs +++ b/mix.exs @@ -14,7 +14,8 @@ defmodule Erlex.MixProject do description: description(), package: package(), docs: docs(), - dialyzer: dialyzer() + dialyzer: dialyzer(), + compilers: [:leex, :yecc] ++ Mix.compilers() ] end From a90f4613a8fa690ffd18c58e2265b8de2543e64f Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 15:24:53 -0500 Subject: [PATCH 05/30] Update links --- CONTRIBUTING.md | 6 +++--- README.md | 14 +++++++------- mix.exs | 7 +++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7148f2f..902ed27 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ absolutely appreciate any and all help. ## Issues -Please file issues [here](https://github.com/asummers/erlex/issues) +Please file issues [here](https://github.com/christhekeele/erlex/issues) ## Documentation @@ -17,7 +17,7 @@ file an issue or submit a pull request! ## Development Contributions Take a look at the open issues -[here](https://github.com/asummers/erlex/issues) and post that you +[here](https://github.com/christhekeele/erlex/issues) and post that you plan on working on an issue, so we can discuss approaches and make sure there isn't duplicated work happening. @@ -38,4 +38,4 @@ this, that's okay. We will work through it in pull request. ## Code of Conduct -Be sure to read and follow the [code of conduct](https://github.com/asummers/erlex/blob/master/code-of-conduct.md). +Be sure to read and follow the [code of conduct](https://github.com/christhekeele/erlex/blob/master/code-of-conduct.md). diff --git a/README.md b/README.md index 1dedd9f..d0ef23b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ [![Hex version badge](https://img.shields.io/hexpm/v/erlex.svg)](https://hex.pm/packages/erlex) [![Hex docs badge](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/erlex/) [![Total download badge](https://img.shields.io/hexpm/dt/erlex.svg)](https://hex.pm/packages/erlex) -[![License badge](https://img.shields.io/hexpm/l/erlex.svg)](https://github.com/asummers/erlex/blob/master/LICENSE.md) -[![Build status badge](https://img.shields.io/circleci/project/github/asummers/erlex/master.svg)](https://circleci.com/gh/asummers/erlex/tree/master) -[![Code coverage badge](https://img.shields.io/codecov/c/github/asummers/erlex/master.svg)](https://codecov.io/gh/asummers/erlex/branch/master) -[![Last Updated badge](https://img.shields.io/github/last-commit/asummers/erlex.svg)](https://github.com/asummers/erlex/commits/master) +[![License badge](https://img.shields.io/hexpm/l/erlex.svg)](https://github.com/christhekeele/erlex/blob/master/LICENSE.md) +[![Build status badge](https://img.shields.io/circleci/project/github/christhekeele/erlex/master.svg)](https://circleci.com/gh/christhekeele/erlex/tree/master) +[![Code coverage badge](https://img.shields.io/codecov/c/github/christhekeele/erlex/master.svg)](https://codecov.io/gh/christhekeele/erlex/branch/master) +[![Last Updated badge](https://img.shields.io/github/last-commit/christhekeele/erlex.svg)](https://github.com/christhekeele/erlex/commits/master) # Erlex @@ -19,7 +19,7 @@ Elixir 1.6+. ## Changelog -Check out the [Changelog](https://github.com/asummers/erlex/blob/master/CHANGELOG.md). +Check out the [Changelog](https://github.com/christhekeele/erlex/blob/master/CHANGELOG.md). ## Installation @@ -70,8 +70,8 @@ iex> Erlex.pretty_print_contract(str) ## Contributing -We welcome contributions of all kinds! To get started, click [here](https://github.com/asummers/erlex/blob/master/CONTRIBUTING.md). +We welcome contributions of all kinds! To get started, click [here](https://github.com/christhekeele/erlex/blob/master/CONTRIBUTING.md). ## Code of Conduct -Be sure to read and follow the [code of conduct](https://github.com/asummers/erlex/blob/master/code-of-conduct.md). +Be sure to read and follow the [code of conduct](https://github.com/christhekeele/erlex/blob/master/code-of-conduct.md). diff --git a/mix.exs b/mix.exs index ca7cb01..f65b62c 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,9 @@ defmodule Erlex.MixProject do use Mix.Project @version "0.2.6" - @repo_url "https://github.com/asummers/erlex" + @repo_url "https://github.com/christhekeele/erlex" + @maintainers ["Chris Keele"] + @authors ["Andrew Summers"] def project do [ @@ -55,6 +57,7 @@ defmodule Erlex.MixProject do source_url: @repo_url, source_ref: @version, homepage_url: @repo_url, + authors: @authors, extras: ["CHANGELOG.md", "README.md"] ] end @@ -69,7 +72,7 @@ defmodule Erlex.MixProject do "src/lexer.xrl", "src/parser.yrl" ], - maintainers: ["Andrew Summers"], + maintainers: @maintainers, licenses: ["Apache-2.0"], links: %{ "Changelog" => "https://hexdocs.pm/erlex/changelog.html", From 2817d2a15598b220f67204ddee5ba09fcdbbd164 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 16:35:17 -0500 Subject: [PATCH 06/30] Run updated formatter. --- .check.exs | 1 - .credo.exs | 2 +- .formatter.exs | 2 +- lib/erlex.ex | 64 ++++++++++++++++++++++++-------------- test/pretty_print_test.exs | 6 ++-- 5 files changed, 46 insertions(+), 29 deletions(-) diff --git a/.check.exs b/.check.exs index 766738d..cc502ec 100644 --- a/.check.exs +++ b/.check.exs @@ -1,7 +1,6 @@ [ parallel: true, skipped: true, - tools: [ {:unused_deps, command: "mix deps.unlock --check-unused"}, {:credo, "mix credo --strict --format oneline"}, diff --git a/.credo.exs b/.credo.exs index 017abcb..c4b7fb0 100644 --- a/.credo.exs +++ b/.credo.exs @@ -18,7 +18,7 @@ {Credo.Check.Readability.MaxLineLength, false}, {Credo.Check.Readability.PreferImplicitTry, false}, {Credo.Check.Refactor.ABCSize}, - {Credo.Check.Refactor.PipeChainStart}, + {Credo.Check.Refactor.PipeChainStart} ] } ] diff --git a/.formatter.exs b/.formatter.exs index 525446d..45c760e 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,4 +1,4 @@ # Used by "mix format" [ - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"] + inputs: ["*.exs", "{config,lib,test}/**/*.{ex,exs}"] ] diff --git a/lib/erlex.ex b/lib/erlex.ex index 624af8a..dcfbb6f 100644 --- a/lib/erlex.ex +++ b/lib/erlex.ex @@ -70,10 +70,10 @@ defmodule Erlex do end @spec pretty_print_infix(infix :: String.t()) :: String.t() - def pretty_print_infix('=:='), do: "===" - def pretty_print_infix('=/='), do: "!==" - def pretty_print_infix('/='), do: "!=" - def pretty_print_infix('=<'), do: "<=" + def pretty_print_infix(~c"=:="), do: "===" + def pretty_print_infix(~c"=/="), do: "!==" + def pretty_print_infix(~c"/="), do: "!=" + def pretty_print_infix(~c"=<"), do: "<=" def pretty_print_infix(infix), do: to_string(infix) @spec pretty_print(str :: String.t()) :: String.t() @@ -93,7 +93,7 @@ defmodule Erlex do end @spec pretty_print_pattern(pattern :: String.t()) :: String.t() - def pretty_print_pattern('pattern ' ++ rest) do + def pretty_print_pattern(~c"pattern " ++ rest) do pretty_print_type(rest) end @@ -217,7 +217,7 @@ defmodule Erlex do "_" end - defp do_pretty_print({:atom, ['_']}) do + defp do_pretty_print({:atom, [~c"_"]}) do "_" end @@ -291,7 +291,7 @@ defmodule Erlex do {:list, :square, [ tuple: [ - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}, {:atom, [:_]} ] ]} @@ -303,7 +303,7 @@ defmodule Erlex do {:list, :square, [ tuple: [ - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}, t ] ]} @@ -322,7 +322,7 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__struct__\''}, {:atom, [:_]}}, + {:map_entry, {:atom, ~c"'__struct__'"}, {:atom, [:_]}}, {:map_entry, {:atom, [:_]}, {:atom, [:_]}} ]} ) do @@ -332,9 +332,10 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__struct__\''}, - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}}, - {:map_entry, {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}, {:atom, [:_]}} + {:map_entry, {:atom, ~c"'__struct__'"}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}}, + {:map_entry, {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}, + {:atom, [:_]}} ]} ) do "struct()" @@ -343,8 +344,8 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__struct__\''}, - {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}}, + {:map_entry, {:atom, ~c"'__struct__'"}, + {:type_list, [~c"a", ~c"t", ~c"o", ~c"m"], {:list, :paren, []}}}, {:map_entry, {:atom, [:_]}, {:atom, [:_]}} ]} ) do @@ -354,8 +355,8 @@ defmodule Erlex do defp do_pretty_print( {:map, [ - {:map_entry, {:atom, '\'__exception__\''}, {:atom, '\'true\''}}, - {:map_entry, {:atom, '\'__struct__\''}, {:atom, [:_]}}, + {:map_entry, {:atom, ~c"'__exception__'"}, {:atom, ~c"'true'"}}, + {:map_entry, {:atom, ~c"'__struct__'"}, {:atom, [:_]}}, {:map_entry, {:atom, [:_]}, {:atom, [:_]}} ]} ) do @@ -396,7 +397,7 @@ defmodule Erlex do defp do_pretty_print({:named_type, named_type, type}) when is_tuple(named_type) do case named_type do - {:atom, name = '\'Elixir' ++ _} -> + {:atom, name = ~c"'Elixir" ++ _} -> "#{atomize(name)}.#{deatomize(type)}()" {:atom, name} -> @@ -417,15 +418,32 @@ defmodule Erlex do end defp do_pretty_print( - {:pipe_list, {:atom, ['f', 'a', 'l', 's', 'e']}, {:atom, ['t', 'r', 'u', 'e']}} + {:pipe_list, {:atom, [~c"f", ~c"a", ~c"l", ~c"s", ~c"e"]}, + {:atom, [~c"t", ~c"r", ~c"u", ~c"e"]}} ) do "boolean()" end defp do_pretty_print( - {:pipe_list, {:atom, '\'infinity\''}, - {:type_list, ['n', 'o', 'n', :_, 'n', 'e', 'g', :_, 'i', 'n', 't', 'e', 'g', 'e', 'r'], - {:list, :paren, []}}} + {:pipe_list, {:atom, ~c"'infinity'"}, + {:type_list, + [ + ~c"n", + ~c"o", + ~c"n", + :_, + ~c"n", + ~c"e", + ~c"g", + :_, + ~c"i", + ~c"n", + ~c"t", + ~c"e", + ~c"g", + ~c"e", + ~c"r" + ], {:list, :paren, []}}} ) do "timeout()" end @@ -580,7 +598,7 @@ defmodule Erlex do %{name: name, entries: Enum.reverse(entries)} end - defp struct_part({:map_entry, {:atom, '\'__struct__\''}, {:atom, name}}, struct_parts) do + defp struct_part({:map_entry, {:atom, ~c"'__struct__'"}, {:atom, name}}, struct_parts) do name = name |> atomize() @@ -593,7 +611,7 @@ defmodule Erlex do Map.put(struct_parts, :entries, [entry | entries]) end - defp deatomize([:_, :_, '@', {:int, _}]) do + defp deatomize([:_, :_, ~c"@", {:int, _}]) do "_" end diff --git a/test/pretty_print_test.exs b/test/pretty_print_test.exs index 2943f92..ecce4f0 100644 --- a/test/pretty_print_test.exs +++ b/test/pretty_print_test.exs @@ -114,7 +114,7 @@ defmodule Erlex.Test.PretyPrintTest do end test "patterns get pretty printed appropriately" do - input = 'pattern {\'ok\', Vuser@1}' + input = ~c"pattern {'ok', Vuser@1}" pretty_printed = Erlex.pretty_print_pattern(input) expected_output = "{:ok, user}" @@ -221,7 +221,7 @@ defmodule Erlex.Test.PretyPrintTest do end test "modules with numbers are pretty printed appropriately" do - input = 'Elixir.Project.Resources.Components.V1.Actions' + input = ~c"Elixir.Project.Resources.Components.V1.Actions" pretty_printed = Erlex.pretty_print(input) @@ -250,7 +250,7 @@ defmodule Erlex.Test.PretyPrintTest do end test "elixir SSA numbered variables get pretty printed appropriately" do - input = '_money@1' + input = ~c"_money@1" pretty_printed = Erlex.pretty_print(input) From 667c25468c948de7ec8a47690952c348bb857f39 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 17:20:25 -0500 Subject: [PATCH 07/30] Update tooling. --- .credo.exs | 1 + .github/workflows/pulls.yml | 5 +- .github/workflows/release.yml | 7 +- .tool-versions | 2 + CONTRIBUTING.md | 12 +-- VERSION | 1 + dialyzer.ignore_warnings.exs | 2 +- mix.exs | 152 +++++++++++++++++++++++++++++----- mix.lock | 20 ++--- 9 files changed, 158 insertions(+), 44 deletions(-) create mode 100644 .tool-versions create mode 100644 VERSION diff --git a/.credo.exs b/.credo.exs index c4b7fb0..dd94850 100644 --- a/.credo.exs +++ b/.credo.exs @@ -8,6 +8,7 @@ excluded: [ "mix.exs", "_build/", + "deps/", ".git/" ] }, diff --git a/.github/workflows/pulls.yml b/.github/workflows/pulls.yml index aca61a4..fd611a5 100644 --- a/.github/workflows/pulls.yml +++ b/.github/workflows/pulls.yml @@ -1,6 +1,9 @@ name: Elixir CI -on: [push, pull_request] +on: + # - push + # - pull_request + - workflow_dispatch jobs: ci: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f80757..34116d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,10 @@ name: Release on: - push: - tags: - - '*' + # push: + # tags: + # - '*' + workflow_dispatch: {} jobs: release: diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..cfceafc --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +elixir 1.16.2-otp-26 +erlang 26.2.4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 902ed27..2f7999b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,12 +29,12 @@ mix check ``` Steps: -1) Fork it! -2) Create a new branch off of master in your fork and do your work -3) Squash your commits to a single commit. If you don't know how to do -this, that's okay. We will work through it in pull request. -4) Make sure any documentation has been updated and all checks are passing. -5) Submit a pull request. Thank you! :heart: + +1. Fork it! +2. Create a new branch off of master in your fork and do your work +3. Squash your commits to a single commit. If you don't know how to do this, that's okay. We will work through it in pull request. +4. Make sure any documentation has been updated and all checks are passing. +5. Submit a pull request. Thank you! :heart: ## Code of Conduct diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..a53741c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2.6 \ No newline at end of file diff --git a/dialyzer.ignore_warnings.exs b/dialyzer.ignore_warnings.exs index 3461c8f..be81e44 100644 --- a/dialyzer.ignore_warnings.exs +++ b/dialyzer.ignore_warnings.exs @@ -4,5 +4,5 @@ {"lib/erlex.ex", :no_return, 139}, {"lib/erlex.ex", :no_return, 149}, {"lib/erlex.ex", :no_return, 168}, - {"lib/erlex.ex", :no_return, 189}, + {"lib/erlex.ex", :no_return, 189} ] diff --git a/mix.exs b/mix.exs index f65b62c..73807f2 100644 --- a/mix.exs +++ b/mix.exs @@ -1,62 +1,150 @@ defmodule Erlex.MixProject do use Mix.Project - @version "0.2.6" - @repo_url "https://github.com/christhekeele/erlex" + @version "VERSION" |> File.read!() |> String.trim() + + @name "ErlEx" + @description "Convert Erlang style structs and error messages to equivalent Elixir." + @maintainers ["Chris Keele"] @authors ["Andrew Summers"] + @github_url "https://github.com/christhekeele/erlex" + @homepage_url @github_url + + @dev_envs [:dev, :test] + def project do [ + # Application app: :erlex, - version: @version, elixir: "~> 1.6", + elixirc_options: [debug_info: Mix.env() in @dev_envs], start_permanent: Mix.env() == :prod, + version: @version, + # Informational + name: @name, + description: @description, + source_url: @github_url, + homepage_url: @homepage_url, + # Configuration + aliases: aliases(), deps: deps(), - description: description(), - package: package(), docs: docs(), - dialyzer: dialyzer() + dialyzer: dialyzer(), + package: package(), + # pre 1.16 mechanism + preferred_cli_env: preferred_cli_env(), + test_coverage: test_coverage() ] end + # post 1.16 mechanism + def cli do + [preferred_envs: preferred_cli_env()] + end + def application do [ extra_applications: [:logger] ] end + defp aliases do + [ + #### + # Developer tools + ### + + # Installation tasks + install: [ + "install.rebar", + "install.hex", + "install.deps" + ], + "install.rebar": "local.rebar --force", + "install.hex": "local.hex --force", + "install.deps": "deps.get", + + # Build tasks + build: [ + "compile", + "typecheck.build-cache" + ], + + # Clean tasks + clean: [ + &clean_extra_folders/1, + "typecheck.clean", + &clean_build_folders/1 + ], + + #### + # Quality control tools + ### + + # Check-all task + check: [ + "test", + "lint" + # "typecheck" + ], + + # Linting tasks + lint: [ + "lint.compile", + "lint.deps", + "lint.format", + "lint.style" + ], + "lint.compile": "compile --force --warnings-as-errors", + "lint.deps": "deps.unlock --check-unused", + "lint.format": "format --check-formatted", + "lint.style": "credo --strict", + + # Typecheck tasks + typecheck: [ + "typecheck.run" + ], + "typecheck.build-cache": "dialyzer --plt --format dialyxir", + "typecheck.clean": "dialyzer.clean", + "typecheck.explain": "dialyzer.explain --format dialyxir", + "typecheck.run": "dialyzer --format dialyxir" + ] + end + defp dialyzer do [ - plt_add_apps: [:mix, :erts, :kernel, :stdlib], - flags: ["-Wunmatched_returns", "-Werror_handling", "-Wrace_conditions", "-Wno_opaque"], - ignore_warnings: "dialyzer.ignore_warnings.exs", + plt_file: {:no_warn, "priv/plts/dialyzer.plt"}, plt_core_path: "priv/plts", - plt_file: {:no_warn, "priv/plts/dialyzer.plt"} + flags: + ["-Wunmatched_returns", "-Wno_opaque", :error_handling, :underspecs] ++ + if :erlang.system_info(:otp_release) not in ~w[25 26]c do + [:race_conditions] + else + [] + end, + ignore_warnings: "dialyzer.ignore_warnings.exs", + list_unused_filters: true, + plt_add_apps: [:mix, :erts, :kernel, :stdlib], + plt_ignore_apps: [] ] end defp deps do [ - {:credo, "~> 1.0", only: :dev, runtime: false}, - {:dialyxir, "1.0.0-rc.3", only: :dev, runtime: false, override: true}, - {:ex_check, "~> 0.12.0", only: :dev, runtime: false}, - {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} + {:credo, "~> 1.7", only: @dev_envs, runtime: false}, + # {:dialyxir, "~> 1.4", only: @dev_envs, runtime: false, override: true}, # Transative dependency on ErlEx + {:ex_doc, ">= 0.0.0", only: @dev_envs, runtime: false} ] end - defp description do - """ - Convert Erlang style structs and error messages to equivalent Elixir. - """ - end - defp docs() do [ main: "readme", - source_url: @repo_url, + source_url: @github_url, source_ref: @version, - homepage_url: @repo_url, + homepage_url: @homepage_url, authors: @authors, extras: ["CHANGELOG.md", "README.md"] ] @@ -76,8 +164,26 @@ defmodule Erlex.MixProject do licenses: ["Apache-2.0"], links: %{ "Changelog" => "https://hexdocs.pm/erlex/changelog.html", - "GitHub" => @repo_url + "GitHub" => @github_url } ] end + + defp test_coverage do + [ + tool: ExCoveralls + ] + end + + defp preferred_cli_env do + aliases() |> Keyword.keys() |> Enum.map(fn alias -> {alias, :test} end) + end + + defp clean_build_folders(_) do + ~w[_build deps] |> Enum.map(&File.rm_rf!/1) + end + + defp clean_extra_folders(_) do + ~w[cover doc] |> Enum.map(&File.rm_rf!/1) + end end diff --git a/mix.lock b/mix.lock index 3812fcc..34d76e3 100644 --- a/mix.lock +++ b/mix.lock @@ -1,12 +1,12 @@ %{ - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, - "credo": {:hex, :credo, "1.4.1", "16392f1edd2cdb1de9fe4004f5ab0ae612c92e230433968eab00aafd976282fc", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "155f8a2989ad77504de5d8291fa0d41320fdcaa6a1030472e9967f285f8c7692"}, - "dialyxir": {:hex, :dialyxir, "1.0.0-rc.3", "774306f84973fc3f1e2e8743eeaa5f5d29b117f3916e5de74c075c02f1b8ef55", [:mix], [], "hexpm", "ddde98a783cec47d1b0ffaf5a0d5fbe09e90e1ac2d28452eefa6f72aac072c5a"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, - "ex_check": {:hex, :ex_check, "0.12.0", "c0e2919ecc06afeaf62c52d64f3d91bd4bc7dd8deaac5f84becb6278888c967a", [:mix], [], "hexpm", "cfafa8ef97c2596d45a1f19b5794cb5c7f700f25d164d3c9f8d7ec17ee67cf42"}, - "ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"}, - "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, - "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.15.0", "98312c9f0d3730fde4049985a1105da5155bfe5c11e47bdc7406d88e01e4219b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "75ffa34ab1056b7e24844c90bfc62aaf6f3a37a15faa76b07bc5eba27e4a8b4a"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.5", "643213503b1c766ec0496d828c90c424471ea54da77c8a168c725686377b9545", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "f799e9b5cd1891577d8c773d245668aa74a2fcd15eb277f51a0131690ebfb3fd"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, + "ex_doc": {:hex, :ex_doc, "0.32.1", "21e40f939515373bcdc9cffe65f3b3543f05015ac6c3d01d991874129d173420", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5142c9db521f106d61ff33250f779807ed2a88620e472ac95dc7d59c380113da"}, + "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, + "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, + "makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.5", "e0ff5a7c708dda34311f7522a8758e23bfcd7d8d8068dc312b5eb41c6fd76eba", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "94d2e986428585a21516d7d7149781480013c56e30c6a233534bedf38867a59a"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, } From a891c0bee48cb69b48ee625b5eb71430cd02bc0d Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 17:20:43 -0500 Subject: [PATCH 08/30] Try test matrix --- .github/workflows/test-matrix.yml | 321 ++++++++++++++++++++++++++++++ mix.exs | 28 ++- 2 files changed, 345 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/test-matrix.yml diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml new file mode 100644 index 0000000..933b468 --- /dev/null +++ b/.github/workflows/test-matrix.yml @@ -0,0 +1,321 @@ +name: Test ❯ Matrix + +on: + workflow_dispatch: {} + push: {} + + # pull_request: + # branches: + # - latest + # - release + + # push: + # branches: + # - release + # - latest + +env: + preferred-elixir: "1.16.x" + preferred-otp: "26.x" + cache-version: 2 + MIX_ENV: test + +concurrency: + group: test-matrix-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: Test Matrix + runs-on: ${{ matrix.os }} + + continue-on-error: ${{ matrix.type == 'optional' }} + strategy: + matrix: + os: + - "ubuntu-20.04" + elixir: + - "1.14.x" + - "1.15.x" + - "1.16.x" + otp: + - "24.x" + - "25.x" + # - "26.x" # Requires a later OS + type: [required] + include: + #### + # Additional version combinations we want to check + ## + # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp + # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we cover back to then + # See: https://github.com/asummers/erlex/blob/master/.github/workflows/pulls.yml#L11-L12 + # OTP 26+ requires ubuntu-22+ + - elixir: "1.14.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.15.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.16.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + # Elixir 1.14 also supports OTP 23 + - elixir: "1.14.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.13 supports OTP 22-25 + - elixir: "1.13.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "25.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.12 supports OTP 22-24 + - elixir: "1.12.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.11 supports OTP 21-23 + - elixir: "1.11.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.10 supports OTP 21-23 + - elixir: "1.10.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.9 supports OTP 20-22 + - elixir: "1.9.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.8 supports OTP 20-22 + - elixir: "1.8.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.7 supports OTP 19-22 + # Note that OTP < 20 requires ubuntu-18.04 + - elixir: "1.7.x" + otp: "19.x" + os: "ubuntu-18.04" + type: required + - elixir: "1.7.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: deps + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Run test suite + run: mix test + + types: + name: Typechecks Matrix + runs-on: ubuntu-20.04 + + continue-on-error: ${{ matrix.type == 'optional' }} + strategy: + matrix: + elixir: + # - "1.10.x" + # - "1.11.x" + # - "1.12.x" + # - "1.13.x" + # - "1.14.x" + # - "1.15.x" + - "1.16.x" + otp: + # - "22.x" + # - "23.x" + # - "24.x" + # - "25.x" + - "26.x" + type: [required] + # include: + # # Additional version combinations we want to check + # # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp + # # Only Elixir >= 1.15 supports OTP 26 + # - elixir: "1.15.x" + # otp: "26.x" + # type: required + # - elixir: "1.16.x" + # otp: "26.x" + # type: required + # # Only Elixir <= 1.14 supports OTP 23 + # - elixir: "1.14.x" + # otp: "23.x" + # type: required + # - elixir: "1.13.x" + # otp: "23.x" + # type: required + # - elixir: "1.12.x" + # otp: "23.x" + # type: required + # - elixir: "1.11.x" + # otp: "23.x" + # type: required + # - elixir: "1.10.x" + # otp: "23.x" + # type: required + + steps: + - uses: actions/checkout@v4 + + # - name: Install Erlang & Elixir + # id: beam-versions + # uses: erlef/setup-beam@v1 + # with: + # elixir-version: ${{ matrix.elixir }} + # otp-version: ${{ matrix.otp }} + + # - name: Restore mix dependency installation cache + # id: mix-deps-get-cache + # uses: actions/cache@v4 + # with: + # path: deps + # key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + # - name: Install mix dependencies + # if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + # run: mix deps.get + + # - name: Restore mix dependency compilation cache + # id: mix-deps-compile-cache + # uses: actions/cache@v4 + # with: + # path: _build + # key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + # - name: Compile mix dependencies + # if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + # run: mix deps.compile + # - name: Compile mix dependencies + # if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + # run: mix deps.compile + + # - name: Restore mix typecheck cache + # id: mix-typecheck-cache + # uses: actions/cache@v4 + # with: + # path: priv/plts + # key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck + + # - name: Setup typechecking + # if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' + # run: mix typecheck.build-cache + + # - name: Run typecheck tasks + # run: mix typecheck + + results: + name: Test Matrix Action Results + runs-on: ubuntu-20.04 + + if: ${{ always() }} + needs: + - tests + # - types + + steps: + - name: Test Suite Succeeded + if: ${{ needs.tests.result == 'success' && needs.types.result == 'success' }} + run: exit 0 + + - name: Test Suite Failed + if: ${{ needs.tests.result == 'failure' || needs.types.result == 'failure' }} + run: exit 1 diff --git a/mix.exs b/mix.exs index 73807f2..a4a9136 100644 --- a/mix.exs +++ b/mix.exs @@ -2,6 +2,23 @@ defmodule Erlex.MixProject do use Mix.Project @version "VERSION" |> File.read!() |> String.trim() + @erlang_version Path.join([ + :code.root_dir(), + "releases", + :erlang.system_info(:otp_release), + "OTP_VERSION" + ]) + |> File.read!() + |> String.trim() + |> String.split(".") + |> Stream.unfold(fn + list when length(list) > 1 -> {hd(list), tl(list)} + [hd] -> {hd, nil} + end) + |> Stream.concat(Stream.repeatedly(fn -> 0 end)) + |> Enum.take(3) + |> Enum.join(".") + |> Version.parse!() @name "ErlEx" @description "Convert Erlang style structs and error messages to equivalent Elixir." @@ -119,7 +136,7 @@ defmodule Erlex.MixProject do plt_core_path: "priv/plts", flags: ["-Wunmatched_returns", "-Wno_opaque", :error_handling, :underspecs] ++ - if :erlang.system_info(:otp_release) not in ~w[25 26]c do + if Version.match?(@erlang_version, "< 25.0.0") do [:race_conditions] else [] @@ -131,11 +148,11 @@ defmodule Erlex.MixProject do ] end - defp deps do + defp deps() do [ {:credo, "~> 1.7", only: @dev_envs, runtime: false}, # {:dialyxir, "~> 1.4", only: @dev_envs, runtime: false, override: true}, # Transative dependency on ErlEx - {:ex_doc, ">= 0.0.0", only: @dev_envs, runtime: false} + {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} ] end @@ -176,7 +193,10 @@ defmodule Erlex.MixProject do end defp preferred_cli_env do - aliases() |> Keyword.keys() |> Enum.map(fn alias -> {alias, :test} end) + test_by_default = aliases() |> Keyword.keys() |> Enum.map(&{&1, :test}) + dev_overrides = ["docs", "hex.publish"] |> Enum.map(&{&1, :dev}) + + test_by_default ++ dev_overrides end defp clean_build_folders(_) do From 67d70d266d1a865b2d6705fc4376ce264cdfe6fb Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 19:53:10 -0500 Subject: [PATCH 09/30] Disable typechecking until we figure out how to not depend on dialyxir. --- .github/workflows/test-matrix.yml | 280 +++++++++++++++++++++--------- 1 file changed, 202 insertions(+), 78 deletions(-) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 933b468..2051fc4 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -41,7 +41,7 @@ jobs: otp: - "24.x" - "25.x" - # - "26.x" # Requires a later OS + # - "26.x" # Requires ubuntu-22.04 type: [required] include: #### @@ -168,6 +168,20 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required + # Elixir 1.6 supports OTP 19-21 + # Note that OTP < 20 requires ubuntu-18.04 + - elixir: "1.6.x" + otp: "19.x" + os: "ubuntu-18.04" + type: required + - elixir: "1.6.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.6.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required steps: - uses: actions/checkout@v4 @@ -205,102 +219,212 @@ jobs: run: mix test types: - name: Typechecks Matrix + name: Typecheck Matrix runs-on: ubuntu-20.04 + if: ${{ !always() }} continue-on-error: ${{ matrix.type == 'optional' }} strategy: matrix: + os: + - "ubuntu-20.04" elixir: - # - "1.10.x" - # - "1.11.x" - # - "1.12.x" - # - "1.13.x" - # - "1.14.x" - # - "1.15.x" + - "1.14.x" + - "1.15.x" - "1.16.x" otp: - # - "22.x" - # - "23.x" - # - "24.x" - # - "25.x" - - "26.x" + - "24.x" + - "25.x" + # - "26.x" # Requires ubuntu-22.04 type: [required] - # include: - # # Additional version combinations we want to check - # # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp - # # Only Elixir >= 1.15 supports OTP 26 - # - elixir: "1.15.x" - # otp: "26.x" - # type: required - # - elixir: "1.16.x" - # otp: "26.x" - # type: required - # # Only Elixir <= 1.14 supports OTP 23 - # - elixir: "1.14.x" - # otp: "23.x" - # type: required - # - elixir: "1.13.x" - # otp: "23.x" - # type: required - # - elixir: "1.12.x" - # otp: "23.x" - # type: required - # - elixir: "1.11.x" - # otp: "23.x" - # type: required - # - elixir: "1.10.x" - # otp: "23.x" - # type: required + include: + #### + # Additional version combinations we want to check + ## + # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp + # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we cover back to then + # See: https://github.com/asummers/erlex/blob/master/.github/workflows/pulls.yml#L11-L12 + # OTP 26+ requires ubuntu-22+ + - elixir: "1.14.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.15.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.16.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + # Elixir 1.14 also supports OTP 23 + - elixir: "1.14.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.13 supports OTP 22-25 + - elixir: "1.13.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "25.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.12 supports OTP 22-24 + - elixir: "1.12.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.11 supports OTP 21-23 + - elixir: "1.11.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.10 supports OTP 21-23 + - elixir: "1.10.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.9 supports OTP 20-22 + - elixir: "1.9.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.8 supports OTP 20-22 + - elixir: "1.8.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.7 supports OTP 19-22 + # Note that OTP < 20 requires ubuntu-18.04 + - elixir: "1.7.x" + otp: "19.x" + os: "ubuntu-18.04" + type: required + - elixir: "1.7.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + # Elixir 1.6 supports OTP 19-21 + # Note that OTP < 20 requires ubuntu-18.04 + - elixir: "1.6.x" + otp: "19.x" + os: "ubuntu-18.04" + type: required + - elixir: "1.6.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.6.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required steps: - uses: actions/checkout@v4 - # - name: Install Erlang & Elixir - # id: beam-versions - # uses: erlef/setup-beam@v1 - # with: - # elixir-version: ${{ matrix.elixir }} - # otp-version: ${{ matrix.otp }} + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} - # - name: Restore mix dependency installation cache - # id: mix-deps-get-cache - # uses: actions/cache@v4 - # with: - # path: deps - # key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: deps + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - # - name: Install mix dependencies - # if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' - # run: mix deps.get + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get - # - name: Restore mix dependency compilation cache - # id: mix-deps-compile-cache - # uses: actions/cache@v4 - # with: - # path: _build - # key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - # - name: Compile mix dependencies - # if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' - # run: mix deps.compile - # - name: Compile mix dependencies - # if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' - # run: mix deps.compile + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile - # - name: Restore mix typecheck cache - # id: mix-typecheck-cache - # uses: actions/cache@v4 - # with: - # path: priv/plts - # key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck + - name: Restore mix typecheck cache + id: mix-typecheck-cache + uses: actions/cache@v4 + with: + path: priv/plts + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck - # - name: Setup typechecking - # if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' - # run: mix typecheck.build-cache + - name: Setup typechecking + if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' + run: mix typecheck.build-cache - # - name: Run typecheck tasks - # run: mix typecheck + - name: Run typecheck tasks + run: mix typecheck results: name: Test Matrix Action Results @@ -309,7 +433,7 @@ jobs: if: ${{ always() }} needs: - tests - # - types + - types steps: - name: Test Suite Succeeded From f604db0f886a5732dd3c61a17787bd962cf7e4b0 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 20:00:04 -0500 Subject: [PATCH 10/30] Try to test against Elixir 1.6 --- .github/workflows/test-matrix.yml | 66 ++++++++++++++++++------------- mix.exs | 21 ++++++++-- 2 files changed, 55 insertions(+), 32 deletions(-) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 2051fc4..23ad724 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -17,7 +17,7 @@ on: env: preferred-elixir: "1.16.x" preferred-otp: "26.x" - cache-version: 2 + cache-version: 4 MIX_ENV: test concurrency: @@ -46,10 +46,13 @@ jobs: include: #### # Additional version combinations we want to check - ## # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp - # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we cover back to then - # See: https://github.com/asummers/erlex/blob/master/.github/workflows/pulls.yml#L11-L12 + # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/0548765838a08583c83d72d208fde112104a3d2b/.github/workflows/pulls.yml#L11-L12 + # Project was originally claiming it supports back to Elixir 1.6, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/master/mix.exs#L11 + ## + # OTP 26+ requires ubuntu-22+ - elixir: "1.14.x" otp: "26.x" @@ -151,11 +154,12 @@ jobs: os: "ubuntu-20.04" type: required # Elixir 1.7 supports OTP 19-22 - # Note that OTP < 20 requires ubuntu-18.04 - - elixir: "1.7.x" - otp: "19.x" - os: "ubuntu-18.04" - type: required + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.7.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required - elixir: "1.7.x" otp: "20.x" os: "ubuntu-20.04" @@ -169,11 +173,12 @@ jobs: os: "ubuntu-20.04" type: required # Elixir 1.6 supports OTP 19-21 - # Note that OTP < 20 requires ubuntu-18.04 - - elixir: "1.6.x" - otp: "19.x" - os: "ubuntu-18.04" - type: required + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.6.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required - elixir: "1.6.x" otp: "20.x" os: "ubuntu-20.04" @@ -240,10 +245,13 @@ jobs: include: #### # Additional version combinations we want to check - ## # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp - # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we cover back to then - # See: https://github.com/asummers/erlex/blob/master/.github/workflows/pulls.yml#L11-L12 + # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/0548765838a08583c83d72d208fde112104a3d2b/.github/workflows/pulls.yml#L11-L12 + # Project was originally claiming it supports back to Elixir 1.6, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/master/mix.exs#L11 + ## + # OTP 26+ requires ubuntu-22+ - elixir: "1.14.x" otp: "26.x" @@ -345,11 +353,12 @@ jobs: os: "ubuntu-20.04" type: required # Elixir 1.7 supports OTP 19-22 - # Note that OTP < 20 requires ubuntu-18.04 - - elixir: "1.7.x" - otp: "19.x" - os: "ubuntu-18.04" - type: required + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.7.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required - elixir: "1.7.x" otp: "20.x" os: "ubuntu-20.04" @@ -363,11 +372,12 @@ jobs: os: "ubuntu-20.04" type: required # Elixir 1.6 supports OTP 19-21 - # Note that OTP < 20 requires ubuntu-18.04 - - elixir: "1.6.x" - otp: "19.x" - os: "ubuntu-18.04" - type: required + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.6.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required - elixir: "1.6.x" otp: "20.x" os: "ubuntu-20.04" @@ -428,7 +438,7 @@ jobs: results: name: Test Matrix Action Results - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 if: ${{ always() }} needs: diff --git a/mix.exs b/mix.exs index a4a9136..604e688 100644 --- a/mix.exs +++ b/mix.exs @@ -2,6 +2,7 @@ defmodule Erlex.MixProject do use Mix.Project @version "VERSION" |> File.read!() |> String.trim() + @elixir_version System.version() |> Version.parse!() @erlang_version Path.join([ :code.root_dir(), "releases", @@ -12,8 +13,8 @@ defmodule Erlex.MixProject do |> String.trim() |> String.split(".") |> Stream.unfold(fn - list when length(list) > 1 -> {hd(list), tl(list)} - [hd] -> {hd, nil} + [] -> nil + [head | tail] -> {head, tail} end) |> Stream.concat(Stream.repeatedly(fn -> 0 end)) |> Enum.take(3) @@ -150,10 +151,22 @@ defmodule Erlex.MixProject do defp deps() do [ - {:credo, "~> 1.7", only: @dev_envs, runtime: false}, # {:dialyxir, "~> 1.4", only: @dev_envs, runtime: false, override: true}, # Transative dependency on ErlEx {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} - ] + ] ++ deps(:credo) + end + + defp deps(:credo) do + cond do + Version.match?(@elixir_version, "< 1.7.0") -> + [{:credo, "< 1.5.0", only: @dev_envs, runtime: false}] + + Version.match?(@elixir_version, "< 1.10.0") -> + [{:credo, "< 1.7.0", only: @dev_envs, runtime: false}] + + true -> + [{:credo, "~> 1.7", only: @dev_envs, runtime: false}] + end end defp docs() do From 3f2b8eb9cf7b81dc88e4665b1cb89769edb18dd2 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 20:15:16 -0500 Subject: [PATCH 11/30] Remove lockfile from library. --- .github/workflows/test-matrix.yml | 16 ++++++++++------ .gitignore | 3 ++- mix.lock | 12 ------------ 3 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 mix.lock diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 23ad724..5944388 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -17,7 +17,7 @@ on: env: preferred-elixir: "1.16.x" preferred-otp: "26.x" - cache-version: 4 + cache-version: 5 MIX_ENV: test concurrency: @@ -202,8 +202,10 @@ jobs: id: mix-deps-get-cache uses: actions/cache@v4 with: - path: deps - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + path: | + deps + mix.lock + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' @@ -214,7 +216,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' @@ -401,8 +403,10 @@ jobs: id: mix-deps-get-cache uses: actions/cache@v4 with: - path: deps - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + path: | + deps + mix.lock + key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' diff --git a/.gitignore b/.gitignore index a816991..1fc5be9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ erlex-*.tar src/parser.erl src/lexer.erl -/priv/plts/ \ No newline at end of file +/priv/plts/ +mix.lock \ No newline at end of file diff --git a/mix.lock b/mix.lock deleted file mode 100644 index 34d76e3..0000000 --- a/mix.lock +++ /dev/null @@ -1,12 +0,0 @@ -%{ - "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, - "credo": {:hex, :credo, "1.7.5", "643213503b1c766ec0496d828c90c424471ea54da77c8a168c725686377b9545", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "f799e9b5cd1891577d8c773d245668aa74a2fcd15eb277f51a0131690ebfb3fd"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, - "ex_doc": {:hex, :ex_doc, "0.32.1", "21e40f939515373bcdc9cffe65f3b3543f05015ac6c3d01d991874129d173420", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5142c9db521f106d61ff33250f779807ed2a88620e472ac95dc7d59c380113da"}, - "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, - "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, - "makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.5", "e0ff5a7c708dda34311f7522a8758e23bfcd7d8d8068dc312b5eb41c6fd76eba", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "94d2e986428585a21516d7d7149781480013c56e30c6a233534bedf38867a59a"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, -} From 05be3e4968d4d95d8db61d814ec7f38dd0bc1d9e Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 20:31:43 -0500 Subject: [PATCH 12/30] Add basic windows support to build matrix. Not going to do the long tail of versions. --- .github/workflows/test-matrix.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 5944388..e61b0a8 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -34,6 +34,8 @@ jobs: matrix: os: - "ubuntu-20.04" + - "windows-2019" + - "windows-2022" elixir: - "1.14.x" - "1.15.x" @@ -66,11 +68,13 @@ jobs: otp: "26.x" os: "ubuntu-22.04" type: required + # Elixir 1.14 also supports OTP 23 - elixir: "1.14.x" otp: "23.x" os: "ubuntu-20.04" type: required + # Elixir 1.13 supports OTP 22-25 - elixir: "1.13.x" otp: "22.x" @@ -88,6 +92,7 @@ jobs: otp: "25.x" os: "ubuntu-20.04" type: required + # Elixir 1.12 supports OTP 22-24 - elixir: "1.12.x" otp: "22.x" @@ -101,6 +106,7 @@ jobs: otp: "24.x" os: "ubuntu-20.04" type: required + # Elixir 1.11 supports OTP 21-23 - elixir: "1.11.x" otp: "21.x" @@ -114,6 +120,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required + # Elixir 1.10 supports OTP 21-23 - elixir: "1.10.x" otp: "21.x" @@ -127,6 +134,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required + # Elixir 1.9 supports OTP 20-22 - elixir: "1.9.x" otp: "20.x" @@ -140,6 +148,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required + # Elixir 1.8 supports OTP 20-22 - elixir: "1.8.x" otp: "20.x" @@ -153,6 +162,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required + # Elixir 1.7 supports OTP 19-22 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it @@ -172,6 +182,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required + # Elixir 1.6 supports OTP 19-21 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it @@ -235,6 +246,8 @@ jobs: matrix: os: - "ubuntu-20.04" + - "windows-2019" + - "windows-2022" elixir: - "1.14.x" - "1.15.x" @@ -267,11 +280,13 @@ jobs: otp: "26.x" os: "ubuntu-22.04" type: required + # Elixir 1.14 also supports OTP 23 - elixir: "1.14.x" otp: "23.x" os: "ubuntu-20.04" type: required + # Elixir 1.13 supports OTP 22-25 - elixir: "1.13.x" otp: "22.x" @@ -289,6 +304,7 @@ jobs: otp: "25.x" os: "ubuntu-20.04" type: required + # Elixir 1.12 supports OTP 22-24 - elixir: "1.12.x" otp: "22.x" @@ -302,6 +318,7 @@ jobs: otp: "24.x" os: "ubuntu-20.04" type: required + # Elixir 1.11 supports OTP 21-23 - elixir: "1.11.x" otp: "21.x" @@ -315,6 +332,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required + # Elixir 1.10 supports OTP 21-23 - elixir: "1.10.x" otp: "21.x" @@ -328,6 +346,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required + # Elixir 1.9 supports OTP 20-22 - elixir: "1.9.x" otp: "20.x" @@ -341,6 +360,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required + # Elixir 1.8 supports OTP 20-22 - elixir: "1.8.x" otp: "20.x" @@ -354,6 +374,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required + # Elixir 1.7 supports OTP 19-22 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it @@ -373,6 +394,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required + # Elixir 1.6 supports OTP 19-21 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it From 681c0b07b7640b32b21dc52d05fbeb4d4d23f28d Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 20:47:15 -0500 Subject: [PATCH 13/30] Enable auto-formatting from vs code. --- .vscode/extensions.json | 5 +++++ .vscode/settings.json | 9 +++++++++ mix.exs | 20 ++++++++++---------- 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..af2a012 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "jakebecker.elixir-ls" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..cc7c964 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "editor.formatOnSave": true, + "elixirLS.enableTestLenses": true, + "elixirLS.fetchDeps": true, + "elixirLS.mixEnv": "test" +} diff --git a/mix.exs b/mix.exs index 604e688..b0c97f3 100644 --- a/mix.exs +++ b/mix.exs @@ -154,19 +154,19 @@ defmodule Erlex.MixProject do # {:dialyxir, "~> 1.4", only: @dev_envs, runtime: false, override: true}, # Transative dependency on ErlEx {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} ] ++ deps(:credo) - end + end - defp deps(:credo) do - cond do - Version.match?(@elixir_version, "< 1.7.0") -> - [{:credo, "< 1.5.0", only: @dev_envs, runtime: false}] + defp deps(:credo) do + cond do + Version.match?(@elixir_version, "< 1.7.0") -> + [{:credo, "< 1.5.0", only: @dev_envs, runtime: false}] - Version.match?(@elixir_version, "< 1.10.0") -> - [{:credo, "< 1.7.0", only: @dev_envs, runtime: false}] + Version.match?(@elixir_version, "< 1.10.0") -> + [{:credo, "< 1.7.0", only: @dev_envs, runtime: false}] - true -> - [{:credo, "~> 1.7", only: @dev_envs, runtime: false}] - end + true -> + [{:credo, "~> 1.7", only: @dev_envs, runtime: false}] + end end defp docs() do From ab9b2e1d77f9a933d5049fdecce2ec696a69fe4c Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 20:57:00 -0500 Subject: [PATCH 14/30] Remove unused config folder/files. --- config/config.exs | 1 - 1 file changed, 1 deletion(-) delete mode 100644 config/config.exs diff --git a/config/config.exs b/config/config.exs deleted file mode 100644 index becde76..0000000 --- a/config/config.exs +++ /dev/null @@ -1 +0,0 @@ -import Config From ad58ee34f95d3ee0ba86f30e4eb19d5349c86029 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 21:05:37 -0500 Subject: [PATCH 15/30] Update changelog. --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a083763..5e94959 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ## [Unreleased] +### Added +- Support for Elixir 1.16: removes new compiler warnings. + ## 0.2.6 - 2020-03-09 ### Added -- Replace << parsing to fix nexted pattern matching binary bugs discovered from Phoenix 1.4.15. +- Replace << parsing to fix nested pattern matching binary bugs discovered from Phoenix 1.4.15. ## 0.2.5 - 2019-09-19 ### Added @@ -67,7 +70,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html - Initial functionality and tests [Unreleased]: https://github.com/asummers/erlex/compare/v0.2.1...HEAD -[0.2.0...0.2.1]: https://github.com/asummers/erlex/compare/v0.2.0...v0.2.1 +[0.2.0...0.2.1]: https://github.com/christhekeele/erlex/compare/v0.2.0...v0.2.1 [0.1.6...0.2.0]: https://github.com/asummers/erlex/compare/v0.1.6...v0.2.0 [0.1.5...0.1.6]: https://github.com/asummers/erlex/compare/v0.1.5...v0.1.6 [0.1.4...0.1.5]: https://github.com/asummers/erlex/compare/v0.1.4...v0.1.5 From f99d7ade8892132266932c4734e119289a1c1dd4 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 21:58:25 -0500 Subject: [PATCH 16/30] Remove old .check.exs stuff, update readme test suite links --- .check.exs | 10 ---- .github/workflows/pulls.yml | 50 +++++++++---------- .github/workflows/test-matrix.yml | 40 ++++++++-------- README.md | 80 +++++++++++++++++++++++++++---- mix.exs | 2 +- 5 files changed, 116 insertions(+), 66 deletions(-) delete mode 100644 .check.exs diff --git a/.check.exs b/.check.exs deleted file mode 100644 index cc502ec..0000000 --- a/.check.exs +++ /dev/null @@ -1,10 +0,0 @@ -[ - parallel: true, - skipped: true, - tools: [ - {:unused_deps, command: "mix deps.unlock --check-unused"}, - {:credo, "mix credo --strict --format oneline"}, - {:compiler, "mix compile --warnings-as-errors"}, - {:sobelow, false} - ] -] diff --git a/.github/workflows/pulls.yml b/.github/workflows/pulls.yml index fd611a5..5d3c02f 100644 --- a/.github/workflows/pulls.yml +++ b/.github/workflows/pulls.yml @@ -1,6 +1,6 @@ name: Elixir CI -on: +on: # - push # - pull_request - workflow_dispatch @@ -14,29 +14,29 @@ jobs: elixir: [1.10.3, 1.11.0] otp: [22.3, 23.1] steps: - - uses: actions/checkout@v2 - - name: Set up Elixir - uses: erlef/setup-beam@v1 - with: - elixir-version: ${{ matrix.elixir }} - otp-version: ${{ matrix.otp }} - - name: Restore dependencies cache - uses: actions/cache@v2 - with: - path: deps - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('**/mix.lock') }} - restore-keys: | + - uses: actions/checkout@v2 + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + - name: Restore dependencies cache + uses: actions/cache@v2 + with: + path: deps + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: | ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('**/mix.lock') }} ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix - - name: Restore Dialyzer PLT cache - uses: actions/cache@v2 - with: - path: priv/plts - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-${{ hashFiles('**/priv/plts/dialyzer.plt.hash') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-${{ hashFiles('**/priv/plts/dialyzer.plt.hash') }} - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt - - name: Install dependencies - run: mix deps.get - - name: mix check - run: mix check + - name: Restore Dialyzer PLT cache + uses: actions/cache@v2 + with: + path: priv/plts + key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-${{ hashFiles('**/priv/plts/dialyzer.plt.hash') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-${{ hashFiles('**/priv/plts/dialyzer.plt.hash') }} + ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt + - name: Install dependencies + run: mix deps.get + - name: mix check + run: mix check diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index e61b0a8..04567ba 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -54,7 +54,7 @@ jobs: # Project was originally claiming it supports back to Elixir 1.6, so we should test back to then until a breaking release # See: https://github.com/asummers/erlex/blob/master/mix.exs#L11 ## - + # OTP 26+ requires ubuntu-22+ - elixir: "1.14.x" otp: "26.x" @@ -68,13 +68,13 @@ jobs: otp: "26.x" os: "ubuntu-22.04" type: required - + # Elixir 1.14 also supports OTP 23 - elixir: "1.14.x" otp: "23.x" os: "ubuntu-20.04" type: required - + # Elixir 1.13 supports OTP 22-25 - elixir: "1.13.x" otp: "22.x" @@ -92,7 +92,7 @@ jobs: otp: "25.x" os: "ubuntu-20.04" type: required - + # Elixir 1.12 supports OTP 22-24 - elixir: "1.12.x" otp: "22.x" @@ -106,7 +106,7 @@ jobs: otp: "24.x" os: "ubuntu-20.04" type: required - + # Elixir 1.11 supports OTP 21-23 - elixir: "1.11.x" otp: "21.x" @@ -120,7 +120,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required - + # Elixir 1.10 supports OTP 21-23 - elixir: "1.10.x" otp: "21.x" @@ -134,7 +134,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required - + # Elixir 1.9 supports OTP 20-22 - elixir: "1.9.x" otp: "20.x" @@ -148,7 +148,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required - + # Elixir 1.8 supports OTP 20-22 - elixir: "1.8.x" otp: "20.x" @@ -162,7 +162,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required - + # Elixir 1.7 supports OTP 19-22 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it @@ -182,7 +182,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required - + # Elixir 1.6 supports OTP 19-21 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it @@ -266,7 +266,7 @@ jobs: # Project was originally claiming it supports back to Elixir 1.6, so we should test back to then until a breaking release # See: https://github.com/asummers/erlex/blob/master/mix.exs#L11 ## - + # OTP 26+ requires ubuntu-22+ - elixir: "1.14.x" otp: "26.x" @@ -280,13 +280,13 @@ jobs: otp: "26.x" os: "ubuntu-22.04" type: required - + # Elixir 1.14 also supports OTP 23 - elixir: "1.14.x" otp: "23.x" os: "ubuntu-20.04" type: required - + # Elixir 1.13 supports OTP 22-25 - elixir: "1.13.x" otp: "22.x" @@ -304,7 +304,7 @@ jobs: otp: "25.x" os: "ubuntu-20.04" type: required - + # Elixir 1.12 supports OTP 22-24 - elixir: "1.12.x" otp: "22.x" @@ -318,7 +318,7 @@ jobs: otp: "24.x" os: "ubuntu-20.04" type: required - + # Elixir 1.11 supports OTP 21-23 - elixir: "1.11.x" otp: "21.x" @@ -332,7 +332,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required - + # Elixir 1.10 supports OTP 21-23 - elixir: "1.10.x" otp: "21.x" @@ -346,7 +346,7 @@ jobs: otp: "23.x" os: "ubuntu-20.04" type: required - + # Elixir 1.9 supports OTP 20-22 - elixir: "1.9.x" otp: "20.x" @@ -360,7 +360,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required - + # Elixir 1.8 supports OTP 20-22 - elixir: "1.8.x" otp: "20.x" @@ -374,7 +374,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required - + # Elixir 1.7 supports OTP 19-22 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it @@ -394,7 +394,7 @@ jobs: otp: "22.x" os: "ubuntu-20.04" type: required - + # Elixir 1.6 supports OTP 19-21 # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, # so we skip it diff --git a/README.md b/README.md index d0ef23b..cb1dcb3 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,3 @@ -[![Hex version badge](https://img.shields.io/hexpm/v/erlex.svg)](https://hex.pm/packages/erlex) -[![Hex docs badge](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/erlex/) -[![Total download badge](https://img.shields.io/hexpm/dt/erlex.svg)](https://hex.pm/packages/erlex) -[![License badge](https://img.shields.io/hexpm/l/erlex.svg)](https://github.com/christhekeele/erlex/blob/master/LICENSE.md) -[![Build status badge](https://img.shields.io/circleci/project/github/christhekeele/erlex/master.svg)](https://circleci.com/gh/christhekeele/erlex/tree/master) -[![Code coverage badge](https://img.shields.io/codecov/c/github/christhekeele/erlex/master.svg)](https://codecov.io/gh/christhekeele/erlex/branch/master) -[![Last Updated badge](https://img.shields.io/github/last-commit/christhekeele/erlex.svg)](https://github.com/christhekeele/erlex/commits/master) - # Erlex Convert Erlang style structs and error messages to equivalent Elixir. @@ -14,8 +6,15 @@ Useful for pretty printing things like Dialyzer errors and Observer state. NOTE: Because this code calls the Elixir formatter, it requires Elixir 1.6+. -## Documentation -[Hex Docs](https://hexdocs.pm/erlex). +[![Version][hex-pm-version-badge]][hex-pm-versions] +[![Documentation][docs-badge]][docs] +[![License][hex-pm-license-badge]][apache-2-license] +[![Downloads][hex-pm-downloads-badge]][hex-pm-package] + +| 👍 | [Test Suite][suite] | [Test Coverage][coverage] | +| :----------------: | :---------------------------------------------------: | :------------------------------------------------------------: | +| [Release][release] | [![Build Status][release-suite-badge]][release-suite] | [![Coverage Status][release-coverage-badge]][release-coverage] | +| [Latest][latest] | [![Build Status][latest-suite-badge]][latest-suite] | [![Coverage Status][latest-coverage-badge]][latest-coverage] | ## Changelog @@ -75,3 +74,64 @@ We welcome contributions of all kinds! To get started, click [here](https://gith ## Code of Conduct Be sure to read and follow the [code of conduct](https://github.com/christhekeele/erlex/blob/master/code-of-conduct.md). + + + + + +[hex-pm]: https://hex.pm +[hex-pm-package]: https://hex.pm/packages/erlex +[hex-pm-versions]: https://hex.pm/packages/erlex/versions +[hex-pm-version-badge]: https://img.shields.io/hexpm/v/erlex.svg?cacheSeconds=86400&style=flat-square +[hex-pm-downloads-badge]: https://img.shields.io/hexpm/dt/erlex.svg?cacheSeconds=86400&style=flat-square +[hex-pm-license-badge]: https://img.shields.io/hexpm/l/erlex.svg?cacheSeconds=86400&style=flat-square + + + +[docs]: https://hexdocs.pm/erlex/index.html +[docs-guides]: https://hexdocs.pm/erlex/usage.html#content +[docs-badge]: https://img.shields.io/badge/documentation-online-purple?cacheSeconds=86400&style=flat-square + + + +[deps]: https://hex.pm/packages/erlex +[deps-badge]: https://img.shields.io/badge/dependencies-0-blue?cacheSeconds=86400&style=flat-square + + + +[benchmarks]: https://christhekeele.github.io/erlex/bench +[benchmarks-badge]: https://img.shields.io/badge/benchmarks-online-2ab8b5?cacheSeconds=86400&style=flat-square + + + +[contributors]: https://hexdocs.pm/erlex/contributors.html +[contributors-badge]: https://img.shields.io/badge/contributors-%F0%9F%92%9C-lightgrey + + + +[suite]: https://github.com/christhekeele/erlex/actions/workflows/test-suite.yml?query=workflow%3A%22Test+Suite%22 +[coverage]: https://coveralls.io/github/christhekeele/erlex + + + +[release]: https://github.com/christhekeele/erlex/tree/release +[release-suite]: https://github.com/christhekeele/erlex/actions/workflows/test-suite.yml?query=workflow%3A%22Test+Suite%22+branch%3Arelease +[release-suite-badge]: https://img.shields.io/github/actions/workflow/status/christhekeele/erlex/test-suite.yml?branch=release&cacheSeconds=86400&style=flat-square +[release-coverage]: https://coveralls.io/github/christhekeele/erlex?branch=release +[release-coverage-badge]: https://img.shields.io/coverallsCoverage/github/christhekeele/erlex?branch=release&cacheSeconds=86400&style=flat-square + + + +[latest]: https://github.com/christhekeele/erlex/tree/latest +[latest-suite]: https://github.com/christhekeele/erlex/actions/workflows/test-suite.yml?query=workflow%3A%22Test+Suite%22+branch%3Alatest +[latest-suite-badge]: https://img.shields.io/github/actions/workflow/status/christhekeele/erlex/test-suite.yml?branch=latest&cacheSeconds=86400&style=flat-square +[latest-coverage]: https://coveralls.io/github/christhekeele/erlex?branch=latest +[latest-coverage-badge]: https://img.shields.io/coverallsCoverage/github/christhekeele/erlex?branch=latest&cacheSeconds=86400&style=flat-square + + + +[changelog]: https://hexdocs.pm/erlex/changelog.html +[test-matrix]: https://github.com/christhekeele/erlex/actions/workflows/test-matrix.yml +[test-edge]: https://github.com/christhekeele/erlex/actions/workflows/test-edge.yml +[contributing]: https://hexdocs.pm/erlex/contributing.html +[apache-2-license]: https://choosealicense.com/licenses/apache-2.0/ diff --git a/mix.exs b/mix.exs index 2c32ae0..f3095e1 100644 --- a/mix.exs +++ b/mix.exs @@ -21,7 +21,7 @@ defmodule Erlex.MixProject do |> Enum.join(".") |> Version.parse!() - @name "ErlEx" + @name "Erlex" @description "Convert Erlang style structs and error messages to equivalent Elixir." @maintainers ["Chris Keele"] From 55e5cf1ad5e01dc28d8ea4e007bbedfaf54e9c5a Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 22:16:53 -0500 Subject: [PATCH 17/30] Fix tags and broken changelog links. --- CHANGELOG.md | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e94959..71ffe81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). @@ -6,75 +7,104 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ## [Unreleased] ### Added + - Support for Elixir 1.16: removes new compiler warnings. ## 0.2.6 - 2020-03-09 + ### Added + - Replace << parsing to fix nested pattern matching binary bugs discovered from Phoenix 1.4.15. ## 0.2.5 - 2019-09-19 + ### Added + - Handle Erlang variables better with casing in guards. ## 0.2.4 - 2019-07-18 + ### Added + - Handle names in whens more properly. ## 0.2.3 - 2019-07-16 + ### Added + - Handle single letter atoms in constracts. ## 0.2.2 - 2019-06-07 + ### Added + - Handle pretty printing binary strings better. ## 0.2.1 - 2019-02-11 + ### Added + - Handle another struct pretty print. ## 0.2.0 - 2019-02-01 + ### Added + - Handle scientific notation. - Handle numbered differently, fixes bug. - Handle ... contracts. - Add another struct pretty print layer. ## 0.1.6 - 2018-11-06 + ### Added + - Add ability to pretty print exception struct as Exception.t(). ## 0.1.5 - 2018-09-17 + ### Added + - Add ability to pretty print numbered named types ## 0.1.4 - 2018-09-17 + ### Added + - Add ability to parse whens in specs. ## 0.1.3 - 2018-09-10 + ### Added + - Add ability to parse empty tuples - Bump ex_doc ## 0.1.2 - 2018-08-26 + ### Added + - Add ability to deal with when clauses in contracts ## 0.1.1 - 2018-08-21 + ### Added + - Add newline characters in multihead contracts ## 0.1.0 - 2018-07-22 + ### Added + - Changelog, CI, docs - Initial functionality and tests -[Unreleased]: https://github.com/asummers/erlex/compare/v0.2.1...HEAD +[Unreleased]: https://github.com/christhekeele/erlex/compare/v0.2.1...HEAD [0.2.0...0.2.1]: https://github.com/christhekeele/erlex/compare/v0.2.0...v0.2.1 -[0.1.6...0.2.0]: https://github.com/asummers/erlex/compare/v0.1.6...v0.2.0 -[0.1.5...0.1.6]: https://github.com/asummers/erlex/compare/v0.1.5...v0.1.6 -[0.1.4...0.1.5]: https://github.com/asummers/erlex/compare/v0.1.4...v0.1.5 -[0.1.3...0.1.4]: https://github.com/asummers/erlex/compare/v0.1.3...v0.1.4 -[0.1.2...0.1.3]: https://github.com/asummers/erlex/compare/v0.1.2...v0.1.3 -[0.1.1...0.1.2]: https://github.com/asummers/erlex/compare/v0.1.1...v0.1.2 -[0.1.0...0.1.1]: https://github.com/asummers/erlex/compare/v0.1.0...v0.1.1 +[0.1.6...0.2.0]: https://github.com/christhekeele/erlex/compare/v0.1.6...v0.2.0 +[0.1.5...0.1.6]: https://github.com/christhekeele/erlex/compare/v0.1.5...v0.1.6 +[0.1.4...0.1.5]: https://github.com/christhekeele/erlex/compare/v0.1.4...v0.1.5 +[0.1.3...0.1.4]: https://github.com/christhekeele/erlex/compare/v0.1.3...v0.1.4 +[0.1.2...0.1.3]: https://github.com/christhekeele/erlex/compare/v0.1.2...v0.1.3 +[0.1.1...0.1.2]: https://github.com/christhekeele/erlex/compare/v0.1.1...v0.1.2 +[0.1.0...0.1.1]: https://github.com/christhekeele/erlex/compare/v0.1.0...v0.1.1 From 279c44aa69b4f5785c96493e7b8ac7f7870fe67a Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 23:15:59 -0500 Subject: [PATCH 18/30] Work on test suite. --- .github/workflows/test-matrix.yml | 72 +++---------- .github/workflows/test-suite.yml | 165 ++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/test-suite.yml diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 04567ba..47cac5f 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -2,22 +2,18 @@ name: Test ❯ Matrix on: workflow_dispatch: {} - push: {} - # pull_request: - # branches: - # - latest - # - release + pull_request: + branches: + - latest + - release - # push: - # branches: - # - release - # - latest + push: + branches: + - release + - latest env: - preferred-elixir: "1.16.x" - preferred-otp: "26.x" - cache-version: 5 MIX_ENV: test concurrency: @@ -26,7 +22,7 @@ concurrency: jobs: tests: - name: Test Matrix + name: Testing Matrix runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.type == 'optional' }} @@ -216,7 +212,7 @@ jobs: path: | deps mix.lock - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' @@ -227,7 +223,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' @@ -237,9 +233,10 @@ jobs: run: mix test types: - name: Typecheck Matrix - runs-on: ubuntu-20.04 + # Skip type checking for now if: ${{ !always() }} + name: Typechecking Matrix + runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.type == 'optional' }} strategy: @@ -421,47 +418,6 @@ jobs: elixir-version: ${{ matrix.elixir }} otp-version: ${{ matrix.otp }} - - name: Restore mix dependency installation cache - id: mix-deps-get-cache - uses: actions/cache@v4 - with: - path: | - deps - mix.lock - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} - - - name: Install mix dependencies - if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' - run: mix deps.get - - - name: Restore mix dependency compilation cache - id: mix-deps-compile-cache - uses: actions/cache@v4 - with: - path: _build - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - - - name: Compile mix dependencies - if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' - run: mix deps.compile - - name: Compile mix dependencies - if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' - run: mix deps.compile - - - name: Restore mix typecheck cache - id: mix-typecheck-cache - uses: actions/cache@v4 - with: - path: priv/plts - key: cache-${{ env.cache-version }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck - - - name: Setup typechecking - if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' - run: mix typecheck.build-cache - - - name: Run typecheck tasks - run: mix typecheck - results: name: Test Matrix Action Results runs-on: ubuntu-22.04 diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml new file mode 100644 index 0000000..f003174 --- /dev/null +++ b/.github/workflows/test-suite.yml @@ -0,0 +1,165 @@ +name: Test ❯ Suite + +on: + - workflow_dispatch + - push + +env: + MIX_ENV: test + +concurrency: + group: test-suite-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: Testing + runs-on: ${{ vars.PREFERRED_OS }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ vars.PREFERRED_ELIXIR }} + otp-version: ${{ vars.PREFERRED_OTP }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: | + deps + mix.lock + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Run test suite + run: mix test + + types: + # Skip type checking for now + if: ${{ !always() }} + name: Typechecking + runs-on: ${{ vars.PREFERRED_OS }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ vars.PREFERRED_ELIXIR }} + otp-version: ${{ vars.PREFERRED_OTP }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: deps + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Restore mix typecheck cache + id: mix-typecheck-cache + uses: actions/cache@v4 + with: + path: priv/plts + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck + + - name: Setup typechecking + if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' + run: mix typecheck.build-cache + + - name: Run typecheck tasks + run: mix typecheck + + lints: + name: Linting + runs-on: ${{ vars.PREFERRED_OS }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ vars.PREFERRED_ELIXIR }} + otp-version: ${{ vars.PREFERRED_OTP }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: deps + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Run linter tasks + run: mix lint + continue-on-error: true + + results: + name: Test Suites Action Results + runs-on: ubuntu-20.04 + + if: ${{ always() }} + needs: + - tests + - types + - lints + + steps: + - name: Test Suite Succeeded + if: ${{ needs.tests.result == 'success' && needs.types.result == 'success' && needs.lints.result == 'success' }} + run: exit 0 + + - name: Test Suite Failed + if: ${{ needs.tests.result == 'failure' || needs.types.result == 'failure' || needs.lints.result == 'failure' }} + run: exit 1 From 4e5e4d0be58fb77bd34a43a55fb5794523154afd Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sat, 13 Apr 2024 23:42:59 -0500 Subject: [PATCH 19/30] Work on test coverage reporting. --- .github/workflows/test-matrix.yml | 47 ++++++++++++++++- .github/workflows/test-status.yml | 86 +++++++++++++++++++++++++++++++ .github/workflows/test-suite.yml | 5 +- mix.exs | 7 ++- 4 files changed, 141 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/test-status.yml diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 47cac5f..22676be 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -1,17 +1,22 @@ name: Test ❯ Matrix +# Runs tests and typechecking against the full battalion +# of supported OS, Erlang/OTP, and Elixir versions. on: + # Allow running from GitHub UI. workflow_dispatch: {} + # Run on all pull requests to important branches. pull_request: branches: - latest - release + # Run on all pushes to important branches. push: branches: - - release - latest + - release env: MIX_ENV: test @@ -418,8 +423,46 @@ jobs: elixir-version: ${{ matrix.elixir }} otp-version: ${{ matrix.otp }} + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: | + deps + mix.lock + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Restore mix typecheck cache + id: mix-typecheck-cache + uses: actions/cache@v4 + with: + path: priv/plts + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck + + - name: Setup typechecking + if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' + run: mix typecheck.build-cache + + - name: Run typecheck tasks + run: mix typecheck + results: - name: Test Matrix Action Results + name: Test Matrix Results runs-on: ubuntu-22.04 if: ${{ always() }} diff --git a/.github/workflows/test-status.yml b/.github/workflows/test-status.yml new file mode 100644 index 0000000..e7110d8 --- /dev/null +++ b/.github/workflows/test-status.yml @@ -0,0 +1,86 @@ +name: Test ❯ Status +# Runs tests with coverage and updates related systems. + +on: + # Allow running from GitHub UI. + workflow_dispatch: {} + + # Update status on all pull requests to important branches. + push: + branches: + - latest + - release + + # Update status on all pushes to important branches. + pull_request: + branches: + - latest + - release + +env: + MIX_ENV: test + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: test-status-${{ github.ref }} + cancel-in-progress: true + +jobs: + status: + if: github.event_name == 'push' || github.event.pull_request_target.merged == true + name: Reporting Test Suite Status + runs-on: ${{ vars.PREFERRED_OS }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ vars.PREFERRED_ELIXIR }} + otp-version: ${{ vars.PREFERRED_OTP }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: | + deps + mix.lock + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Report test suite coverage + run: mix test.coverage.report + + results: + name: Test Status Results + runs-on: ${{ vars.PREFERRED_OS }} + + if: ${{ always() }} + needs: + - status + + steps: + - name: Test Status Succeeded + if: ${{ needs.status.result == 'success' }} + run: exit 0 + + - name: Test Status Failed + if: ${{ needs.status.result == 'failure' }} + run: exit 1 diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index f003174..4976f9f 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -1,7 +1,10 @@ name: Test ❯ Suite +# Runs tests, typechecking, and linting. on: + # Allow running from GitHub UI. - workflow_dispatch + # Run on all pushes. - push env: @@ -146,7 +149,7 @@ jobs: continue-on-error: true results: - name: Test Suites Action Results + name: Test Suite Results runs-on: ubuntu-20.04 if: ${{ always() }} diff --git a/mix.exs b/mix.exs index f3095e1..0d63f61 100644 --- a/mix.exs +++ b/mix.exs @@ -128,7 +128,11 @@ defmodule Erlex.MixProject do "typecheck.build-cache": "dialyzer --plt --format dialyxir", "typecheck.clean": "dialyzer.clean", "typecheck.explain": "dialyzer.explain --format dialyxir", - "typecheck.run": "dialyzer --format dialyxir" + "typecheck.run": "dialyzer --format dialyxir", + + # Test tasks + "test.coverage": "coveralls", + "test.coverage.report": "coveralls.github" ] end @@ -153,6 +157,7 @@ defmodule Erlex.MixProject do defp deps() do [ # {:dialyxir, "~> 1.4", only: @dev_envs, runtime: false, override: true}, # Transative dependency on ErlEx + {:excoveralls, "~> 0.18", only: :test}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} ] ++ deps(:credo) end From 5a8b8ad1db2ded03fb3026109b2654200a101f86 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sun, 14 Apr 2024 00:11:17 -0500 Subject: [PATCH 20/30] Update changelog with other PR merges. --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ffe81..2e91b11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,14 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html - Support for Elixir 1.16: removes new compiler warnings. +### Changed + +- Parser and lexer modules renamed with `erlex_` prefix to avoid conflict with similarly named modules. + +### Fixed + +- Lone `_` variables in patterns + ## 0.2.6 - 2020-03-09 ### Added From 94fc7fe237c7d2f2cac5abe57197ab27a8a9540a Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sun, 14 Apr 2024 00:16:14 -0500 Subject: [PATCH 21/30] Add edge-testing action. --- .github/workflows/test-edge.yml | 121 ++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .github/workflows/test-edge.yml diff --git a/.github/workflows/test-edge.yml b/.github/workflows/test-edge.yml new file mode 100644 index 0000000..3a8d48f --- /dev/null +++ b/.github/workflows/test-edge.yml @@ -0,0 +1,121 @@ +name: Test ❯ Edge +# Runs tests against edge versions of Erlang/OTP and Elixir +# to get ahead of incompatible changes. + +on: + # Allow running from GitHub UI. + workflow_dispatch: {} + + # Run daily. + schedule: + - cron: 0 0 * * * + +env: + edge-elixir: "master" + edge-otp: "x" + MIX_ENV: test + +concurrency: + group: test-edge-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: Testing Edge + runs-on: ${{ vars.PREFERRED_OS }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ env.edge-elixir }} + otp-version: ${{ env.edge-otp }} + + - name: Unlock dependencies + run: mix deps.unlock --all + + - name: Install mix dependencies + run: mix deps.get + + - name: Compile mix dependencies + run: mix deps.compile + + - name: Run test suite + run: mix test + + types: + # Skip type checking for now + if: ${{ !always() }} + name: Typechecking Edge + runs-on: ${{ vars.PREFERRED_OS }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ env.edge-elixir }} + otp-version: ${{ env.edge-otp }} + + - name: Unlock dependencies + run: mix deps.unlock --all + + - name: Install mix dependencies + run: mix deps.get + + - name: Compile mix dependencies + run: mix deps.compile + + - name: Run typecheck tasks + run: mix typecheck + + lints: + name: Linting Edge + runs-on: ${{ vars.PREFERRED_OS }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ env.edge-elixir }} + otp-version: ${{ env.edge-otp }} + + - name: Unlock dependencies + run: mix deps.unlock --all + + - name: Install mix dependencies + run: mix deps.get + + - name: Compile mix dependencies + run: mix deps.compile + + - name: Run linter tasks + run: mix lint + continue-on-error: true + + results: + name: Test Edge Action Results + runs-on: ${{ vars.PREFERRED_OS }} + + if: ${{ always() }} + needs: + - tests + - types + - lints + + steps: + - name: Test Suite Succeeded + if: ${{ needs.tests.result == 'success' && needs.types.result == 'success' && needs.lints.result == 'success' }} + run: exit 0 + + - name: Test Suite Failed + if: ${{ needs.tests.result == 'failure' || needs.types.result == 'failure' || needs.lints.result == 'failure' }} + run: exit 1 From 3a276f0b3457dc5cd12b446388a5b5471838ae57 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sun, 14 Apr 2024 00:27:28 -0500 Subject: [PATCH 22/30] Remove old CI workflow. --- .github/workflows/pulls.yml | 42 ------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 .github/workflows/pulls.yml diff --git a/.github/workflows/pulls.yml b/.github/workflows/pulls.yml deleted file mode 100644 index 5d3c02f..0000000 --- a/.github/workflows/pulls.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Elixir CI - -on: - # - push - # - pull_request - - workflow_dispatch - -jobs: - ci: - name: ci - runs-on: ubuntu-latest - strategy: - matrix: - elixir: [1.10.3, 1.11.0] - otp: [22.3, 23.1] - steps: - - uses: actions/checkout@v2 - - name: Set up Elixir - uses: erlef/setup-beam@v1 - with: - elixir-version: ${{ matrix.elixir }} - otp-version: ${{ matrix.otp }} - - name: Restore dependencies cache - uses: actions/cache@v2 - with: - path: deps - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('**/mix.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles('**/mix.lock') }} - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix - - name: Restore Dialyzer PLT cache - uses: actions/cache@v2 - with: - path: priv/plts - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-${{ hashFiles('**/priv/plts/dialyzer.plt.hash') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-${{ hashFiles('**/priv/plts/dialyzer.plt.hash') }} - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt - - name: Install dependencies - run: mix deps.get - - name: mix check - run: mix check From e0c02651d9b3c93eafffadf44acc9eca3f9f866d Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sun, 14 Apr 2024 00:31:42 -0500 Subject: [PATCH 23/30] Trigger first edge run. From e5fc33b71391ee88ddcf45391df48d72948a8866 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Wed, 29 May 2024 18:02:24 -0500 Subject: [PATCH 24/30] Prepare to release pre-release version to validate handoff. --- .github/workflows/publish-package.yml | 68 +++++++++++++++++++++++++++ .github/workflows/release.yml | 34 -------------- .github/workflows/test-matrix.yml | 8 ++-- .github/workflows/test-status.yml | 4 +- .github/workflows/test-suite.yml | 14 +++--- VERSION | 2 +- 6 files changed, 82 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/publish-package.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 0000000..d9114b8 --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,68 @@ +name: Publish ❯ Package + +on: + # push: + # tags: + # - "v*" + workflow_dispatch: {} + +jobs: + hex: + runs-on: ${{ vars.PREFERRED_OS }} + name: Publishing Package + + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + MIX_ENV: prod + + steps: + - uses: actions/checkout@v2 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ vars.PREFERRED_ELIXIR }} + otp-version: ${{ vars.PREFERRED_OTP }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: deps + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Publish package to hex.pm + run: mix hex.publish --yes + + results: + name: Publish Package Results + runs-on: ${{ vars.PREFERRED_OS }} + + if: ${{ always() }} + needs: + - hex + + steps: + - name: Test Status Succeeded + if: ${{ needs.hex.result == 'success' }} + run: exit 0 + + - name: Test Status Failed + if: ${{ needs.hex.result == 'failure' }} + run: exit 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 34116d6..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Release - -on: - # push: - # tags: - # - '*' - workflow_dispatch: {} - -jobs: - release: - runs-on: ubuntu-latest - name: Release - strategy: - matrix: - otp: [23] - elixir: [1.11.0] - env: - HEX_API_KEY: ${{ secrets.HEX_API_KEY }} - steps: - - uses: actions/checkout@v2 - - uses: erlef/setup-beam@v1 - with: - otp-version: ${{matrix.otp}} - elixir-version: ${{matrix.elixir}} - - name: Restore dependencies cache - uses: actions/cache@v2 - with: - path: deps - key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-release-deps-${{ hashFiles('**/mix.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-release-deps-${{ hashFiles('**/mix.lock') }} - ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-release-deps - - run: mix deps.get - - run: mix hex.publish --yes diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 22676be..8cf8d35 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -228,7 +228,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' @@ -430,7 +430,7 @@ jobs: path: | deps mix.lock - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' @@ -441,7 +441,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' @@ -452,7 +452,7 @@ jobs: uses: actions/cache@v4 with: path: priv/plts - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-typecheck - name: Setup typechecking if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/test-status.yml b/.github/workflows/test-status.yml index e7110d8..c02461f 100644 --- a/.github/workflows/test-status.yml +++ b/.github/workflows/test-status.yml @@ -48,7 +48,7 @@ jobs: path: | deps mix.lock - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' @@ -59,7 +59,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 4976f9f..540aa5a 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -36,7 +36,7 @@ jobs: path: | deps mix.lock - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' @@ -47,7 +47,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' @@ -77,7 +77,7 @@ jobs: uses: actions/cache@v4 with: path: deps - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' @@ -88,7 +88,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' @@ -99,7 +99,7 @@ jobs: uses: actions/cache@v4 with: path: priv/plts - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-typecheck - name: Setup typechecking if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' @@ -127,7 +127,7 @@ jobs: uses: actions/cache@v4 with: path: deps - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Install mix dependencies if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' @@ -138,7 +138,7 @@ jobs: uses: actions/cache@v4 with: path: _build - key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - name: Compile mix dependencies if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' diff --git a/VERSION b/VERSION index a53741c..da32be0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.6 \ No newline at end of file +0.2.7-handoff From 3a3177104edf3ae8d74a19cca9f704f0e9b4e97b Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sun, 2 Jun 2024 17:24:56 -0500 Subject: [PATCH 25/30] Revert to more reliable erlang version parsing --- mix.exs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/mix.exs b/mix.exs index b9b4875..742a72b 100644 --- a/mix.exs +++ b/mix.exs @@ -3,23 +3,24 @@ defmodule Erlex.MixProject do @version "VERSION" |> File.read!() |> String.trim() @elixir_version System.version() |> Version.parse!() - @erlang_version Path.join([ - :code.root_dir(), - "releases", - :erlang.system_info(:otp_release), - "OTP_VERSION" - ]) - |> File.read!() - |> String.trim() - |> String.split(".") - |> Stream.unfold(fn - [] -> nil - [head | tail] -> {head, tail} - end) - |> Stream.concat(Stream.repeatedly(fn -> 0 end)) - |> Enum.take(3) - |> Enum.join(".") - |> Version.parse!() + @erlang_version :erlang.system_info(:otp_release) |> List.to_string() |> String.to_integer() + # Path.join([ + # :code.root_dir(), + # "releases", + # :erlang.system_info(:otp_release), + # "OTP_VERSION" + # ]) + # |> File.read!() + # |> String.trim() + # |> String.split(".") + # |> Stream.unfold(fn + # [] -> nil + # [head | tail] -> {head, tail} + # end) + # |> Stream.concat(Stream.repeatedly(fn -> 0 end)) + # |> Enum.take(3) + # |> Enum.join(".") + # |> Version.parse!() @name "Erlex" @description "Convert Erlang style structs and error messages to equivalent Elixir." @@ -142,7 +143,7 @@ defmodule Erlex.MixProject do plt_core_path: "priv/plts", flags: ["-Wunmatched_returns", "-Wno_opaque", :error_handling, :underspecs] ++ - if Version.match?(@erlang_version, "< 25.0.0") do + if @erlang_version < 25 do [:race_conditions] else [] From ee728673c3a5b8f3106621d78629d16561dc0445 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sun, 2 Jun 2024 17:59:38 -0500 Subject: [PATCH 26/30] Get smart about release action inputs later, but do run tests. --- .github/workflows/publish-package.yml | 516 +++++++++++++++++++++++++- mix.exs | 1 + 2 files changed, 511 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index d9114b8..b2dfc5e 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -4,12 +4,513 @@ on: # push: # tags: # - "v*" - workflow_dispatch: {} + + workflow_dispatch: + {} + # inputs: + # version: + # description: Version Number + # type: string + # required: true + # prerelease: + # description: Prerelease? + # type: boolean + # required: true + # default: true + +concurrency: + group: perform-release-${{ github.ref }} + cancel-in-progress: true jobs: + tests: + name: Testing Matrix + runs-on: ${{ matrix.os }} + env: + MIX_ENV: test + + continue-on-error: ${{ matrix.type == 'optional' }} + strategy: + matrix: + os: + - "ubuntu-20.04" + - "windows-2019" + - "windows-2022" + elixir: + - "1.14.x" + - "1.15.x" + - "1.16.x" + otp: + - "24.x" + - "25.x" + # - "26.x" # Requires ubuntu-22.04 + type: [required] + include: + #### + # Additional version combinations we want to check + # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp + # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/0548765838a08583c83d72d208fde112104a3d2b/.github/workflows/pulls.yml#L11-L12 + # Project was originally claiming it supports back to Elixir 1.6, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/master/mix.exs#L11 + ## + + # OTP 26+ requires ubuntu-22+ + - elixir: "1.14.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.15.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.16.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + + # Elixir 1.14 also supports OTP 23 + - elixir: "1.14.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.13 supports OTP 22-25 + - elixir: "1.13.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "25.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.12 supports OTP 22-24 + - elixir: "1.12.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.11 supports OTP 21-23 + - elixir: "1.11.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.10 supports OTP 21-23 + - elixir: "1.10.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.9 supports OTP 20-22 + - elixir: "1.9.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.8 supports OTP 20-22 + - elixir: "1.8.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.7 supports OTP 19-22 + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.7.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required + - elixir: "1.7.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.6 supports OTP 19-21 + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.6.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required + - elixir: "1.6.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.6.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: | + deps + mix.lock + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-${{ steps.beam-versions.outputs.otp-version }}-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Run test suite + run: mix test + + types: + # Skip type checking for now + if: ${{ !always() }} + name: Typechecking Matrix + runs-on: ${{ matrix.os }} + env: + MIX_ENV: test + + continue-on-error: ${{ matrix.type == 'optional' }} + strategy: + matrix: + os: + - "ubuntu-20.04" + - "windows-2019" + - "windows-2022" + elixir: + - "1.14.x" + - "1.15.x" + - "1.16.x" + otp: + - "24.x" + - "25.x" + # - "26.x" # Requires ubuntu-22.04 + type: [required] + include: + #### + # Additional version combinations we want to check + # See: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/compatibility-and-deprecations.md#compatibility-between-elixir-and-erlangotp + # Project was originally only tested on Elixir 1.10-1.11, OTP 22-23, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/0548765838a08583c83d72d208fde112104a3d2b/.github/workflows/pulls.yml#L11-L12 + # Project was originally claiming it supports back to Elixir 1.6, so we should test back to then until a breaking release + # See: https://github.com/asummers/erlex/blob/master/mix.exs#L11 + ## + + # OTP 26+ requires ubuntu-22+ + - elixir: "1.14.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.15.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + - elixir: "1.16.x" + otp: "26.x" + os: "ubuntu-22.04" + type: required + + # Elixir 1.14 also supports OTP 23 + - elixir: "1.14.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.13 supports OTP 22-25 + - elixir: "1.13.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.13.x" + otp: "25.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.12 supports OTP 22-24 + - elixir: "1.12.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.12.x" + otp: "24.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.11 supports OTP 21-23 + - elixir: "1.11.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.11.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.10 supports OTP 21-23 + - elixir: "1.10.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.10.x" + otp: "23.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.9 supports OTP 20-22 + - elixir: "1.9.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.9.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.8 supports OTP 20-22 + - elixir: "1.8.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.8.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.7 supports OTP 19-22 + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.7.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required + - elixir: "1.7.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.7.x" + otp: "22.x" + os: "ubuntu-20.04" + type: required + + # Elixir 1.6 supports OTP 19-21 + # Note that OTP < 20 requires ubuntu-18.04, which is no longer supported by GitHub actions, + # so we skip it + # - elixir: "1.6.x" + # otp: "19.x" + # os: "ubuntu-18.04" + # type: required + - elixir: "1.6.x" + otp: "20.x" + os: "ubuntu-20.04" + type: required + - elixir: "1.6.x" + otp: "21.x" + os: "ubuntu-20.04" + type: required + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: | + deps + mix.lock + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-exs-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.exs')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Restore mix typecheck cache + id: mix-typecheck-cache + uses: actions/cache@v4 + with: + path: priv/plts + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-typecheck + + - name: Setup typechecking + if: steps.mix-typecheck-cache.outputs.cache-hit != 'true' + run: mix typecheck.build-cache + + - name: Run typecheck tasks + run: mix typecheck + + lints: + name: Linting + runs-on: ${{ vars.PREFERRED_OS }} + env: + MIX_ENV: test + + steps: + - uses: actions/checkout@v4 + + - name: Install Erlang & Elixir + id: beam-versions + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ vars.PREFERRED_ELIXIR }} + otp-version: ${{ vars.PREFERRED_OTP }} + + - name: Restore mix dependency installation cache + id: mix-deps-get-cache + uses: actions/cache@v4 + with: + path: deps + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Install mix dependencies + if: steps.mix-deps-get-cache.outputs.cache-hit != 'true' + run: mix deps.get + + - name: Restore mix dependency compilation cache + id: mix-deps-compile-cache + uses: actions/cache@v4 + with: + path: _build + key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + + - name: Compile mix dependencies + if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true' + run: mix deps.compile + + - name: Run linter tasks + run: mix lint + hex: runs-on: ${{ vars.PREFERRED_OS }} - name: Publishing Package + name: Publishing to hex.pm + + needs: + - tests + - types + - lints env: HEX_API_KEY: ${{ secrets.HEX_API_KEY }} @@ -56,13 +557,16 @@ jobs: if: ${{ always() }} needs: + - tests + - types + - lints - hex steps: - - name: Test Status Succeeded - if: ${{ needs.hex.result == 'success' }} + - name: Publish Package Succeeded + if: ${{ needs.tests.result == 'success' && needs.types.result == 'success' && needs.lints.result == 'success' && needs.hex.result == 'success' }} run: exit 0 - - name: Test Status Failed - if: ${{ needs.hex.result == 'failure' }} + - name: Publish Package Failed + if: ${{ needs.tests.result == 'failure' || needs.types.result == 'failure' || needs.lints.result == 'failure' || needs.hex.result == 'failure' }} run: exit 1 diff --git a/mix.exs b/mix.exs index 742a72b..aa48727 100644 --- a/mix.exs +++ b/mix.exs @@ -194,6 +194,7 @@ defmodule Erlex.MixProject do "mix.exs", "README.md", "LICENSE.md", + "VERSION", "src/erlex_lexer.xrl", "src/erlex_parser.yrl" ], From 7b1853728ed2a062625ecb5a8330b8bceaf781a4 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Wed, 5 Jun 2024 18:50:21 -0500 Subject: [PATCH 27/30] Produce debug info in all contexts. --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index aa48727..cc51b9b 100644 --- a/mix.exs +++ b/mix.exs @@ -38,7 +38,7 @@ defmodule Erlex.MixProject do # Application app: :erlex, elixir: "~> 1.6", - elixirc_options: [debug_info: Mix.env() in @dev_envs], + # elixirc_options: [debug_info: Mix.env() in @dev_envs], start_permanent: Mix.env() == :prod, compilers: [:leex, :yecc] ++ Mix.compilers(), version: @version, From d54374a61041a35c5f3fb854ab02fd3f52e9e281 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Thu, 20 Jun 2024 15:44:59 -0500 Subject: [PATCH 28/30] Release v0.2.7 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index da32be0..b003284 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.7-handoff +0.2.7 From 986860de6d8628b3d0f4035de8bc73a1b256df3a Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Thu, 20 Jun 2024 16:06:26 -0500 Subject: [PATCH 29/30] Handle elixir version deprecations in nimble_parsec --- .tool-versions | 4 ++-- mix.exs | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.tool-versions b/.tool-versions index cfceafc..6fe0c3d 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -elixir 1.16.2-otp-26 -erlang 26.2.4 +elixir 1.17.1-otp-27 +erlang 27.0 diff --git a/mix.exs b/mix.exs index cc51b9b..1b10b71 100644 --- a/mix.exs +++ b/mix.exs @@ -160,7 +160,7 @@ defmodule Erlex.MixProject do # {:dialyxir, "~> 1.4", only: @dev_envs, runtime: false, override: true}, # Transative dependency on ErlEx {:excoveralls, "~> 0.18", only: :test}, {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} - ] ++ deps(:credo) + ] ++ deps(:credo) ++ deps(:nimble_parsec) end defp deps(:credo) do @@ -172,7 +172,17 @@ defmodule Erlex.MixProject do [{:credo, "< 1.7.0", only: @dev_envs, runtime: false}] true -> - [{:credo, "~> 1.7", only: @dev_envs, runtime: false}] + [{:credo, ">= 1.7.0", only: @dev_envs, runtime: false}] + end + end + + defp deps(:nimble_parsec) do + cond do + Version.match?(@elixir_version, "< 1.12.0") -> + [{:nimble_parsec, "< 1.4.0", only: @dev_envs, override: true, runtime: false}] + + true -> + [{:nimble_parsec, ">= 1.4.0", only: @dev_envs, runtime: false}] end end From a16d7c7d6a932bbffb9a6b4c2889b2b9442e0e95 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Thu, 20 Jun 2024 16:18:35 -0500 Subject: [PATCH 30/30] Handle elixir version deprecations in credo --- mix.exs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 1b10b71..e672bc2 100644 --- a/mix.exs +++ b/mix.exs @@ -171,8 +171,11 @@ defmodule Erlex.MixProject do Version.match?(@elixir_version, "< 1.10.0") -> [{:credo, "< 1.7.0", only: @dev_envs, runtime: false}] + Version.match?(@elixir_version, "< 1.13.0") -> + [{:credo, "< 1.7.7", only: @dev_envs, runtime: false}] + true -> - [{:credo, ">= 1.7.0", only: @dev_envs, runtime: false}] + [{:credo, ">= 1.7.7", only: @dev_envs, runtime: false}] end end