Skip to content

Instantly share code, notes, and snippets.

@adityadroid
Created April 21, 2023 18:39
Show Gist options
  • Save adityadroid/e29cb172a0369710f482c500a3a952da to your computer and use it in GitHub Desktop.
Save adityadroid/e29cb172a0369710f482c500a3a952da to your computer and use it in GitHub Desktop.
firebase-test-lab-run:
steps:
- activate-ssh-key@4: {}
- git-clone@8: {}
- flutter-installer@0:
inputs:
- version: 3.3.10
- is_update: 'false'
- [email protected]:
inputs:
- android_additional_params: "--debug -t lib/main.dart"
- android_output_type: apk
- platform: android
- [email protected]:
title: Firebase Test Lab
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
#1. Install gcloud CLI
curl https://sdk.cloud.google.com | bash
source $HOME/google-cloud-sdk/path.bash.inc
gcloud version
#2. Prepare The service account json for auth
echo $FIREBASE_TEST_LAB_SERVICE_ACCOUNT > ./gcloud_key_file.json
#3. Authenticate gcloud CLI with firebase and select the firebase project
gcloud auth activate-service-account --key-file=gcloud_key_file.json
gcloud --quiet config set project $FIREBASE_PROJECT_ID
#4. Build the Instrumentation Test
pushd android
./gradlew app:assembleAndroidTest
./gradlew app:assembleDebug -Ptarget="integration_test/main_integration_test.dart"
popd
#5. Run it on Test Lab using gcloud CLI.
gcloud firebase test android run \
--type instrumentation \
--app "$BITRISE_SOURCE_DIR/build/app/outputs/apk/debug/app-debug.apk" \
--test "$BITRISE_SOURCE_DIR/build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk" \
--timeout 30m
- deploy-to-bitrise-io@2: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment