Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/actions/start-emulator/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright 2024 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 run ci-all

- name: Build project and local deps
shell: bash
run: npm run build-all --config=local

- name: Start Firebase emulator with Android test data
shell: bash
run: npm run start:android
1 change: 1 addition & 0 deletions data/test-android/auth_export/accounts.json
Original file line number Diff line number Diff line change
@@ -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}]}
1 change: 1 addition & 0 deletions data/test-android/auth_export/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"signIn":{"allowDuplicateEmails":false},"emailPrivacyConfig":{"enableImprovedEmailPrivacy":false}}
12 changes: 12 additions & 0 deletions data/test-android/firebase-export-metadata.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build-all-and-start-local": "npm run build-all --config=local --project=local && npm run start:local",
"watch:local": "npm run watch --workspace functions > functions.log 2>&1 & npm run watch --config=local --project=local --workspace web > web.log 2>&1",
"start:local": "firebase emulators:exec 'npm run watch:local' --project local --ui --config firebase.local.json --import data/local",
"start:test-android": "firebase emulators:start --project local --config firebase.local.json --import data/test-android",
"export:local": "firebase emulators:export data/local --project local --only firestore",
"start-and-export:test": "firebase emulators:exec 'npm run watch:local' --project local --ui --config firebase.local.json --import data/test --export-on-exit data/test",
"test:e2e:create": "WAIT_ON_INTERVAL=30000 start-server-and-test start-and-export:test '5000|http://localhost:4000/firestore' 'npm run test:create --prefix=e2e-tests'",
Expand Down Expand Up @@ -47,4 +48,4 @@
"optionalDependencies": {
"@nx/nx-linux-x64-gnu": "^19.3.2"
}
}
}