diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 8a1a4abfa..a142fb7e0 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -49,4 +49,5 @@ jobs: - run: mix deps.compile - run: mix compile --warnings-as-errors - run: mix test + - run: ./test/runtime_warnings.sh - run: ./test/smoke_test.sh diff --git a/test/error_if_warnings.sh b/test/error_if_warnings.sh new file mode 100755 index 000000000..f7b499121 --- /dev/null +++ b/test/error_if_warnings.sh @@ -0,0 +1,8 @@ +grep -E "^warning: .+" --after-context=6 <&0 + +if [ $? -eq 0 ] +then + exit 1 +else + exit 0 +fi diff --git a/test/runtime_warnings.sh b/test/runtime_warnings.sh new file mode 100755 index 000000000..86749a5b7 --- /dev/null +++ b/test/runtime_warnings.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e + +mix compile --force --warnings-as-errors + + +mix credo --mute-exit-status | ./test/error_if_warnings.sh + +mix credo --strict --enable-disabled-checks . --mute-exit-status | ./test/error_if_warnings.sh + +mix credo --strict --enable-disabled-checks . --mute-exit-status --format=json | ./test/error_if_warnings.sh + +mix credo lib/credo.ex --read-from-stdin --strict < lib/credo.ex | ./test/error_if_warnings.sh + +mix credo list --mute-exit-status | ./test/error_if_warnings.sh + +mix credo suggest --mute-exit-status | ./test/error_if_warnings.sh + +mix credo diff HEAD^ --mute-exit-status | ./test/error_if_warnings.sh + +mix credo diff v1.4.0 --mute-exit-status | ./test/error_if_warnings.sh + +mix credo explain test/fixtures/example_code/clean_redux.ex:1:11 --mute-exit-status | ./test/error_if_warnings.sh + +mix credo explain Credo.Check.Refactor.Nesting --mute-exit-status | ./test/error_if_warnings.sh + +mix credo categories | ./test/error_if_warnings.sh + +mix credo info --verbose | ./test/error_if_warnings.sh + +mix credo version | ./test/error_if_warnings.sh + +mix credo help | ./test/error_if_warnings.sh + + +echo "" +echo "Smoke test for runtime warnings successful."