Android CI/CD #19
This file contains hidden or 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: dasd | |
on: | |
pull_request: | |
branches: | |
- development | |
- master # Run only for pull requests targeting the develop and master branch | |
types: | |
- synchronize # Trigger when commits are added to the pull request | |
- opened # Trigger when a pull request is first opened | |
- reopened # Trigger when a previously closed pull request is reopened | |
jobs: | |
instrumentation-tests: | |
name: Run Instrumentation Tests | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Set up JDK (required for Android Gradle Plugin) | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
# Set up Android SDK | |
- name: Set up Android SDK | |
uses: android-actions/setup-android@v2 | |
with: | |
api-level: 30 # API level for the emulator | |
target: 'android-30' | |
arch: 'x86_64' | |
ndk: false | |
# Start an Android emulator | |
- name: Start Emulator | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 30 | |
target: 'google_apis' | |
arch: 'x86_64' | |
emulator-options: '-no-window -no-boot-anim' | |
script: adb shell input keyevent 82 # Unlock the emulator screen | |
# Build the app and run tests | |
- name: Build and Run Tests | |
run: | | |
./gradlew assembleDebug assembleAndroidTest | |
./gradlew connectedAndroidTest | |
# Upload Test Results | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: app/build/reports/androidTests/ |