Some checks failed
Deploy Nexus / deploy (push) Failing after 4s
app.js is a THIN WRAPPER. No file over 777 lines. Current app.js is 2214 lines — must be broken up before any new features merge. CI will block PRs that violate this. Pre-commit hook catches it locally. Install hook: git config core.hooksPath .githooks
95 lines
3.0 KiB
YAML
95 lines
3.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Validate HTML
|
|
run: |
|
|
test -f index.html || { echo "ERROR: index.html missing"; exit 1; }
|
|
python3 -c "
|
|
import html.parser, sys
|
|
class V(html.parser.HTMLParser):
|
|
def __init__(self):
|
|
super().__init__()
|
|
def handle_starttag(self, tag, attrs): pass
|
|
def handle_endtag(self, tag): pass
|
|
v = V()
|
|
try:
|
|
v.feed(open('index.html').read())
|
|
print('HTML: OK')
|
|
except Exception as e:
|
|
print(f'HTML: FAIL - {e}')
|
|
sys.exit(1)
|
|
"
|
|
|
|
- name: Validate JavaScript
|
|
run: |
|
|
FAIL=0
|
|
for f in $(find . -name '*.js' -not -path './node_modules/*' -not -name 'sw.js' -not -name 'service-worker.js' -not -path './tests/*'); do
|
|
if ! node --check "$f" 2>/dev/null; then
|
|
echo "FAIL: $f"
|
|
FAIL=1
|
|
else
|
|
echo "OK: $f"
|
|
fi
|
|
done
|
|
exit $FAIL
|
|
|
|
- name: Validate JSON
|
|
run: |
|
|
FAIL=0
|
|
for f in $(find . -name '*.json' -not -path './node_modules/*' -not -path './test-*'); do
|
|
if ! python3 -c "import json; json.load(open('$f'))"; then
|
|
echo "FAIL: $f"
|
|
FAIL=1
|
|
else
|
|
echo "OK: $f"
|
|
fi
|
|
done
|
|
exit $FAIL
|
|
|
|
- name: "HARD RULE: No JS file over 777 lines"
|
|
run: |
|
|
echo "=== File Size Budget: 777 lines max per JS file ==="
|
|
FAIL=0
|
|
for f in $(find . -name '*.js' -not -path './node_modules/*' -not -path './test-*' -not -path './tests/*'); do
|
|
LINES=$(wc -l < "$f" | tr -d ' ')
|
|
if [ "$LINES" -gt 777 ]; then
|
|
echo "FAIL: $f is $LINES lines (max: 777)"
|
|
FAIL=1
|
|
else
|
|
echo "OK: $f ($LINES lines)"
|
|
fi
|
|
done
|
|
if [ $FAIL -eq 1 ]; then
|
|
echo ""
|
|
echo "═══════════════════════════════════════════════════"
|
|
echo " BLOCKED: No JS file may exceed 777 lines."
|
|
echo " Extract into modules. app.js is a THIN WRAPPER."
|
|
echo "═══════════════════════════════════════════════════"
|
|
fi
|
|
exit $FAIL
|
|
|
|
- name: Check file size budget (bytes)
|
|
run: |
|
|
FAIL=0
|
|
for f in $(find . -name '*.js' -not -path './node_modules/*'); do
|
|
SIZE=$(wc -c < "$f")
|
|
if [ "$SIZE" -gt 512000 ]; then
|
|
echo "FAIL: $f is ${SIZE} bytes (budget: 512000)"
|
|
FAIL=1
|
|
else
|
|
echo "OK: $f (${SIZE} bytes)"
|
|
fi
|
|
done
|
|
exit $FAIL
|