From 4d428d3f97df392de522e01d37f8cc8b6999faaf Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Sat, 9 Dec 2023 22:00:41 -0400 Subject: [PATCH] CI API 24 cache --- .github/workflows/instrumented.yml | 21 +++++++++++++++++++++ templates/workflows/data.json | 2 ++ templates/workflows/instrumented.ejs | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/.github/workflows/instrumented.yml b/.github/workflows/instrumented.yml index 4af5f87..56e9003 100644 --- a/.github/workflows/instrumented.yml +++ b/.github/workflows/instrumented.yml @@ -15,6 +15,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Gradle cache + uses: gradle/gradle-build-action@v2 - name: set up JDK 17 uses: actions/setup-java@v3 with: @@ -25,6 +27,25 @@ jobs: run: gradle wrapper - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: AVD cache + uses: actions/cache@v3 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-24 + - 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: 24 + arch: x86_64 + target: google_apis + 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 tests uses: reactivecircus/android-emulator-runner@v2 with: diff --git a/templates/workflows/data.json b/templates/workflows/data.json index 6d06f03..c742a6c 100644 --- a/templates/workflows/data.json +++ b/templates/workflows/data.json @@ -2,7 +2,9 @@ "config": { "actionCheckoutVersion": "v4", "actionSetupJavaVersion": "v3", + "actionGradleBuildActionVersion": "v2", "actionAndroidEmulatorRunnerVersion": "v2", + "actionCacheVersion": "v3", "javaVersion": 17, "javaDistribution": "temurin" }, diff --git a/templates/workflows/instrumented.ejs b/templates/workflows/instrumented.ejs index cb503c0..7352b64 100644 --- a/templates/workflows/instrumented.ejs +++ b/templates/workflows/instrumented.ejs @@ -15,6 +15,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@<%= config.actionCheckoutVersion %> + - name: Gradle cache + uses: gradle/gradle-build-action@<%= config.actionGradleBuildActionVersion %> - name: set up JDK <%= config.javaVersion %> uses: actions/setup-java@<%= config.actionSetupJavaVersion %> with: @@ -25,6 +27,25 @@ jobs: run: gradle wrapper - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: AVD cache + uses: actions/cache@<%= config.actionCacheVersion %> + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-<%= job.api %> + - name: create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@<%= config.actionAndroidEmulatorRunnerVersion %> + with: + api-level: <%= job.api %> + arch: <%= job.arch %> + target: <%= job.target %> + 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 tests uses: reactivecircus/android-emulator-runner@<%= config.actionAndroidEmulatorRunnerVersion %> with: