Skip to content

Commit

Permalink
feat: firebase test lab action
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray committed Jan 7, 2025
1 parent f1d25a5 commit e5cf2b4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 11 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/build_and_test_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,22 @@ jobs:
if: always()
run: ./gradlew sdk:build

- name: Run the Android Unit Tests
if: always()
run: ./gradlew sdk:connectedAndroidTest
- name: Build the Android Test Apk
run: ./gradlew sdk:assembleAndroidTest

- name: Publish Test Results to PR
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
- 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:
check_name: "Unit Test Results :rocket:"
comment_title: "Unit Test Results :rocket:"
files: |
sdk/build/outputs/androidTest-results/**/*.xml
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

13 changes: 12 additions & 1 deletion sdk/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ly.count.android.sdk">

<application>
<application android:allowBackup="true">
<activity
android:name=".TestUtils$Activity2"
android:excludeFromRecents="true"
android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTop"
android:exported="false"/>
<activity
android:name=".TestMainActivity"
android:exported="true"
android:excludeFromRecents="true"
android:noHistory="true">
<!-- Intent filter for launcher activity -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<uses-library android:name="android.test.runner"/>
</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ly.count.android.sdk;

import android.app.Activity;
import android.os.Bundle;

public class TestMainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(android.R.layout.simple_spinner_item);
}
}

0 comments on commit e5cf2b4

Please sign in to comment.