Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
support direct run
Browse files Browse the repository at this point in the history
  • Loading branch information
zrr1999 committed Jul 5, 2023
1 parent c5e2c48 commit 98d16f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion examples/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ export STRICT_MODE=1
for file in ./*.py; do
# 检查文件是否为 Python 文件
if [ -f "$file" ]; then
echo "::group::example $file"
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo ::group::example Running: LOG_LEVEL=3 PYTHONPATH=$PYTHONPATH " STRICT_MODE=1 python " $file
else
echo Running: LOG_LEVEL=3 PYTHONPATH=$PYTHONPATH " STRICT_MODE=1 python " $file
fi
# 执行文件
python "$file"
if [ $? -ne 0 ]; then
echo "run $file failed"
exit 1
fi
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo "::endgroup::"
fi
fi
done
10 changes: 7 additions & 3 deletions tests/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ failed_tests=()
for file in ./test_*.py; do
# 检查文件是否为 Python 文件
if [ -f "$file" ]; then
echo "::group::test $file"
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo ::group::Running: PYTHONPATH=$PYTHONPATH " STRICT_MODE=1 python " $file
else
echo Running: PYTHONPATH=$PYTHONPATH " STRICT_MODE=1 python " $file
fi
# 执行文件
python "$file"
python "$file" 2> >(grep "File <$file>, line")
if [ $? -ne 0 ]; then
echo "run $file failed"
failed_tests+=("$file")
fi
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo "::endgroup::"
fi
fi
done

Expand All @@ -25,5 +30,4 @@ if [ ${#failed_tests[@]} -ne 0 ]; then
echo "$failed_test"
echo "::error file=$failed_test,line=1,col=5,endColumn=7::Missing semicolon"
done
exit 1
fi

0 comments on commit 98d16f8

Please sign in to comment.