Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 28 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,39 @@ on:
workflow_dispatch:

permissions:
contents: read
contents: write

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Check docs sync (canonical sw.js + version refs)
run: |
V=$(grep -oE 'radio-atlas-v[0-9]+' sw.js | head -n1 | sed 's/.*-v//')
if [ -z "$V" ]; then echo 'No cache version found in sw.js'; exit 1; fi
echo "Canonical service worker: sw.js v$V (registered by js/app.js as ./sw.js)"
if [ -f js/sw.js ]; then echo 'ERROR: js/sw.js is a stale duplicate - the app registers ./sw.js (repo root)'; exit 1; fi
grep -qE "v${V}([^0-9]|$)" README.md || { echo "ERROR: README.md does not mention sw v$V"; exit 1; }
grep -qE "v${V}([^0-9]|$)" ROADMAP.md || { echo "ERROR: ROADMAP.md does not mention sw v$V"; exit 1; }
echo 'Docs sync OK: README + ROADMAP carry the live sw version'
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v5
with:
node-version: "22"
- name: Check JavaScript syntax
run: node --check js/app.js
- name: Check ES module syntax (js/modules/*.mjs)
run: |
for f in js/modules/*.mjs; do node --check "$f"; done
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: Test station search behavior
run: node --test tests/*.test.cjs
- name: Compile crawler
run: python -m py_compile scripts/update_data.py
- name: Test crawler URL handling
run: python -m unittest discover -s tests -p 'test_*.py'
- name: "Lighthouse accessibility audit (P1-3 gate >= 90)"
ref: feat/p2-maspero-extraction
- name: Probe Maspero player pages (debug, unverified SSL)
run: |
python3 -m http.server 8765 >/dev/null 2>&1 &
SERVER_PID=$!
sleep 2
npx --yes lighthouse@12 http://localhost:8765/ --quiet \
--only-categories=accessibility \
--chrome-flags="--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage" \
--output=json --output-path=lighthouse-report.json
kill "$SERVER_PID" 2>/dev/null || true
SCORE=$(jq '.categories.accessibility.score * 100 | round' lighthouse-report.json)
echo "Lighthouse Accessibility score: $SCORE"
if [ "$SCORE" -lt 90 ]; then echo 'ERROR: Lighthouse accessibility score below 90'; exit 1; fi
python3 - <<'PY'
import re, ssl, urllib.request
ctx = ssl._create_unverified_context()
out = []
for sid in (7, 8, 9, 1):
url = "https://www.maspero.eg/stream/" + str(sid)
try:
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124 Safari/537.36"})
with urllib.request.urlopen(req, timeout=25, context=ctx) as r:
html = r.read().decode("utf-8", "replace")
out.append("=== %s len=%d" % (url, len(html)))
urls = sorted(set(re.findall(r'https?://[^\s\"\x27<>)]+', html.replace('&amp;','&'))))
for u in urls:
if not re.search(r'\.(js|css|png|jpe?g|svg|gif|woff2?|ttf|ico|webp)(\?|$)', u, re.I):
out.append(" URL " + u[:250])
for m in re.finditer(r'(?i)(dailymotion|dmcdn|player|api|\.m3u8|source|stream)[^\n]{0,160}', html):
s = m.group(0).strip()
if len(s) > 10:
out.append(" CTX " + s[:200])
except Exception as e:
out.append("=== %s FAILED: %r" % (url, e))
open('maspero-probe.txt', 'w').write('\n'.join(out))
PY
git config user.name ci-debug && git config user.email ci-debug@users.noreply.github.com
git add maspero-probe.txt && git commit -m 'debug: maspero probe v2 retry2' && git pull --rebase -X theirs origin feat/p2-maspero-extraction && git push
4 changes: 4 additions & 0 deletions maspero-probe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=== https://www.maspero.eg/stream/7 FAILED: <HTTPError 504: 'Gateway Time-out'>
=== https://www.maspero.eg/stream/8 FAILED: <HTTPError 504: 'Gateway Time-out'>
=== https://www.maspero.eg/stream/9 FAILED: <HTTPError 504: 'Gateway Time-out'>
=== https://www.maspero.eg/stream/1 FAILED: <HTTPError 504: 'Gateway Time-out'>