Add check_dilate

This commit is contained in:
def 2020-09-11 00:00:33 +02:00 committed by Jupeyy
parent a077f727e8
commit 0822f9cecd
2 changed files with 45 additions and 2 deletions

View file

@ -14,13 +14,28 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install clang-format
with:
submodules: true
- name: Prepare
run: |
sudo apt-get update -y
sudo apt-get install clang-format -y
sudo apt-get install clang-format imagemagick ddnet-tools -y
- name: Check style
run: |
clang-format -version
scripts/fix_style.py --dry-run
scripts/check_header_guards.py
scripts/languages/update_all.py
- name: Prepare build dilate
run: |
sudo apt-get update -y
sudo apt-get install pkg-config cmake libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev -y
- name: Build dilate
run: |
mkdir release
cd release
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=OFF -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
cmake --build . --config Release --target dilate --parallel
- name: Check if images are dilated
run: |
scripts/check_dilate.sh release data

28
scripts/check_dilate.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
#set -x
result=
dil_path=$1
result=$(find $2 -iname '*.png' -print0 | while IFS= read -r -d $'\0' file; do
new_file=$(mktemp --tmpdir "$(basename "$file" .png).XXX.png")
cp "$file" "$new_file"
convert "$new_file" "${new_file}_old.bmp" >> /dev/null
${dil_path}/dilate "$new_file" >> /dev/null
convert "$new_file" "${new_file}_new.bmp" >> /dev/null
orig_hash=$(identify -quiet -format "%#" "${new_file}_old.bmp")
new_hash=$(identify -quiet -format "%#" "${new_file}_new.bmp")
rm "$new_file"
rm "${new_file}_old.bmp"
rm "${new_file}_new.bmp"
if [ "$orig_hash" != "$new_hash" ]; then
printf "$file is not dilated\n"
fi
done)
if [[ "$result" != "" ]]; then
printf "$result"
exit 1
fi
exit 0