[Android] Build and run tests in github as an action #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android SDK Build and Test | |
permissions: | |
checks: write | |
pull-requests: write | |
on: | |
push: | |
branches: | |
- master | |
- staging | |
pull_request: | |
branches: | |
- master | |
- staging | |
jobs: | |
build: | |
name: Build and Test the SDK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup docker | |
run: sudo apt-get install docker | |
- name: Setup emulator container | |
run: docker pull us-docker.pkg.dev/android-emulator-268719/images/28-playstore-x64:30.1.2 | |
- name: Checkout SDK code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'corretto' | |
- name: Setup Android SDK | |
uses: android-actions/[email protected] | |
- name: Setup ADB | |
run: adb start-server | |
- name: Start android emulator container | |
run: docker run -d -e "ADBKEY=$(cat ~/.android/adbkey)" --device /dev/kvm --publish 8554:8554/tcp --publish 5554:5554/tcp --publish 5555:5555/tcp us-docker.pkg.dev/android-emulator-268719/images/28-playstore-x64:30.1.2 | |
- name: Connect to the emulator | |
run: adb connect localhost:5555 | |
- name: Build the SDK | |
if: always() | |
run: ./gradlew sdk:build | |
- name: Run android tests | |
if: always() | |
run: ./gradlew sdk:connectedCheck && ./gradlew sdk:connectedAndroidTest | |
- name: Publish Test Results to PR | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: "Unit Test Results :rocket:" | |
comment_title: "Unit Test Results :rocket:" | |
files: | | |
sdk/build/outputs/androidTests-results/**/*.xml | |