Skip to content

Commit

Permalink
Add rudimentary grep for runtime warnings in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Nov 4, 2024
1 parent f8955df commit 271714f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions test/error_if_warnings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
grep -E "^warning: .+" --after-context=6 <&0

if [ $? -eq 0 ]
then
exit 1
else
exit 0
fi
38 changes: 38 additions & 0 deletions test/runtime_warnings.sh
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit 271714f

Please sign in to comment.