Skip to content
Merged
Changes from 1 commit
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
26 changes: 19 additions & 7 deletions .github/workflows/android-leap-chat-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Android LeapChat Build
on:
on:
push:
branches: [ main ]
paths:
Expand All @@ -12,11 +12,18 @@ on:
- '.github/workflows/android-leap-chat-test.yml'
workflow_dispatch:

# Least-privilege default. The job authenticates with gcloud against Firebase
# Test Lab via a service-account JSON; no GitHub API access needed.
permissions:
contents: read

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to gradle/actions/setup-gradle@50e97c2c # v6.1.0 in b5019df per maintainer direction — drops cache: 'gradle' from setup-java and replaces it with the dedicated Gradle action.

Worth noting on the underlying point: the GitHub Actions cache API is gated by the ACTIONS_RUNTIME_TOKEN (a separate token injected at job start), not by the GITHUB_TOKEN's actions: scope. Empirically the prior run on cbde9e3 saved the cache successfully under permissions: contents: read — Cache saved with the key: setup-java-Linux-x64-gradle-… in the run log. So the move is a code-quality improvement (matches the desktop-examples PR's pattern), not a fix for a broken cache path. Refined the permissions-block comment to clarify this.


jobs:
build-and-e2e-test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
Expand All @@ -28,14 +35,19 @@ jobs:
- name: Build E2E test
run: cd Android/LeapChat && ./gradlew :app:assembleAndroidTest
- name: Run E2E test on Firebase Test Lab
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
run: |
echo "$SERVICE_ACCOUNT" > /tmp/service_account.json
gcloud auth activate-service-account --key-file=/tmp/service_account.json
# Land the SA JSON under $RUNNER_TEMP, mode 600, with a trap cleanup
# so a job failure or cancellation doesn't leave the key on disk.
# printf (not echo) preserves backslash sequences in the JSON.
SA_FILE="${RUNNER_TEMP:-/tmp}/service_account.json"
trap 'rm -f "$SA_FILE"' EXIT
( umask 077 && printf '%s' "$SERVICE_ACCOUNT" > "$SA_FILE" )
gcloud auth activate-service-account --key-file="$SA_FILE"
gcloud firebase test android run --type instrumentation \
--app Android/LeapChat/app/build/outputs/apk/debug/app-debug.apk \
--test Android/LeapChat/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
--device model=MediumPhone.arm,version=36,locale=en,orientation=portrait \
--project liquid-leap
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}