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
126 changes: 126 additions & 0 deletions .github/actions/run-automation-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Copyright 2025 Google LLC
#
# 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: Run all automated tests in the e2eTeest module

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

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

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

runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v6
with:
repository: ${{ inputs.android-repository }}

- name: Check Firebase emulator connection
shell: bash
run: |
echo "Checking connection to Firebase emulator..."
if curl -v http://localhost:4000; then
echo "Successfully connected to Firebase emulator!"
else
echo "Failed to connect to Firebase emulator (http://localhost:4000)"
exit 1
fi

- name: Validate MAPS_API_KEY
env:
MAPS_API_KEY: ${{ inputs.google-maps-key }}
shell: bash
run: |
if [ -z "${MAPS_API_KEY}" ]; then
echo "MAPS_API_KEY is missing from GitHub secrets"
exit 1
fi
echo "MAPS_API_KEY is set"

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

- 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

- 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-35-google_apis_playstore-x86_64-v1
restore-keys: avd-35-google_apis_playstore-x86_64-

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
target: google_apis_playstore
arch: x86_64
force-avd-creation: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back emulated -logcat '*:e'
disable-animations: true
script: |
echo "Generated AVD snapshot for caching."

- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
target: google_apis_playstore
arch: x86_64
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: |
echo "MAPS_API_KEY=${{ inputs.google-maps-key }}" > secrets.properties
./gradlew :e2eTest:connectedLocalDebugAndroidTest --stacktrace

- name: Upload test reports
if: ${{ inputs.upload-artifacts == 'true' }}
uses: actions/upload-artifact@v4
with:
name: test-reports
path: '**/build/reports/androidTests'
retention-days: 7
if-no-files-found: warn

- name: Upload test screenshots
if: ${{ inputs.upload-artifacts == 'true' }}
uses: actions/upload-artifact@v4
with:
name: test-screenshots
path: '**/build/outputs/connected_android_test_additional_output'
retention-days: 7
if-no-files-found: warn
179 changes: 0 additions & 179 deletions .github/actions/submit-test/action.yml

This file was deleted.

54 changes: 14 additions & 40 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,27 @@
name: End to End Test

on:
issue_comment:
types: [created]
push:
branches:
- master

# See docs/e2e-testing-doc.md for details
jobs:
e2eTest:
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event.issue.pull_request && contains(github.event.comment.body, '/e2eTest')
timeout-minutes: 45
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
steps:
- name: Start test
run: |
echo "Begin end to end test"
- name: Checkout repository
uses: actions/checkout@v6

- name: Start Firebase emulator
uses: google/ground-platform/.github/actions/start-emulator@master

createTest:
needs: e2eTest
name: Create a new survey
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Run create-test
uses: google/ground-platform/.github/actions/create-test@master
with:
upload-artifacts: true

submitTest:
needs: createTest
name: Submit to survey
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Run submit-test
uses: ./.github/actions/submit-test
- name: Run E2E Tests
uses: google/ground-android/.github/actions/run-automation-tests@master
with:
android-repository: ${{ github.repository }}
google-maps-key: ${{ secrets.GOOGLE_MAPS_KEY }}
use-repo-data: false
google-maps-key: ${{ secrets.MAPS_API_KEY }}
upload-artifacts: true


verifyTest:
needs: submitTest
name: Verify survey submissions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Run verify-test
uses: google/ground-platform/.github/actions/verify-test@master
with:
use-repo-data: false
Loading