1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00
seahub/tests/test_seahub_changes.sh
2025-03-06 15:22:49 +08:00

46 lines
718 B
Bash
Executable File

#!/bin/bash
test_fn()
{
FN=$1
shift;
echo "Testing $FN..."
# frontend* -> 0
patt="frontend*"
[[ $FN == $patt ]] && return 0
# media* -> 0
patt="media*"
[[ $FN == $patt ]] && return 0
# static* -> 0
patt="static*"
[[ $FN == $patt ]] && return 0
# locale* -> 0
patt="locale*"
[[ $FN == $patt ]] && return 0
return 1
}
git fetch origin $GITHUB_BASE_REF
FILES=`git diff --name-only origin/$GITHUB_BASE_REF`
echo $FILES
for i in $FILES
do
test_fn $i
retval=$?
if [ "$retval" == 1 ]; then
echo "File changes need to trigger tests."
exit 0
fi
done
echo "Static/media file changes should not trigger tests."
exit 1