Optimize CI execution workflow. (#3371) (#3384)

* fix
This commit is contained in:
YUNSHEN XIE
2025-08-14 14:51:15 +08:00
committed by GitHub
parent d1d321bafd
commit b2df0311b8
4 changed files with 157 additions and 80 deletions

View File

@@ -66,11 +66,25 @@ for dir in "${dirs[@]}"; do
echo "Skipping disabled test: $test_file"
continue
fi
python -m coverage run "$test_file"
# TODO: Add a framework to manage unit test execution time
timeout 600 python -m coverage run "$test_file"
if [ $? -ne 0 ]; then
echo "$test_file" >> "$failed_tests_file"
fail=$((fail + 1))
PORTS=($FLASK_PORT $FD_API_PORT $FD_ENGINE_QUEUE_PORT $FD_METRICS_PORT)
echo "==== PORT CLEAN AFTER UT FAILED ===="
for port in "${PORTS[@]}"; do
PIDS=$(lsof -t -i :$port)
if [ -n "$PIDS" ]; then
echo "Port $port is occupied by PID(s): $PIDS"
echo "$PIDS" | xargs -r kill -9
echo "Port $port cleared"
else
echo "Port $port is free"
fi
done
else
success=$((success + 1))
fi