feat(ci): add smoke tests workflow + Lighthouse audit script

- .forgejo/workflows/smoke-tests.yml: checks all Go services + web apps
  every 6h, fails if any health check fails
- scripts/lighthouse-audit.sh: runs Lighthouse on all 14 web apps

Initial Lighthouse results:
  mana.how:      Perf:80  A11y:96  BP:100 SEO:92
  todo.mana.how: Perf:69  A11y:96  BP:100 SEO:100
  chat.mana.how: Perf:83  A11y:100 BP:96  SEO:92

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-28 18:09:37 +01:00
parent 79a53cf70a
commit 456f99b89e
2 changed files with 151 additions and 0 deletions

View file

@ -0,0 +1,91 @@
# Smoke Tests: Verify all production services are healthy
# Runs on schedule (every 6h) and manual trigger
name: Smoke Tests
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
jobs:
go-services:
runs-on: ubuntu-latest
steps:
- name: Check Go services
run: |
FAILED=0
for svc in \
"mana-search:3012" \
"mana-notify:3013" \
"mana-crawler:3014" \
"mana-api-gateway:3016" \
"mana-sync:3051" \
"mana-matrix-bot:4000" \
"forgejo:3041"
do
NAME=$(echo $svc | cut -d: -f1)
PORT=$(echo $svc | cut -d: -f2)
if [ "$NAME" = "forgejo" ]; then
URL="http://mana-core-forgejo:$PORT/api/v1/version"
elif [ "$NAME" = "mana-matrix-bot" ]; then
URL="http://mana-matrix-bot:$PORT/health"
else
URL="http://$(echo $NAME | sed 's/mana-/mana-core-/;s/core-api/api/;s/core-crawler/crawler/;s/core-matrix/matrix/'):$PORT/health"
fi
echo -n "$NAME... "
STATUS=$(wget -qO- --timeout=5 "$URL" 2>/dev/null | grep -o '"status":"[a-z]*"' | head -1 || echo "UNREACHABLE")
if echo "$STATUS" | grep -qE 'ok|healthy'; then
echo "OK"
else
echo "FAILED ($STATUS)"
FAILED=$((FAILED + 1))
fi
done
if [ $FAILED -gt 0 ]; then
echo "$FAILED service(s) failed health check"
exit 1
fi
echo "All services healthy"
web-apps:
runs-on: ubuntu-latest
steps:
- name: Check web app health endpoints
run: |
FAILED=0
for app in \
"mana.how:5000" \
"chat:5010" \
"todo:5011" \
"calendar:5012" \
"clock:5013" \
"contacts:5014" \
"storage:5015" \
"presi:5016" \
"nutriphi:5017" \
"zitare:5018" \
"photos:5019" \
"skilltree:5020" \
"picture:5021" \
"citycorners:5022" \
"mukke:5180"
do
NAME=$(echo $app | cut -d: -f1)
PORT=$(echo $app | cut -d: -f2)
CONTAINER="mana-app-$(echo $NAME | sed 's/\.mana\.how//')-web"
[ "$NAME" = "mana.how" ] && CONTAINER="mana-app-web"
echo -n "$NAME... "
CODE=$(wget -qO /dev/null --timeout=5 -S "http://$CONTAINER:$PORT/" 2>&1 | grep "HTTP/" | tail -1 | awk '{print $2}' || echo "000")
if [ "$CODE" = "200" ] || [ "$CODE" = "302" ]; then
echo "OK ($CODE)"
else
echo "FAILED ($CODE)"
FAILED=$((FAILED + 1))
fi
done
if [ $FAILED -gt 0 ]; then
echo "$FAILED app(s) failed"
exit 1
fi
echo "All web apps responding"

60
scripts/lighthouse-audit.sh Executable file
View file

@ -0,0 +1,60 @@
#!/bin/bash
# Lighthouse Performance Audit for all ManaCore web apps
# Requires: npx (for lighthouse CLI)
# Usage: ./scripts/lighthouse-audit.sh [--json]
set -e
JSON_MODE=false
[ "$1" = "--json" ] && JSON_MODE=true
APPS=(
"mana.how"
"chat.mana.how"
"todo.mana.how"
"calendar.mana.how"
"clock.mana.how"
"contacts.mana.how"
"storage.mana.how"
"presi.mana.how"
"nutriphi.mana.how"
"zitare.mana.how"
"photos.mana.how"
"skilltree.mana.how"
"picture.mana.how"
"mukke.mana.how"
)
RESULTS_DIR="lighthouse-results"
mkdir -p "$RESULTS_DIR"
echo "=== ManaCore Lighthouse Audit ==="
echo "Date: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo ""
for app in "${APPS[@]}"; do
echo -n "$app... "
URL="https://$app"
OUTPUT="$RESULTS_DIR/$(echo $app | tr '.' '-').json"
npx lighthouse "$URL" \
--output=json \
--output-path="$OUTPUT" \
--chrome-flags="--headless --no-sandbox" \
--only-categories=performance,accessibility,best-practices,seo \
--quiet 2>/dev/null
if [ -f "$OUTPUT" ]; then
PERF=$(cat "$OUTPUT" | python3 -c "import sys,json; print(int(json.load(sys.stdin)['categories']['performance']['score']*100))" 2>/dev/null || echo "?")
A11Y=$(cat "$OUTPUT" | python3 -c "import sys,json; print(int(json.load(sys.stdin)['categories']['accessibility']['score']*100))" 2>/dev/null || echo "?")
BP=$(cat "$OUTPUT" | python3 -c "import sys,json; print(int(json.load(sys.stdin)['categories']['best-practices']['score']*100))" 2>/dev/null || echo "?")
SEO=$(cat "$OUTPUT" | python3 -c "import sys,json; print(int(json.load(sys.stdin)['categories']['seo']['score']*100))" 2>/dev/null || echo "?")
echo "Perf:$PERF A11y:$A11Y BP:$BP SEO:$SEO"
else
echo "FAILED"
fi
done
echo ""
echo "Results saved to $RESULTS_DIR/"