LifeMate — Personal, Family & Learning Companion

deploy/stable-web-apk
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 114 lines 5.19 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: flutter build web --release
47 - run: flutter build apk --release
48 - name: Upload Web release
49 uses: actions/upload-artifact@v4
50 with:
51 name: lifemate-web-release
52 path: apps/lifemate/build/web
53 if-no-files-found: error
54 - name: Upload Android APK
55 uses: actions/upload-artifact@v4
56 with:
57 name: lifemate-android-apk
58 path: apps/lifemate/build/app/outputs/flutter-apk/app-release.apk
59 if-no-files-found: error
60
61 backend:
62 runs-on: ubuntu-latest
63 services:
64 postgres:
65 image: postgres:16
66 env:
67 POSTGRES_PASSWORD: lifemate_ci
68 POSTGRES_DB: lifemate_ci
69 ports: ['5432:5432']
70 options: >-
71 --health-cmd "pg_isready -U postgres -d lifemate_ci"
72 --health-interval 5s --health-timeout 5s --health-retries 10
73 env:
74 PGPASSWORD: lifemate_ci
75 DATABASE_URL: postgresql://postgres:lifemate_ci@localhost:5432/lifemate_ci
76 JWT_SECRET: ci-only-secret-ci-only-secret-ci-only-secret
77 NODE_ENV: test
78 steps:
79 - uses: actions/checkout@v4
80 - uses: actions/setup-node@v4
81 with:
82 node-version: 22
83 - name: Apply migrations
84 run: |
85 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
86 - name: Database authorization tests
87 run: |
88 psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/tests/schema_test.sql
89 psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/tests/phase3_schema_test.sql
90 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
91 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
92 - name: Install backend
93 working-directory: backend
94 run: npm install
95 - name: Backend dependency audit
96 working-directory: backend
97 run: npm audit --audit-level=high
98 - name: Backend tests
99 working-directory: backend
100 run: npm test
101 - name: Backend syntax checks
102 working-directory: backend
103 run: npm run check
104 - name: Verify schema objects
105 run: |
106 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"
107 - name: Backup and restore drill
108 run: |
109 psql -h localhost -U postgres -d lifemate_ci -v ON_ERROR_STOP=1 -f backend/scripts/restore-smoke.sql
110 chmod +x backend/scripts/backup.sh backend/scripts/restore.sh
111 backend/scripts/backup.sh /tmp/lifemate-ci.dump
112 createdb -h localhost -U postgres lifemate_restore
113 DATABASE_URL=postgresql://postgres:lifemate_ci@localhost:5432/lifemate_restore backend/scripts/restore.sh /tmp/lifemate-ci.dump
114 test "$(psql -h localhost -U postgres -d lifemate_restore -Atc "select count(*) from profile where display_name='Restore Smoke';")" = "1"