diff --git a/.gitea/workflows/python-syntax.yml b/.gitea/workflows/python-syntax.yml index 64d3092..7fbb2d3 100644 --- a/.gitea/workflows/python-syntax.yml +++ b/.gitea/workflows/python-syntax.yml @@ -3,12 +3,8 @@ name: Code Check - Quality and Syntax on: push: branches: ["**"] - paths: - - '**/*.py' pull_request: branches: ["**"] - paths: - - '**/*.py' jobs: syntax-lint: @@ -51,5 +47,26 @@ jobs: files=$(git ls-files '*.py') for file in $files; do echo "Testing execution of $file..." - python "$file" --version || python -m py_compile "$file" + # Try to run the file with a 5-second timeout + timeout 5s python "$file" --version + status=$? + + # If it ran successfully, continue + if [ $status -eq 0 ]; then + continue + fi + + # If the run timed out (timeout returns 124) and this is with_ui.py, allow it + if [ $status -eq 124 ] && [ "$file" = "with_ui.py" ]; then + echo "Timed out after 5s for $file — allowed for with_ui.py" + continue + fi + + # Otherwise, fall back to a compile check + python -m py_compile "$file" + status2=$? + if [ $status2 -ne 0 ]; then + echo "Execution or compile failed for $file (exit $status or $status2)" + exit $status2 + fi done