Merge branch 'main' into beta

This commit is contained in:
David Capello 2024-12-11 08:34:33 -03:00
commit 9a7ce8604b
3 changed files with 43 additions and 24 deletions

15
.github/workflows/precommit.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: pre-commit
on: [pull_request]
jobs:
precommit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1
with:
extra_args: "--from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}"

View File

@ -6,12 +6,19 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
args: [ --fix=lf ]
exclude: '.*\.cmd$|.*\.ps1$'
- id: mixed-line-ending
args: [ --fix=crlf ]
files: '.*\.cmd$|.*\.ps1$'
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: remove-tabs
args: [--whitespaces-count, '8']
exclude: '.*\.gpl$|\.gitmodules'
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.5

View File

@ -15,10 +15,10 @@ function fail() {
function expect() {
if [[ $1 != "$($2 | tr -d "\r")" ]] ; then
echo "FAILED: $2"
echo "EXPECTED: $1"
echo "RESULT: $($2)"
exit 1
echo "FAILED: $2"
echo "EXPECTED: $1"
echo "RESULT: $($2)"
exit 1
fi
}
@ -53,14 +53,11 @@ if [[ "$filter" == "" ]] || [[ "console" =~ $filter ]]; then
grep -q "this should not be in the output" $t/tmp && fail "text that shouldn't be in the output is"
if [[ "$(uname)" =~ "MINGW" ]] || [[ "$(uname)" =~ "MSYS" ]] ; then
echo Ignore console tests on Windows
echo Ignore console tests on Windows
else
$ASEPRITE -b --script scripts/console_print.lua >$t/tmp 2>&1
cat >$t/tmp_expected <<EOF
hello world
1 2 3
EOF
! diff -u $t/tmp $t/tmp_expected && fail
$ASEPRITE -b --script scripts/console_print.lua >$t/tmp 2>&1
echo -e "hello world\n1\t2\t3" >$t/tmp_expected
! diff -u $t/tmp $t/tmp_expected && fail
fi
fi
@ -69,30 +66,30 @@ result=0
for script in scripts/*.lua ; do
[[ $script =~ console ]] && continue
if [[ "$filter" != "" ]]; then
[[ $script =~ $filter ]] || continue
[[ $script =~ $filter ]] || continue
fi
if [ $first == 0 ]; then
echo ----------------------------------------------------------------------
echo "Testing scripts..."
first=1
echo ----------------------------------------------------------------------
echo "Testing scripts..."
first=1
fi
echo "Running $script"
if ! $ASEPRITE -b --script $script >$t/tmp 2>&1 ; then
echo FAILED && cat $t/tmp
result=1
echo FAILED && cat $t/tmp
result=1
fi
done
first=0
for script in cli/*.sh ; do
if [[ "$filter" == "" ]] || [[ $script =~ $filter ]]; then
if [ $first == 0 ]; then
echo ----------------------------------------------------------------------
echo "Testing CLI..."
first=1
fi
echo "Running $script"
source $script
if [ $first == 0 ]; then
echo ----------------------------------------------------------------------
echo "Testing CLI..."
first=1
fi
echo "Running $script"
source $script
fi
done