Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 36 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion lib/norm/core/all_of.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ defmodule Norm.Core.AllOf do
end
end
end

2 changes: 1 addition & 1 deletion test/norm/contract_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/norm/core/delegate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion test/norm/core/schema_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/norm_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down