From a6655ce68bddbff575bc2c0a240a83d5ed2a4d03 Mon Sep 17 00:00:00 2001 From: Federico Iosue Date: Fri, 28 Oct 2022 00:29:04 +0200 Subject: [PATCH] Trying AVD cache to speed up CI https://github.com/ReactiveCircus/android-emulator-runner#usage--examples --- .github/workflows/main.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93690d17d..5077eaa22 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,23 +9,48 @@ jobs: steps: - name: Checkout current develop branch uses: actions/checkout@v3 + - name: Setup JDK uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 11 cache: 'gradle' + + - name: AVD cache + uses: actions/cache@v3 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-30 + + - name: create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 30 + target: google_apis + arch: x86_64 + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + script: echo "Generated AVD snapshot for caching." + - name: Run unit/instrumentation tests and coverage generation uses: reactivecircus/android-emulator-runner@v2 with: api-level: 30 target: google_apis 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 -Pandroid.testInstrumentationRunnerArguments.notAnnotation=androidx.test.filters.FlakyTest,androidx.test.filters.LargeTest jacocoTestReport --stacktrace + - name: SonarCloud static code and coverage analysis env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: ./gradlew sonarqube -Dsonar.login="$SONAR_TOKEN" + run: ./gradlew sonarqube -Dsonar.login="$SONAR_TOKEN" \ No newline at end of file