CI: Install Android SDK before using adb #909
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: Android CI | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: set up JDK 1.17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Build app | |
| run: ./gradlew clean build | |
| - name: Prepare app for instrumented tests | |
| run: | | |
| adb install -r -t app/build/outputs/apk/debug/app-debug.apk | |
| adb shell am start -n com.readrops.app.debug/com.readrops.app.MainActivity | |
| adb shell settings put global zen_mode 0 | |
| adb shell pm grant com.readrops.app.debug android.permission.POST_NOTIFICATIONS | |
| adb shell pm grant com.readrops.app android.permission.POST_NOTIFICATIONS | |
| - name: Android Emulator Runner | |
| uses: ReactiveCircus/android-emulator-runner@v2.33.0 | |
| with: | |
| api-level: 34 | |
| script: ./gradlew connectedCheck jacocoFullReport | |
| - uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./build/reports/jacoco/jacocoFullReport/jacocoFullReport.xml | |
| fail_ci_if_error: true | |
| verbose: true |