Skip to content

Commit

Permalink
feat: print average similarity
Browse files Browse the repository at this point in the history
  • Loading branch information
bend-n committed Sep 29, 2022
1 parent 04e0618 commit 8cf4b3a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ echo ::endgroup::
echo ::group::diff

cd sprites-override

cat >simmilarity.py <<EOF
#!/usr/bin/env python3
def avg(ls):
return sum(ls) / len(ls)
ls = [
EOF
chmod +x simmilarity.py
shopt -s globstar
for i in **/*.png; do
if grep -q -F "$i" "$root_path/diff_overrides"; then
Expand All @@ -31,9 +41,15 @@ for i in **/*.png; do
echo "[$i]: exactly the same"
else
echo "[$i]: $dissimilarity dissimilar"
echo -n "$dissimilarity," >>simmilarity.py
fi
fi
done
echo -e "]\nprint(round(abs(avg(ls * 100) - 100), 3))" >>simmilarity.py

[[ -f "$GITHUB_STEP_SUMMARY" ]] &&
echo "# $(./simmilarity.py)% similar" >"$GITHUB_STEP_SUMMARY"
echo "[average]: $(./simmilarity.py)% similar"

[[ -n "$errors" ]] && exit 1 # for github actions to report a failure

Expand Down

0 comments on commit 8cf4b3a

Please sign in to comment.