Skip to content

Commit f390c92

Browse files
authored
Speed up CI builds (#90)
* Enable Gradle and AVD caches in CI * Also add some speedier emulator options to "Instrumented tests" step * Install HAXM for CI instrumented tests * Enable Gradle cache on release builds * setup-java action v3 * upload-sarif action v2
1 parent 278937b commit f390c92

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,45 @@ jobs:
1919
- name: Validate Gradle wrapper
2020
uses: gradle/wrapper-validation-action@v1
2121
- name: Install JDK 11
22-
uses: actions/setup-java@v1
22+
uses: actions/setup-java@v3
2323
with:
24+
distribution: zulu
2425
java-version: 11
26+
- name: Gradle cache
27+
uses: gradle/gradle-build-action@v2
2528
- name: Build
2629
run: ./gradlew clean build -PciApiLevel=${{ matrix.api-level }} --stacktrace
2730
- name: Report Detekt results
28-
uses: github/codeql-action/upload-sarif@v1
31+
uses: github/codeql-action/upload-sarif@v2
2932
with:
3033
sarif_file: ${{ github.workspace }}/build/detekt/sarif
3134
checkout_path: ${{ github.workspace }}
35+
- name: Install HAXM
36+
run: brew install --cask intel-haxm
37+
- name: Emulator cache
38+
uses: actions/cache@v3
39+
id: avd-cache
40+
with:
41+
path: |
42+
~/.android/avd/*
43+
~/.android/adb*
44+
key: avd-${{ matrix.api-level }}
45+
- name: Create emulator and generate snapshot for caching
46+
if: steps.avd-cache.outputs.cache-hit != 'true'
47+
uses: reactivecircus/android-emulator-runner@v2
48+
with:
49+
api-level: ${{ matrix.api-level }}
50+
force-avd-creation: false
51+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
52+
disable-animations: false
53+
script: echo "Generated AVD snapshot for caching."
3254
- name: Instrumented tests
33-
uses: reactivecircus/android-emulator-runner@v2.19.1
55+
uses: reactivecircus/android-emulator-runner@v2
3456
with:
3557
api-level: ${{ matrix.api-level }}
58+
force-avd-creation: false
59+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
60+
disable-animations: true
3661
script: ./gradlew connectedCheck -PciApiLevel=${{ matrix.api-level }} --stacktrace
3762
- name: Publish test results
3863
uses: mikepenz/action-junit-report@v1.2.1

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ jobs:
3333
uses: actions/checkout@v2
3434
- name: Validate Gradle wrapper
3535
uses: gradle/wrapper-validation-action@v1
36+
- name: Install JDK 11
37+
uses: actions/setup-java@v3
38+
with:
39+
distribution: zulu
40+
java-version: 11
41+
- name: Gradle cache
42+
uses: gradle/gradle-build-action@v2
3643
- name: Assemble for release
3744
run: ./gradlew clean assembleRelease --stacktrace
3845
- name: Publish

0 commit comments

Comments
 (0)