diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index b8e051d..81c879d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - syntax-check: + validate: runs-on: dotfiles container: image: python:3-slim @@ -33,70 +33,30 @@ jobs: done exit $failed - memory-leak-check: - runs-on: dotfiles - container: - image: python:3-slim - steps: - - name: Checkout + - name: Import validation run: | - apt-get update && apt-get install -y git - git clone --depth 1 --branch "${GITHUB_REF_NAME}" \ - "https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" . - - - name: Check for memory leak patterns - run: | - echo "Scanning for common memory leak patterns..." + echo "Verifying module imports..." failed=0 - - # Check for unbounded list/dict growth without limits - echo "Checking for unbounded collections..." - for f in ppf.py proxywatchd.py scraper.py httpd.py; do - if [ -f "$f" ]; then - # Look for .append() without corresponding size limits - if grep -n "\.append(" "$f" | grep -v "# bounded" | grep -v "_max\|max_\|limit\|[:]\|pop(" > /tmp/unbounded 2>/dev/null; then - count=$(wc -l < /tmp/unbounded) - if [ "$count" -gt 20 ]; then - echo "WARN $f: $count potential unbounded appends" - fi - fi + for mod in comboparse config dbs job misc mysqlite network_stats stats translations; do + if python3 -c "import sys; sys.path.insert(0,'.'); import $mod; print('OK $mod')"; then + : + else + echo "FAIL $mod" + failed=1 fi done + exit $failed - # Check for circular references - echo "Checking for potential circular references..." - for f in ppf.py proxywatchd.py scraper.py httpd.py connection_pool.py; do - if [ -f "$f" ]; then - if grep -n "self\.\w* = self" "$f" 2>/dev/null; then - echo "WARN $f: potential self-reference" - fi - fi - done - - # Check for __del__ methods (often problematic) - echo "Checking for __del__ methods..." - for f in *.py; do - if grep -n "def __del__" "$f" 2>/dev/null; then - echo "WARN $f: has __del__ method (may cause leaks)" - fi - done - - # Check that gc is imported where needed - echo "Checking gc module usage..." - for f in proxywatchd.py httpd.py; do - if [ -f "$f" ]; then - if ! grep -q "^import gc" "$f" && ! grep -q "^from gc" "$f"; then - echo "INFO $f: gc module not imported" - fi - fi - done - - echo "Memory leak pattern scan complete" - - - name: Static import check + - name: YAML lint run: | - echo "Verifying imports..." - python3 -c "import sys; sys.path.insert(0,'.'); import config; print('OK config')" || echo "FAIL config" - python3 -c "import sys; sys.path.insert(0,'.'); import misc; print('OK misc')" || echo "FAIL misc" - python3 -c "import sys; sys.path.insert(0,'.'); import mysqlite; print('OK mysqlite')" || echo "FAIL mysqlite" - + echo "Checking YAML files for tabs..." + failed=0 + for f in compose.master.yml compose.worker.yml .gitea/workflows/ci.yml; do + if grep -qP '\t' "$f"; then + echo "FAIL $f: contains tabs" + failed=1 + else + echo "OK $f" + fi + done + exit $failed