ci: migrate Instrumentation tests to ubuntu-latest with KVM + AVD cache #2891
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: Build and Test | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: Validate Gradle Wrapper | |
| uses: gradle/wrapper-validation-action@216d1ad2b3710bf005dc39237337b9673fd8fcd5 # v3.3.2 | |
| - name: Configure JDK | |
| uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 # v1.4.3 | |
| with: | |
| java-version: 17 | |
| - run: touch local.properties | |
| - name: Lint Check | |
| run: ./gradlew :iterableapi:lintDebug | |
| - name: Checkstyle | |
| run: ./gradlew :iterableapi:checkstyle :iterableapi-ui:assembleDebug | |
| unit-tests: | |
| name: Unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: Validate Gradle Wrapper | |
| uses: gradle/wrapper-validation-action@216d1ad2b3710bf005dc39237337b9673fd8fcd5 # v3.3.2 | |
| - name: Configure JDK | |
| uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 # v1.4.3 | |
| with: | |
| java-version: 17 | |
| - run: touch local.properties | |
| - name: Test | |
| # run: ./gradlew :iterableapi:jacocoTestDebugUnitTestReport :app:jacocoDebugTestReport | |
| run: ./gradlew :iterableapi:testDebugUnitTest :app:testDebugUnitTest | |
| # Coverage reporting temporarily disabled | |
| # - name: Upload coverage data | |
| # uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
| # with: | |
| # name: unit-tests | |
| # path: | | |
| # ./**/build/**/jacoco*.xml | |
| # ./**/build/**/report.xml | |
| instrumentation-tests: | |
| name: Instrumentation tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - 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: Checkout | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| - name: Validate Gradle Wrapper | |
| uses: gradle/wrapper-validation-action@216d1ad2b3710bf005dc39237337b9673fd8fcd5 # v3.3.2 | |
| - name: Configure JDK | |
| uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 # v1.4.3 | |
| with: | |
| java-version: 17 | |
| - run: touch local.properties | |
| - name: AVD cache | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-29-x86_64-v1 | |
| - name: Create AVD snapshot | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@324029e2f414c084d8b15ba075288885e74aef9c # v2.34.0 | |
| with: | |
| api-level: 29 | |
| arch: x86_64 | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim | |
| disable-animations: false | |
| script: echo "Generated AVD snapshot." | |
| - name: Test | |
| uses: reactivecircus/android-emulator-runner@324029e2f414c084d8b15ba075288885e74aef9c # v2.34.0 | |
| with: | |
| api-level: 29 | |
| arch: x86_64 | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim | |
| disable-animations: true | |
| script: ./gradlew :iterableapi:connectedCheck | |
| # Coverage reporting temporarily disabled | |
| # - name: Upload coverage data | |
| # uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
| # with: | |
| # name: instrumentation-tests | |
| # path: | | |
| # ./**/build/**/jacoco*.xml | |
| # ./**/build/**/report.xml | |
| # Coverage reporting temporarily disabled | |
| # report-coverage: | |
| # name: Report coverage | |
| # runs-on: ubuntu-latest | |
| # needs: [unit-tests, instrumentation-tests] | |
| # env: | |
| # JACOCO_SOURCE_PATH: "iterableapi/src/main/java iterableapi-ui/src/main/java" | |
| # steps: | |
| # - name: Checkout | |
| # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| # with: | |
| # fetch-depth: 0 | |
| # | |
| # - name: Configure JDK | |
| # uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 # v1.4.3 | |
| # with: | |
| # java-version: 17 | |
| # | |
| # - run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
| # - run: chmod +x ./cc-test-reporter | |
| # - run: ./cc-test-reporter before-build | |
| # | |
| # - name: Download unit tests coverage | |
| # uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
| # with: | |
| # name: unit-tests | |
| # | |
| # - name: Download instrumentation tests coverage | |
| # uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
| # with: | |
| # name: instrumentation-tests | |
| # | |
| # - run: bash <(curl -s https://codecov.io/bash) | |
| # - run: ./cc-test-reporter format-coverage app/build/reports/jacoco/jacocoDebugTestReport/jacocoDebugTestReport.xml --input-type jacoco -d | |
| # - run: ./cc-test-reporter format-coverage iterableapi/build/reports/coverage/androidTest/debug/connected/report.xml --input-type jacoco -d | |
| # - run: ./cc-test-reporter format-coverage iterableapi/build/jacoco/jacoco.xml --input-type jacoco -d | |
| # - run: ./cc-test-reporter format-coverage app/build/reports/jacoco/jacocoDebugAndroidTestReport/jacocoDebugAndroidTestReport.xml --input-type jacoco -d | |
| # - run: ./cc-test-reporter upload-coverage | |
| # env: | |
| # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |