From 20d8db8b73f7f79f2731e71f49ef37104cdb62b6 Mon Sep 17 00:00:00 2001 From: Gino Miceli <228050+gino-m@users.noreply.github.com> Date: Mon, 1 Jul 2024 21:25:43 +0200 Subject: [PATCH] Fix emu project name (#2535) * Fix accidental log message * Fix local emu project ID --- .github/actions/submit-test/action.yml | 314 +++++++++--------- ground/src/debug/local/google-services.json | 6 +- .../firebase/schema/LoiCollectionReference.kt | 1 - 3 files changed, 160 insertions(+), 161 deletions(-) diff --git a/.github/actions/submit-test/action.yml b/.github/actions/submit-test/action.yml index 19a4c05e21..fa6f959f7f 100644 --- a/.github/actions/submit-test/action.yml +++ b/.github/actions/submit-test/action.yml @@ -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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/ground/src/debug/local/google-services.json b/ground/src/debug/local/google-services.json index 1ac431bf2b..e5c36e3c29 100644 --- a/ground/src/debug/local/google-services.json +++ b/ground/src/debug/local/google-services.json @@ -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": [ { @@ -14,7 +14,7 @@ }, "oauth_client": [ { - "client_id": "ground-local-dev.apps.googleusercontent.com", + "client_id": "local.apps.googleusercontent.com", "client_type": 3 } ], diff --git a/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/LoiCollectionReference.kt b/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/LoiCollectionReference.kt index cd4a6c2197..805afd460e 100644 --- a/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/LoiCollectionReference.kt +++ b/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/LoiCollectionReference.kt @@ -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 = withContext(ioDispatcher) { - Timber.e(creatorEmail) val query = reference() .whereEqualTo(PREDEFINED_FIELD, false)