ci: consolidate jobs, expand import check, add yaml lint
Some checks failed
CI / validate (push) Failing after 19s

This commit is contained in:
Username
2026-02-18 20:59:49 +01:00
parent 7705ef54f6
commit 9f926f4ab5

View File

@@ -8,7 +8,7 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
syntax-check: validate:
runs-on: dotfiles runs-on: dotfiles
container: container:
image: python:3-slim image: python:3-slim
@@ -33,70 +33,30 @@ jobs:
done done
exit $failed exit $failed
memory-leak-check: - name: Import validation
runs-on: dotfiles
container:
image: python:3-slim
steps:
- name: Checkout
run: | run: |
apt-get update && apt-get install -y git echo "Verifying module imports..."
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..."
failed=0 failed=0
for mod in comboparse config dbs job misc mysqlite network_stats stats translations; do
# Check for unbounded list/dict growth without limits if python3 -c "import sys; sys.path.insert(0,'.'); import $mod; print('OK $mod')"; then
echo "Checking for unbounded collections..." :
for f in ppf.py proxywatchd.py scraper.py httpd.py; do else
if [ -f "$f" ]; then echo "FAIL $mod"
# Look for .append() without corresponding size limits failed=1
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
fi fi
done done
exit $failed
# Check for circular references - name: YAML lint
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
run: | run: |
echo "Verifying imports..." echo "Checking YAML files for tabs..."
python3 -c "import sys; sys.path.insert(0,'.'); import config; print('OK config')" || echo "FAIL config" failed=0
python3 -c "import sys; sys.path.insert(0,'.'); import misc; print('OK misc')" || echo "FAIL misc" for f in compose.master.yml compose.worker.yml .gitea/workflows/ci.yml; do
python3 -c "import sys; sys.path.insert(0,'.'); import mysqlite; print('OK mysqlite')" || echo "FAIL mysqlite" if grep -qP '\t' "$f"; then
echo "FAIL $f: contains tabs"
failed=1
else
echo "OK $f"
fi
done
exit $failed