LifeMate — Personal, Family & Learning Companion

fix/backend-request-safety
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 118 lines 5.39 KB
Raw
1 name: LifeMate CI
2
3 on:
4 push:
5 branches: [main]
6 pull_request:
7
8 permissions:
9 contents: read
10
11 jobs:
12 security:
13 runs-on: ubuntu-latest
14 steps:
15 - uses: actions/checkout@v4
16 - name: Reject committed environment files
17 run: |
18 bad_files=$(find . -type f \( -name '.env' -o -name '.env.*' \) ! -name '.env.example' ! -path './.git/*')
19 if [ -n "$bad_files" ]; then echo "Committed environment files detected:"; echo "$bad_files"; exit 1; fi
20 - name: Scan high-confidence secret patterns
21 run: |
22 if git grep -I -n -E '(-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----|AKIA[0-9A-Z]{16}|gh[pousr]_[A-Za-z0-9_]{30,}|sk_live_[A-Za-z0-9]{20,})' -- .; then echo "Potential committed secret detected."; exit 1; fi
23
24 flutter:
25 runs-on: ubuntu-latest
26 defaults:
27 run:
28 working-directory: apps/lifemate
29 steps:
30 - uses: actions/checkout@v4
31 - uses: subosito/flutter-action@v2
32 with:
33 channel: stable
34 cache: true
35 - run: flutter pub get
36 - run: dart format lib test
37 - run: flutter analyze
38 - run: flutter test
39 - name: Verify PWA release metadata
40 run: |
41 grep -q 'manifest.json' web/index.html
42 grep -q 'theme-color' web/index.html
43 grep -q 'apple-touch-icon' web/index.html
44 grep -q 'dir="rtl"' web/index.html
45 test -f web/manifest.json
46 - run: >
47 flutter build web --release
48 --dart-define=LIFEMATE_API_URL=https://lifemate-api-fn-staging.up.railway.app
49 - run: >
50 flutter build apk --release
51 --dart-define=LIFEMATE_API_URL=https://lifemate-api-fn-staging.up.railway.app
52 - name: Upload Web release
53 uses: actions/upload-artifact@v4
54 with:
55 name: lifemate-web-release
56 path: apps/lifemate/build/web
57 if-no-files-found: error
58 - name: Upload Android APK
59 uses: actions/upload-artifact@v4
60 with:
61 name: lifemate-android-apk
62 path: apps/lifemate/build/app/outputs/flutter-apk/app-release.apk
63 if-no-files-found: error
64
65 backend:
66 runs-on: ubuntu-latest
67 services:
68 postgres:
69 image: postgres:16
70 env:
71 POSTGRES_PASSWORD: lifemate_ci
72 POSTGRES_DB: lifemate_ci
73 ports: ['5432:5432']
74 options: >-
75 --health-cmd "pg_isready -U postgres -d lifemate_ci"
76 --health-interval 5s --health-timeout 5s --health-retries 10
77 env:
78 PGPASSWORD: lifemate_ci
79 DATABASE_URL: postgresql://postgres:lifemate_ci@localhost:5432/lifemate_ci
80 JWT_SECRET: ci-only-secret-ci-only-secret-ci-only-secret
81 NODE_ENV: test
82 steps:
83 - uses: actions/checkout@v4
84 - uses: actions/setup-node@v4
85 with:
86 node-version: 22
87 - name: Apply migrations
88 run: |
89 for migration in backend/migrations/*.sql; do echo "Applying $migration"; psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f "$migration"; done
90 - name: Database authorization tests
91 run: |
92 psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/tests/schema_test.sql
93 psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/tests/phase3_schema_test.sql
94 if [ -f backend/tests/phase4_schema_test.sql ]; then psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/tests/phase4_schema_test.sql; fi
95 if [ -f backend/tests/phase6_schema_test.sql ]; then psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/tests/phase6_schema_test.sql; fi
96 - name: Install backend
97 working-directory: backend
98 run: npm install
99 - name: Backend dependency audit
100 working-directory: backend
101 run: npm audit --audit-level=high
102 - name: Backend tests
103 working-directory: backend
104 run: npm test
105 - name: Backend syntax checks
106 working-directory: backend
107 run: npm run check
108 - name: Verify schema objects
109 run: |
110 test "$(psql -h localhost -U postgres -d lifemate_ci -Atc "select count(*) from information_schema.tables where table_schema='public' and table_name in ('app_user','profile','family_workspace','family_membership','guardian_relationship','family_invitation','access_audit','auth_credential','auth_token','auth_session','life_context','academic_year','academic_term','subject','class_session','plan_item','sharing_grant','reminder','notification_preference','notification_outbox','sync_mutation','learning_goal','learning_checkin','wellbeing_checkin','ai_guide_session','ai_guide_message','ai_plan_proposal','wellbeing_safety_event','education_profile','curriculum_subject','textbook_catalog','iran_calendar_event','menstrual_cycle_entry');")" = "33"
111 - name: Backup and restore drill
112 run: |
113 psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/scripts/restore-smoke.sql
114 chmod +x backend/scripts/backup.sh backend/scripts/restore.sh
115 backend/scripts/backup.sh /tmp/lifemate-ci.dump
116 createdb -h localhost -U postgres lifemate_restore
117 DATABASE_URL=postgresql://postgres:lifemate_ci@localhost:5432/lifemate_restore backend/scripts/restore.sh /tmp/lifemate-ci.dump
118 test "$(psql -h localhost -U postgres -d lifemate_restore -Atc "select count(*) from profile where display_name='Restore Smoke';")" = "1"