diff --git a/.github/actions/start-emulator/action.yml b/.github/actions/start-emulator/action.yml new file mode 100644 index 000000000..ea4ff3975 --- /dev/null +++ b/.github/actions/start-emulator/action.yml @@ -0,0 +1,76 @@ +# Copyright 2026 The Ground Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: Start Firebase emulator for Android tests + +inputs: + platform-repository: + description: "ground-platform repository under test" + default: google/ground-platform + +runs: + using: "composite" + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + repository: ${{ inputs.platform-repository }} + + - name: Load cached Firebase emulator + uses: actions/cache@v4 + with: + path: ~/.cache/firebase/emulators + key: ${{ runner.os }}-firebase-emulators-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-firebase-emulators- + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: "20" + + - name: Load cached Node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of Node modules + continue-on-error: true + shell: bash + run: npm list + + - name: Install nx-linux-x64-gnu + shell: bash + run: npm install @nx/nx-linux-x64-gnu + + - name: Install dependencies + shell: bash + run: npm install + + - name: Build project and local deps + shell: bash + run: npx nx build + + - name: Start Firebase emulator with Android test data + shell: bash + run: npx nx start-android-test-data diff --git a/data/local/auth_export/accounts.json b/data/local/auth_export/accounts.json index 17799bf53..b1b67dba7 100644 --- a/data/local/auth_export/accounts.json +++ b/data/local/auth_export/accounts.json @@ -1 +1 @@ -{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"OSpCUZYAGPvDJn8n7rgYz9YfIrD9","createdAt":"1719838206834","lastLoginAt":"1719838206834","validSince":"1724424200","emailVerified":false,"disabled":false},{"localId":"dZWReItHKWIaMi4GJPxszWb0VCnN","createdAt":"1719841155698","lastLoginAt":"1719841155698","validSince":"1724424200","emailVerified":false,"disabled":false},{"localId":"xyNMqyb9LPp0xXtdEa6DQk3ymHLa","createdAt":"1719841321507","lastLoginAt":"1719841321507","validSince":"1724424200","emailVerified":false,"disabled":false}]} \ No newline at end of file +{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"OSpCUZYAGPvDJn8n7rgYz9YfIrD9","createdAt":"1719838206834","lastLoginAt":"1719838206834","validSince":"1767633238","emailVerified":false,"disabled":false},{"localId":"dZWReItHKWIaMi4GJPxszWb0VCnN","createdAt":"1719841155698","lastLoginAt":"1719841155698","validSince":"1767633238","emailVerified":false,"disabled":false},{"localId":"xyNMqyb9LPp0xXtdEa6DQk3ymHLa","createdAt":"1719841321507","lastLoginAt":"1719841321507","validSince":"1767633238","emailVerified":false,"disabled":false}]} \ No newline at end of file diff --git a/data/local/firebase-export-metadata.json b/data/local/firebase-export-metadata.json index 19e394355..947edb716 100644 --- a/data/local/firebase-export-metadata.json +++ b/data/local/firebase-export-metadata.json @@ -1,12 +1,12 @@ { - "version": "13.6.0", + "version": "14.27.0", "firestore": { - "version": "1.19.4", + "version": "1.19.8", "path": "firestore_export", "metadata_file": "firestore_export/firestore_export.overall_export_metadata" }, "auth": { - "version": "13.6.0", + "version": "14.27.0", "path": "auth_export" } } \ No newline at end of file diff --git a/data/local/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata b/data/local/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata index 072525205..9b213a60b 100644 Binary files a/data/local/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata and b/data/local/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata differ diff --git a/data/local/firestore_export/all_namespaces/all_kinds/output-0 b/data/local/firestore_export/all_namespaces/all_kinds/output-0 index 6619a99a0..799052f4a 100644 Binary files a/data/local/firestore_export/all_namespaces/all_kinds/output-0 and b/data/local/firestore_export/all_namespaces/all_kinds/output-0 differ diff --git a/data/local/firestore_export/firestore_export.overall_export_metadata b/data/local/firestore_export/firestore_export.overall_export_metadata index 0f517135c..958d2b23e 100644 Binary files a/data/local/firestore_export/firestore_export.overall_export_metadata and b/data/local/firestore_export/firestore_export.overall_export_metadata differ diff --git a/data/test-android/auth_export/accounts.json b/data/test-android/auth_export/accounts.json new file mode 100644 index 000000000..17799bf53 --- /dev/null +++ b/data/test-android/auth_export/accounts.json @@ -0,0 +1 @@ +{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"OSpCUZYAGPvDJn8n7rgYz9YfIrD9","createdAt":"1719838206834","lastLoginAt":"1719838206834","validSince":"1724424200","emailVerified":false,"disabled":false},{"localId":"dZWReItHKWIaMi4GJPxszWb0VCnN","createdAt":"1719841155698","lastLoginAt":"1719841155698","validSince":"1724424200","emailVerified":false,"disabled":false},{"localId":"xyNMqyb9LPp0xXtdEa6DQk3ymHLa","createdAt":"1719841321507","lastLoginAt":"1719841321507","validSince":"1724424200","emailVerified":false,"disabled":false}]} \ No newline at end of file diff --git a/data/test-android/auth_export/config.json b/data/test-android/auth_export/config.json new file mode 100644 index 000000000..6f240f7e9 --- /dev/null +++ b/data/test-android/auth_export/config.json @@ -0,0 +1 @@ +{"signIn":{"allowDuplicateEmails":false},"emailPrivacyConfig":{"enableImprovedEmailPrivacy":false}} \ No newline at end of file diff --git a/data/test-android/firebase-export-metadata.json b/data/test-android/firebase-export-metadata.json new file mode 100644 index 000000000..6cdb22966 --- /dev/null +++ b/data/test-android/firebase-export-metadata.json @@ -0,0 +1,12 @@ +{ + "version": "13.35.1", + "firestore": { + "version": "1.19.8", + "path": "firestore_export", + "metadata_file": "firestore_export/firestore_export.overall_export_metadata" + }, + "auth": { + "version": "13.35.1", + "path": "auth_export" + } +} \ No newline at end of file diff --git a/data/test-android/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata b/data/test-android/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata new file mode 100644 index 000000000..75380cd9d Binary files /dev/null and b/data/test-android/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata differ diff --git a/data/test-android/firestore_export/all_namespaces/all_kinds/output-0 b/data/test-android/firestore_export/all_namespaces/all_kinds/output-0 new file mode 100644 index 000000000..201574d18 Binary files /dev/null and b/data/test-android/firestore_export/all_namespaces/all_kinds/output-0 differ diff --git a/data/test-android/firestore_export/firestore_export.overall_export_metadata b/data/test-android/firestore_export/firestore_export.overall_export_metadata new file mode 100644 index 000000000..e00457c3c Binary files /dev/null and b/data/test-android/firestore_export/firestore_export.overall_export_metadata differ diff --git a/firebase.local.json b/firebase.local.json index ad6da9a8f..d210970a4 100644 --- a/firebase.local.json +++ b/firebase.local.json @@ -13,6 +13,9 @@ ] }, "emulators": { + "auth": { + "port": 9099 + }, "functions": { "port": 5001 }, diff --git a/package.json b/package.json index 5a2e35064..c5436ae26 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,18 @@ "build" ] }, + "start-android-test-data": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "firebase experiments:enable webframeworks", + "firebase emulators:start --project demo-local --config firebase.local.json --import data/test-android" + ] + }, + "dependsOn": [ + "build" + ] + }, "deploy": { "executor": "nx:run-commands", "configurations": { @@ -120,4 +132,4 @@ "overrides": { "eslint-plugin-n": "^17.0.0" } -} +} \ No newline at end of file