name: CI on: pull_request: branches: - main jobs: test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies run: | python3 -m pip install --upgrade pip pip install -r requirements.txt playwright install --with-deps chromium - name: Run tests run: | pytest tests/ - name: Validate palace taxonomy run: | pip install pyyaml -q python3 mempalace/validate_rooms.py docs/mempalace/bezalel_example.yaml validate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Validate Python syntax run: | FAIL=0 for f in $(find . -name '*.py' -not -path './venv/*'); do if python3 -c "import py_compile; py_compile.compile('$f', doraise=True)" 2>/dev/null; then echo "OK: $f" else echo "FAIL: $f" FAIL=1 fi done exit $FAIL - name: Validate JSON run: | FAIL=0 for f in $(find . -name '*.json' -not -path './venv/*'); do if ! python3 -c "import json; json.load(open('$f'))" 2>/dev/null; then echo "FAIL: $f" FAIL=1 else echo "OK: $f" fi done exit $FAIL - name: Repo Truth Guard run: | python3 scripts/repo_truth_guard.py - name: Validate YAML run: | pip install pyyaml -q FAIL=0 for f in $(find . -name '*.yaml' -o -name '*.yml' | grep -v '.gitea/'); do if ! python3 -c "import yaml; yaml.safe_load(open('$f'))"; then echo "FAIL: $f" FAIL=1 else echo "OK: $f" fi done exit $FAIL - name: "HARD RULE: 10-line net addition limit" run: | ADDITIONS=$(git diff --numstat origin/main...HEAD | awk '{s+=$1} END {print s+0}') DELETIONS=$(git diff --numstat origin/main...HEAD | awk '{s+=$2} END {print s+0}') NET=$((ADDITIONS - DELETIONS)) echo "Additions: +$ADDITIONS | Deletions: -$DELETIONS | Net: $NET" if [ "$NET" -gt 10 ]; then echo "" echo "═══════════════════════════════════════════════════" echo " BLOCKED: Net addition is $NET lines (max: 10)." echo " Delete code elsewhere to compensate." echo "═══════════════════════════════════════════════════" exit 1 fi echo "✓ Net addition ($NET) within 10-line limit."