[Android] Build and run tests in github as an action #11
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: Start android emulator container | |
run: docker run -d --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: Setup ADB command | |
run: sudo apt-get install adb | |
- name: Build the SDK | |
if: always() | |
run: ./gradlew sdk:build | |
- name: Connect to android container | |
if: always() | |
run: adb connect localhost:5555 | |
- name: Wait for android emulator | |
if: always() | |
run: adb wait-for-device | |
- name: Run android tests | |
if: always() | |
run: ./gradlew app: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 | |