Add a sanity check to build-and-test workflow to prevent overzealous asset file optimizations (#51)

This commit is contained in:
Wilhelm Schuster 2025-09-18 10:57:24 +02:00 committed by GitHub
parent 9a64d69ca0
commit 7efb286761
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,3 +135,21 @@ jobs:
- name: Test no prerelease dependencies used
run: |
! grep -P -- "-pre(?!shadow)" dependencies.gradle*
# See https://github.com/GTNewHorizons/GT5-Unofficial/pull/4880
- name: Make sure asset files are not overoptimized
run: |
echo "Checking for grayscale asset files which are not supported by the java8 image loader"
fail=0
set -o pipefail
while IFS= read -r -d $'\n' file; do
if $(file --brief -- "$file" | grep -q grayscale); then
printf "found grayscale image '%s'\n" "$file"
fail=1
fi
done < <(gh pr diff --name-only "${PR_NUMBER}" | grep 'src/main/resources/.*\.png$')
exit $fail
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}