Skip to content

Instantly share code, notes, and snippets.

@biklas7
Last active February 8, 2024 21:51
Show Gist options
  • Select an option

  • Save biklas7/2461f840c47b488394d5d50373e40c29 to your computer and use it in GitHub Desktop.

Select an option

Save biklas7/2461f840c47b488394d5d50373e40c29 to your computer and use it in GitHub Desktop.
Android GitHub Actions Setup - Testing
name: Testing Workflow
# Step 1: Choose the branch or branches you want to run this workflow
on:
pull_request:
branches:
- develop
jobs:
testing:
name: Lint Check and Testing
runs-on: ubuntu-latest
steps:
- name: Clone Repo
uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Step 2: Decode Google services configuration file
- name: Decode google-services.json
env:
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
run: echo $FIREBASE_CONFIG > app/google-services.json
# Step 3: Check the code with ktlint, you can remove this job if you don't use ktlint
- name: Run Kotlin Linter
run: ./gradlew ktlintStagingDebugCheck
# Step 3: Check the code with Android linter
- name: Run Android Linter
run: ./gradlew lintStagingDebug
# Step 4: Yun your unit tests
- name: Run Unit Tests
run: ./gradlew testStagingDebugUnitTest
# Step 4: Assemble debug apk to send to firebase test lab
- name: Assemble Debug APK
run: ./gradlew assembleStagingDebug
# Step 4: Assemble debug test apk to send to firebase test lab
- name: Assemble Debug Test APK
run: ./gradlew assembleStagingDebugAndroidTest
# Step 4: Run instrumented tests on firebase test lab
- name: Run tests on Firebase Test Lab
uses: asadmansr/Firebase-Test-Lab-Action@v1.0
with:
arg-spec: '.github/test-lab-config-staging.yml:android-pixel-4'
env:
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment