LifeMate — Personal, Family & Learning Companion

fix/lifeguide-bootstrap-naming-ci
chore/phase1-repository-cleanup deploy/stable-web-apk deployment-static design/mobile-accessibility-v2 design/mobile-navigation-review docs/child-education-access-decision docs/offline-data-rescue-options docs/owner-guide-and-delivery-plan docs/phase1-policy-options docs/public-review-live-2026-10-15 feat/aparat-learning-library feat/child-device-safety feat/child-identity-schema feat/flutter-mobile-navigation feat/learning-content-operations feat/local-signing-preflight feat/online-family-stage0 feat/personal-encrypted-recovery feat/private-planner-series-api feat/public-review-page feat/standalone-weekly-planner feat/weekly-planner-android final-feature-1/iran-family-school fix/auth-abuse-expiry-safety fix/auth-expiry-after-lock fix/backend-request-safety fix/lifeguide-bootstrap-naming-ci fix/lifeguide-pages-qa-base-preflight fix/lifeguide-qa-pages-env-deployment fix/local-task-persistence fix/managed-child-session-boundary fix/personal-jalali-dates fix/personal-notification-controls fix/personal-upgrade-delivery-guard fix/sms-approval-gates fix/study-duration-display infra/cloudflare-neon-migration infra/lifeguide-cloudflare-qa infra/lifeguide-github-pages-qa infra/lifeguide-supabase-qa main phase-1/foundation-completion phase-2/product-foundation-identity phase-3/planner-school-family-core phase-4/ai-learning-wellbeing phase-5/hardening-observability-release test/android-reminder-acceptance test/personal-notification-settings test/personal-recovery-acceptance test/role-entry-apk
yml 141 lines 7.44 KB
Raw
1 name: LifeGuide CI
2 on:
3 push:
4 branches: [main]
5 pull_request:
6 workflow_dispatch:
7 permissions:
8 contents: read
9 concurrency:
10 group: lifeguide-ci-${{ github.ref }}
11 cancel-in-progress: true
12 jobs:
13 security:
14 runs-on: ubuntu-latest
15 steps:
16 - uses: actions/checkout@v4
17 - name: Reject tracked credentials and private artifacts
18 run: |
19 python3 scripts/check-tracked-secrets.py
20 - name: Audit product naming
21 run: python3 scripts/audit-naming.py --check
22 backend:
23 runs-on: ubuntu-latest
24 services:
25 postgres:
26 image: postgres:16
27 env:
28 POSTGRES_PASSWORD: synthetic_ci_only
29 POSTGRES_DB: lifemate_ci
30 ports: ['5432:5432']
31 options: >-
32 --health-cmd "pg_isready -U postgres -d lifemate_ci"
33 --health-interval 5s --health-timeout 5s --health-retries 10
34 env:
35 PGPASSWORD: synthetic_ci_only
36 DATABASE_URL: postgresql://postgres:synthetic_ci_only@localhost:5432/lifemate_ci
37 JWT_SECRET: synthetic-ci-only-not-a-live-secret-2026
38 NODE_ENV: test
39 steps:
40 - uses: actions/checkout@v4
41 - uses: actions/setup-node@v4
42 with: {node-version: 22, cache: npm, cache-dependency-path: backend/package-lock.json}
43 - name: Verify reachability smoke rejects untrusted TLS
44 run: node --test scripts/test-reachability-smoke.mjs
45 - run: npm ci
46 working-directory: backend
47 - name: Apply migrations and verify repeat run
48 working-directory: backend
49 run: npm run migrate && npm run migrate
50 - name: Import checked educational metadata and verify repeat run
51 working-directory: backend
52 run: node scripts/import-learning-catalog.js && node scripts/import-learning-catalog.js
53 - name: SQL authorization matrix
54 run: |
55 for test in backend/tests/*schema_test.sql; do psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f "$test"; done
56 - run: npm test && npm run check && npm audit --audit-level=high
57 working-directory: backend
58 - name: Verify isolated database roles and runtime family scenario
59 working-directory: backend
60 env:
61 PG_CONTAINER: ${{ job.services.postgres.id }}
62 PGHOST: 127.0.0.1
63 PGPORT: 5432
64 PGUSER: postgres
65 PGDATABASE: lifemate_ci
66 run: |
67 export API_DB_PASSWORD=$(node -p "require('crypto').randomBytes(32).toString('hex')")
68 export MIGRATOR_DB_PASSWORD=$(node -p "require('crypto').randomBytes(32).toString('hex')")
69 export BACKUP_DB_PASSWORD=$(node -p "require('crypto').randomBytes(32).toString('hex')")
70 export ROLE_TEST_STATE_FILE="$RUNNER_TEMP/lifeguide-role-state.json"
71 trap 'if [ -f "$ROLE_TEST_STATE_FILE" ]; then node scripts/test-db-roles.js --cleanup; fi' EXIT
72 node scripts/test-db-roles.js --synthetic-only
73 source_db=$(node -p "JSON.parse(require('fs').readFileSync(process.env.ROLE_TEST_STATE_FILE)).source_db")
74 target_db=$(node -p "JSON.parse(require('fs').readFileSync(process.env.ROLE_TEST_STATE_FILE)).target_db")
75 PGPASSWORD="$BACKUP_DB_PASSWORD" docker exec -e PGPASSWORD "$PG_CONTAINER" pg_dump -h 127.0.0.1 -U lifeguide_backup -d "$source_db" --format=custom --no-owner --no-privileges --file=/tmp/lifeguide-roles.dump
76 docker exec "$PG_CONTAINER" pg_restore --list /tmp/lifeguide-roles.dump >/dev/null
77 PGPASSWORD="$MIGRATOR_DB_PASSWORD" docker exec -e PGPASSWORD "$PG_CONTAINER" pg_restore -h 127.0.0.1 -U lifeguide_migrator -d "$target_db" --clean --if-exists --no-owner --no-privileges --exit-on-error /tmp/lifeguide-roles.dump
78 node scripts/test-db-roles.js --verify-restored
79 - name: Backup and restore synthetic database
80 env:
81 PG_CONTAINER: ${{ job.services.postgres.id }}
82 run: |
83 docker exec "$PG_CONTAINER" pg_dump --version
84 docker exec -i -e DATABASE_URL=postgresql://postgres:synthetic_ci_only@127.0.0.1:5432/lifemate_ci "$PG_CONTAINER" bash -s -- /tmp/lifeguide-ci.dump < backend/scripts/backup.sh
85 docker exec "$PG_CONTAINER" createdb -U postgres lifeguide_restore
86 docker exec -i -e DATABASE_URL=postgresql://postgres:synthetic_ci_only@127.0.0.1:5432/lifeguide_restore "$PG_CONTAINER" bash -s -- /tmp/lifeguide-ci.dump < backend/scripts/restore.sh
87 test "$(docker exec "$PG_CONTAINER" psql -U postgres -d lifeguide_restore -Atc 'select count(*) from schema_migration')" = "$(docker exec "$PG_CONTAINER" psql -U postgres -d lifemate_ci -Atc 'select count(*) from schema_migration')"
88 flutter:
89 runs-on: ubuntu-latest
90 defaults:
91 run: {working-directory: apps/lifemate}
92 steps:
93 - uses: actions/checkout@v4
94 - uses: actions/setup-node@v4
95 with: {node-version: 22}
96 - uses: subosito/flutter-action@v2
97 with: {flutter-version: '3.47.6', channel: stable, cache: true}
98 - run: flutter pub get
99 - run: flutter --version --machine
100 - run: dart format --output=none --set-exit-if-changed lib test
101 - run: flutter analyze
102 - run: flutter test
103 - run: node tool/test_web_bootstrap.mjs
104 - run: node --test tool/test_offline_worker.mjs
105 - run: flutter build web --release --no-web-resources-cdn --pwa-strategy=none
106 - run: node tool/test_web_bootstrap.mjs
107 - name: Bundle local resources and reject external runtime services
108 run: node tool/self_host_web.mjs build/web
109 - name: Check compiled browser requests for local fonts and CanvasKit
110 run: |
111 npm install --no-save --no-package-lock playwright@1.62.1
112 npx playwright install --with-deps chromium
113 node tool/test_web_runtime.cjs build/web
114 - name: Check exclusive web instance before session and cache access
115 run: |
116 node tool/test_web_instance.cjs
117 CHROME_EXECUTABLE="$(node -p 'require("playwright").chromium.executablePath()')" flutter test --platform chrome test/web/instance_guard_browser.dart --reporter expanded
118 node tool/test_web_instance.cjs --compiled build/web
119 - name: Preserve unsent changes across forced session expiry
120 run: node tool/test_web_session_expiry.cjs --artifact=build/web
121 - name: Record checked prebuilt web provenance
122 run: node ../../scripts/prebuilt-web-check.mjs . --stamp-after-build
123 - name: Verify Windows checkout preserves the checked web artifact
124 run: node ../../scripts/test-prebuilt-checkout.mjs
125 - uses: actions/upload-artifact@v4
126 with: {name: LifeGuide-web, path: apps/lifemate/build/web, if-no-files-found: error}
127 - name: Build test APK (debug certificate; not a release)
128 run: |
129 flutter build apk --debug
130 cp build/app/outputs/flutter-apk/app-debug.apk build/LifeGuide-debug.apk
131 - name: Inspect the actual APK manifest and debug signature
132 run: |
133 python3 tool/check_apk_manifest.py build/LifeGuide-debug.apk --mode debug
134 sdk_root="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}"
135 test -n "$sdk_root"
136 signer=$(find "$sdk_root/build-tools" -mindepth 2 -maxdepth 2 -type f -name apksigner | sort -V | tail -n 1)
137 test -n "$signer"
138 "$signer" verify --verbose --print-certs build/LifeGuide-debug.apk | tee build/debug-signature-check.txt
139 grep -F 'CN=Android Debug' build/debug-signature-check.txt
140 - uses: actions/upload-artifact@v4
141 with: {name: LifeGuide-debug-apk, path: apps/lifemate/build/LifeGuide-debug.apk, if-no-files-found: error}