CI: Partially sync workflows and actions with 3.x branch

Stick to `ubuntu:20.04` runners for now, as porting to newer ones implies
fixing a number of compilation warnings which may not be worth the trouble
for an EOL branch.
This commit is contained in:
Rémi Verschelde
2024-11-07 22:32:53 +01:00
parent 69962b74af
commit aa89ab0517
33 changed files with 565 additions and 643 deletions

View File

@@ -25,6 +25,8 @@ if (
file_contents.find("Program crashed with signal") != -1
or file_contents.find("Dumping the backtrace") != -1
or file_contents.find("Segmentation fault (core dumped)") != -1
or file_contents.find("Aborted (core dumped)") != -1
or file_contents.find("terminate called without an active exception") != -1
):
print("FATAL ERROR: Godot has been crashed.")
sys.exit(1)

View File

@@ -5,8 +5,8 @@
# run before them.
# We need dos2unix and recode.
if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v recode)" ]; then
printf "Install 'dos2unix' and 'recode' to use this script.\n"
if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v isutf8)" ]; then
printf "Install 'dos2unix' and 'isutf8' (from the moreutils package) to use this script.\n"
fi
set -uo pipefail
@@ -20,13 +20,17 @@ while IFS= read -rd '' f; do
continue
elif [[ "$f" == *"sln" ]]; then
continue
elif [[ "$f" == *".bat" ]]; then
continue
elif [[ "$f" == *"patch" ]]; then
continue
elif [[ "$f" == *"pot" ]]; then
continue
elif [[ "$f" == *"po" ]]; then
continue
elif [[ "$f" == "thirdparty"* ]]; then
elif [[ "$f" == "thirdparty/"* ]]; then
continue
elif [[ "$f" == *"/thirdparty/"* ]]; then
continue
elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
continue
@@ -34,7 +38,7 @@ while IFS= read -rd '' f; do
continue
fi
# Ensure that files are UTF-8 formatted.
recode UTF-8 "$f" 2> /dev/null
isutf8 "$f" >> utf8-validation.txt 2>&1
# Ensure that files have LF line endings and do not contain a BOM.
dos2unix "$f" 2> /dev/null
# Remove trailing space characters and ensures that files end
@@ -46,17 +50,27 @@ done
git diff --color > patch.patch
# If no patch has been generated all is OK, clean up, and exit.
if [ ! -s patch.patch ] ; then
# If no UTF-8 violations were collected and no patch has been
# generated all is OK, clean up, and exit.
if [ ! -s utf8-validation.txt ] && [ ! -s patch.patch ] ; then
printf "Files in this commit comply with the formatting rules.\n"
rm -f patch.patch
rm -f patch.patch utf8-validation.txt
exit 0
fi
# A patch has been created, notify the user, clean up, and exit.
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
# Violations detected, notify the user, clean up, and exit.
if [ -s utf8-validation.txt ]
then
printf "\n*** The following files contain invalid UTF-8 character sequences:\n\n"
cat utf8-validation.txt
fi
if [ -s patch.patch ]
then
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
fi
rm -f utf8-validation.txt patch.patch
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
rm -f patch.patch
exit 1