Skip to content

feat: firebase test lab action #984

feat: firebase test lab action

feat: firebase test lab action #984

name: The Countly Android SDK Unit Test
env:
EMULATOR_REPO: us-docker.pkg.dev/android-emulator-268719/images/28-playstore-x64:30.1.2
JAVA_V: 11
JAVA_DIST: corretto
permissions:
checks: write
pull-requests: write
on:
push:
branches:
- master
- staging
pull_request:
branches:
- master
- staging
jobs:
setup:
runs-on: ubuntu-latest
name: Build and Test the SDK
steps:
- name: Install Docker to the Runner
run: sudo apt-get install docker
- name: Pull Emulator from the Repo
run: docker pull ${{ env.EMULATOR_REPO }}
- name: Checkout SDK code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_V }}
distribution: ${{ env.JAVA_DIST }}
- name: Setup Android SDK
uses: android-actions/[email protected]
- name: Start ADB Server
run: adb start-server
- name: Run Android Emulator Container
run: docker run -d -e "ADBKEY=$(cat ~/.android/adbkey)" --device /dev/kvm --publish 5555:5555/tcp ${{ env.EMULATOR_REPO }}
- name: Connect to the Emulator
run: adb connect localhost:5555
- name: Set AAPT2 for android 35
run: echo "android.aapt2FromMavenOverride=/usr/local/lib/android/sdk/build-tools/35.0.0/aapt2" | tee -a ${{ github.workspace }}/gradle.properties
- name: Build the SDK
if: always()
run: ./gradlew sdk:build
- name: Build the Android Test Apk
run: ./gradlew sdk:assembleAndroidTest
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' #service account json
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Set current project
run: gcloud config set project ${{ secrets.FIREBASE_PROJECT_ID }}
- name: Run Instrumentation Tests in Firebase Test Lab
run: gcloud firebase test android run --type instrumentation --app sdk/build/outputs/apk/androidTest/debug/sdk-debug-androidTest.apk --test sdk/build/outputs/apk/androidTest/debug/sdk-debug-androidTest.apk --device model=Medium Phone,version=26 --device model=Medium Phone,version=27 --device model=Medium Phone,version=28 --device model=Medium Phone,version=29 --device model=Medium Phone,version=30 --device model=Medium Phone,version=31 --device model=Medium Phone,version=32 --device model=Medium Phone,version=33 --device model=Medium Phone,version=34 --device model=Medium Phone,version=35