Skip to content

Commit

Permalink
properly checks for exit codes, prints out number of checks failed
Browse files Browse the repository at this point in the history
  • Loading branch information
mattxwang authored Jun 7, 2021
1 parent 117afb8 commit 6f83a2b
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions _bin/run-all-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
dir=$(cd "$(dirname "$0")/.." && pwd)
bin="$dir/_bin"
root="$dir/_site"
any_failed=0
failed=0
test -d "$root" || {
echo "Please generate the site first."
echo " bundle exec jekyll serve"
Expand All @@ -12,37 +12,60 @@ test -d "$root" || {

echo "[Checking page generation]"
"$bin/check-page-generation.sh"
test $? -eq 0 && echo "--> Page generation looks good."
test $? -neq 0 && any_failed=1
if [ $? -ne 0 ]; then
failed=$((failed+1))
else
echo "--> Page generation looks good."
fi

echo
echo "[Checking user IDs]"
"$bin/check-user-ids.sh"
test $? -eq 0 && echo "--> User IDs look good."
test $? -neq 0 && any_failed=1
if [ $? -ne 0 ]; then
failed=$((failed+1))
else
echo "--> User IDs look good."
fi


echo
echo "[Checking include usage]"
"$bin/check-include-usage.sh"
test $? -eq 0 && echo "--> Includes look good."
test $? -neq 0 && any_failed=1
if [ $? -ne 0 ]; then
failed=$((failed+1))
else
echo "--> Includes look good."
fi


echo
echo "[Checking include documentation]"
"$bin/check-include-help.sh"
test $? -eq 0 && echo "--> Include docs look good."
test $? -neq 0 && any_failed=1
if [ $? -ne 0 ]; then
failed=$((failed+1))
else
echo "--> Include docs look good."
fi


echo
echo "[Checking HTML element id values]"
"$bin/check-html-ids.sh"
test $? -eq 0 && echo "--> HTML element ids look good."
test $? -neq 0 && any_failed=1
if [ $? -ne 0 ]; then
failed=$((failed+1))
else
echo "--> HTML element ids look good."
fi


# echo
# echo "[Checking site HTML]"
# "$bin/check-site-html.sh"
# test $? -eq 0 && echo "--> Site HTML looks good! Congratulations."
# test $? -neq 0 && any_failed=1
# if [ $? -ne 0 ]; then
# failed=$((failed+1))
# else
# echo "--> Site HTML looks good! Congratulations."
# fi

exit $any_failed
echo "$failed checks failed."
exit $failed

0 comments on commit 6f83a2b

Please sign in to comment.