Skip to content

Commit

Permalink
Fix emu project name (#2535)
Browse files Browse the repository at this point in the history
* Fix accidental log message

* Fix local emu project ID
  • Loading branch information
gino-m authored Jul 1, 2024
1 parent a410aff commit 20d8db8
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 161 deletions.
314 changes: 157 additions & 157 deletions .github/actions/submit-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,166 +14,166 @@
name: Submit to survey

inputs:
android-repository:
description: 'ground-android repository under test'
default: google/ground-android
android-repository:
description: 'ground-android repository under test'
default: google/ground-android

platform-repository:
description: 'ground-platform repository under test (if applicable)'
default: google/ground-platform
platform-repository:
description: 'ground-platform repository under test (if applicable)'
default: google/ground-platform

use-repo-data:
description: 'Whether to use the local repository emulator data or not'
default: 'true'
use-repo-data:
description: 'Whether to use the local repository emulator data or not'
default: 'true'

upload-artifacts:
description: 'Whether to upload the final emulator data artifacts'
default: 'false'
upload-artifacts:
description: 'Whether to upload the final emulator data artifacts'
default: 'false'

google-maps-key:
description: 'A Google Maps API key'
google-maps-key:
description: 'A Google Maps API key'

runs:
using: composite
steps:
- name: Enable KVM group perms
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls /dev/kvm
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-24

- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ inputs.android-repository }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18

- name: Checkout ground-platform
uses: actions/checkout@v4
with:
repository: ${{ inputs.platform-repository }}
path: ground-platform

- name: Cache 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 }}-
- name: Build ground functions
shell: bash
run: |
cd ground-platform
npm run build:local
cd ../
- name: Install firebase-tools
shell: bash
run: |
npm install -g firebase-tools
- name: Cache 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: Copy Firebase emulator data
uses: actions/download-artifact@v4
if: inputs.use-repo-data != 'true'
with:
name: data-create
path: data/

- name: Copy the local repo data
if: inputs.use-repo-data == 'true'
shell: bash
run: cp -r ground-platform/data/test-create ground-platform/data/test

- name: Replace Google Maps API key
shell: bash
env:
GOOGLE_MAPS_KEY: ${{ inputs.google-maps-key }}
run: |
sed -E -i 's/("current_key": ")[[:alnum:]_-]+(")/\1'"$GOOGLE_MAPS_KEY"'\2/' ground/src/debug/local/google-services.json
- name: Move the local google-services.json
shell: bash
run: |
cp -r ground/src/debug/local/google-services.json ground/src/debug/
- name: Build projects and run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 24
target: google_apis_playstore
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back emulated -logcat '*:e'
disable-animations: true
script: |
firebase emulators:exec './gradlew :e2eTest:connectedLocalDebugAndroidTest --stacktrace' --config ground-platform/firebase.local.json --project ground-local-dev --import data/test --export-on-exit data/test
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: '**/build/reports/androidTests'

- name: Upload screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: test-screenshots
path: '**/build/outputs/connected_android_test_additional_output'

- name: Move Firebase emulator data (avoids .gitignore)
shell: bash
run: mv data/test/ ./test

- name: Copy Firebase emulator data
if: inputs.upload-artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: data-submit
path: '**/test'
retention-days: 7
overwrite: true
if-no-files-found: error
using: composite
steps:
- name: Enable KVM group perms
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls /dev/kvm
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-24

- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ inputs.android-repository }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18

- name: Checkout ground-platform
uses: actions/checkout@v4
with:
repository: ${{ inputs.platform-repository }}
path: ground-platform

- name: Cache 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 }}-
- name: Build ground functions
shell: bash
run: |
cd ground-platform
npm run build:local
cd ../
- name: Install firebase-tools
shell: bash
run: |
npm install -g firebase-tools
- name: Cache 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: Copy Firebase emulator data
uses: actions/download-artifact@v4
if: inputs.use-repo-data != 'true'
with:
name: data-create
path: data/

- name: Copy the local repo data
if: inputs.use-repo-data == 'true'
shell: bash
run: cp -r ground-platform/data/test-create ground-platform/data/test

- name: Replace Google Maps API key
shell: bash
env:
GOOGLE_MAPS_KEY: ${{ inputs.google-maps-key }}
run: |
sed -E -i 's/("current_key": ")[[:alnum:]_-]+(")/\1'"$GOOGLE_MAPS_KEY"'\2/' ground/src/debug/local/google-services.json
- name: Move the local google-services.json
shell: bash
run: |
cp -r ground/src/debug/local/google-services.json ground/src/debug/
- name: Build projects and run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 24
target: google_apis_playstore
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back emulated -logcat '*:e'
disable-animations: true
script: |
firebase emulators:exec './gradlew :e2eTest:connectedLocalDebugAndroidTest --stacktrace' --config ground-platform/firebase.local.json --project local --import data/test --export-on-exit data/test
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: '**/build/reports/androidTests'

- name: Upload screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: test-screenshots
path: '**/build/outputs/connected_android_test_additional_output'

- name: Move Firebase emulator data (avoids .gitignore)
shell: bash
run: mv data/test/ ./test

- name: Copy Firebase emulator data
if: inputs.upload-artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: data-submit
path: '**/test'
retention-days: 7
overwrite: true
if-no-files-found: error
6 changes: 3 additions & 3 deletions ground/src/debug/local/google-services.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"project_info": {
"project_number": "334087903719",
"project_id": "ground-local-dev",
"storage_bucket": "ground-local-dev.appspot.com"
"project_id": "local",
"storage_bucket": "local.appspot.com"
},
"client": [
{
Expand All @@ -14,7 +14,7 @@
},
"oauth_client": [
{
"client_id": "ground-local-dev.apps.googleusercontent.com",
"client_id": "local.apps.googleusercontent.com",
"client_type": 3
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class LoiCollectionReference internal constructor(ref: CollectionReference) :
/** Retrieves LOIs created by the specified email in the specified survey. Main-safe. */
suspend fun fetchUserDefined(survey: Survey, creatorEmail: String): List<LocationOfInterest> =
withContext(ioDispatcher) {
Timber.e(creatorEmail)
val query =
reference()
.whereEqualTo(PREDEFINED_FIELD, false)
Expand Down

0 comments on commit 20d8db8

Please sign in to comment.