Skip to content

Commit 82a3a26

Browse files
committed
update workflows
1 parent 84b2cc4 commit 82a3a26

File tree

3 files changed

+46
-27
lines changed

3 files changed

+46
-27
lines changed

.github/workflows/commit_validation.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929
with:
3030
distribution: 'zulu'
3131
java-version: '21'
32-
cache: 'gradle'
32+
33+
- uses: gradle/actions/setup-gradle@v5
3334

3435
- name: Assemble test apk
3536
run: ./gradlew assembleDebugAndroidTest

.github/workflows/pull_request_validation.yml

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,12 @@
22
# we run as the primary example for this project.
33
name: Pull Request Validation
44
on: [pull_request]
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
7+
cancel-in-progress: true
58

69
jobs:
7-
#Run Lint and Unit Tests
8-
test:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v6
12-
- uses: gradle/actions/wrapper-validation@v5
13-
14-
- name: set up JDK
15-
uses: actions/setup-java@v5
16-
with:
17-
distribution: 'zulu'
18-
java-version: '21'
19-
cache: 'gradle'
20-
21-
- name: Lint
22-
run: ./gradlew clean lint
23-
24-
- name: Unit Test
25-
run: ./gradlew clean test
26-
27-
# Run instrumented test cases
28-
android:
10+
verify:
2911
runs-on: ubuntu-latest
3012

3113
strategy:
@@ -41,17 +23,51 @@ jobs:
4123
with:
4224
distribution: 'zulu'
4325
java-version: '21'
44-
cache: 'gradle'
4526

46-
- name: Enable KVM group perms (needed for reactivecircus/android-emulator-runner below)
27+
- uses: gradle/actions/setup-gradle@v5
28+
29+
- name: Unit Testing and Linting
30+
run: ./gradlew lintDebug testDebugUnitTest --parallel --continue --build-cache --configuration-cache-problems=warn
31+
32+
- name: Enable KVM group perms
4733
run: |
4834
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
4935
sudo udevadm control --reload-rules
5036
sudo udevadm trigger --name-match=kvm
5137
38+
- name: AVD Cache
39+
uses: actions/cache@v5
40+
id: avd-cache
41+
with:
42+
path: |
43+
~/.android/avd/*
44+
~/.android/adb*
45+
key: avd-${{ matrix.api-level }}
46+
47+
- name: Create and Cache AVD
48+
if: steps.avd-cache.outputs.cache-hit != 'true'
49+
uses: reactivecircus/android-emulator-runner@v2
50+
with:
51+
api-level: ${{ matrix.api-level }}
52+
arch: x86_64
53+
force-avd-creation: false
54+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
55+
disable-animations: false
56+
script: echo "Generated AVD snapshot for caching."
57+
5258
- name: Run Instrumented Tests
5359
uses: reactivecircus/android-emulator-runner@v2
5460
with:
5561
api-level: ${{ matrix.api-level }}
5662
arch: x86_64
57-
script: ./gradlew connectedCheck
63+
force-avd-creation: false
64+
disable-animations: true
65+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
66+
script: ./gradlew connectedCheck --build-cache --configuration-cache-problems=warn
67+
68+
- name: Upload Artifacts on Failure
69+
uses: actions/upload-artifact@v6
70+
if: failure()
71+
with:
72+
name: build-${{ matrix.api-level }}
73+
path: app/build/

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
org.gradle.jvmargs=-Xmx8g -Dfile.encoding=UTF-8 -XX:+UseParallelGC
2-
kotlin.code.style=official
2+
kotlin.code.style=official
3+
org.gradle.parallel=true
4+
org.gradle.configuration-cache=true

0 commit comments

Comments
 (0)