diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2043ef..1dd34d3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,33 +4,57 @@ on: [push, pull_request] jobs: credo: - name: Credo + name: Static analysis runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install OTP and Elixir uses: actions/setup-elixir@v1 with: - otp-version: 22.1 - elixir-version: 1.9.4 + otp-version: 23.1.1 + elixir-version: 1.11.x - run: mix deps.get - - run: mix compile - - run: mix credo + - run: mix format --check-formatted + - run: mix compile --warnings-as-errors + - run: mix credo --all --strict test: name: Test runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - elixir: 1.7.x + otp: 19.3.6.13 + - elixir: 1.8.x + otp: 20.3.8.26 + - elixir: 1.9.x + otp: 20.3.8.26 + - elixir: 1.10.x + otp: 21.3.8.18 + - elixir: 1.11.x + otp: 21.3.8.18 + - elixir: 1.11.x + otp: 23.1.1 + warnings_as_errors: true + env: + MIX_ENV: test + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install OTP and Elixir uses: actions/setup-elixir@v1 with: - otp-version: 22.1 - elixir-version: 1.9.4 + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} - - run: mix deps.get - - run: MIX_ENV=test mix compile - - run: mix test + - run: mix deps.get --only test + - name: Run mix test + run: mix test --color 2>/tmp/tests.stderr + - name: Make sure tests do not have warnings + run: "! grep -v 'warning: ' /tmp/tests.stderr" + if: matrix.warnings_as_errors diff --git a/lib/norm/core/all_of.ex b/lib/norm/core/all_of.ex index cd5f75c..b3636f5 100644 --- a/lib/norm/core/all_of.ex +++ b/lib/norm/core/all_of.ex @@ -25,4 +25,3 @@ defmodule Norm.Core.AllOf do end end end - diff --git a/test/norm/contract_test.exs b/test/norm/contract_test.exs index 4004a07..e7eb597 100644 --- a/test/norm/contract_test.exs +++ b/test/norm/contract_test.exs @@ -94,7 +94,7 @@ defmodule Norm.ContractTest do defmodule Reflection do use Norm - def int(), do: spec(is_integer()) + def int, do: spec(is_integer()) @contract foo(a :: int(), int()) :: int() def foo(a, b), do: a + b diff --git a/test/norm/core/delegate_test.exs b/test/norm/core/delegate_test.exs index ae2c5a8..bbf8553 100644 --- a/test/norm/core/delegate_test.exs +++ b/test/norm/core/delegate_test.exs @@ -2,7 +2,7 @@ defmodule Norm.Core.DelegateTest do use Norm.Case, async: true defmodule TreeTest do - def spec() do + def spec do schema(%{ "value" => spec(is_integer()), "left" => delegate(&TreeTest.spec/0), diff --git a/test/norm/core/schema_test.exs b/test/norm/core/schema_test.exs index 729b60e..a2e5324 100644 --- a/test/norm/core/schema_test.exs +++ b/test/norm/core/schema_test.exs @@ -175,7 +175,7 @@ defmodule Norm.Core.SchemaTest do test "allows defaults" do spec = schema(%Movie{}) - assert movie = conform(%Movie{}, spec) + assert conform(%Movie{}, spec) end property "can generate proper structs" do diff --git a/test/norm_test.exs b/test/norm_test.exs index eac68e6..2c8f5aa 100644 --- a/test/norm_test.exs +++ b/test/norm_test.exs @@ -263,7 +263,7 @@ defmodule NormTest do assert {:error, _errors} = conform([{:foo, :bar} | list], spec) assert list == conform!(list, coll_of(opts, [min_count: 2, distinct: true])) - assert {:error, errors} = conform([], coll_of(opts, [min_count: 2, distinct: true])) + assert {:error, _errors} = conform([], coll_of(opts, [min_count: 2, distinct: true])) end property "can be generated" do