@@ -74,18 +74,20 @@ jobs:
7474
7575
7676 integration_tests :
77- runs-on : [ ubuntu-latest ]
77+ runs-on : ubuntu-latest
78+
7879 env :
79- AVD_API_LEVEL : 34
80+ AVD_API_LEVEL : 30
8081 AVD_ARCH : x86_64
82+
8183 steps :
82- - name : Enable KVM group perms
84+ - name : Enable KVM
8385 run : |
84- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
86+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
87+ | sudo tee /etc/udev/rules.d/99-kvm4all.rules
8588 sudo udevadm control --reload-rules
8689 sudo udevadm trigger --name-match=kvm
8790
88-
8991 - name : Checkout Android source
9092 uses : actions/checkout@v5
9193
@@ -94,66 +96,68 @@ jobs:
9496 .github/scripts/deploy_docker_server.sh
9597 echo "CONTAINER_ID=$(docker container ls -q -f name=simple-server)" >> $GITHUB_ENV
9698
97- - name : Cache AVD
98- uses : actions/cache@v4
99- id : avd-cache
100- with :
101- path : |
102- ~/.android/avd/*
103- ~/.android/adb*
104- key : ${{ runner.os }}-avd-${{ env.AVD_API_LEVEL }}-${{ env.AVD_ARCH }}
105-
106- - name : create AVD and generate snapshot for caching
107- if : steps.avd-cache.outputs.cache-hit != 'true'
108- uses : reactivecircus/android-emulator-runner@v2
109- with :
110- api-level : ${{ env.AVD_API_LEVEL }}
111- arch : ${{ env.AVD_ARCH }}
112- force-avd-creation : false
113- emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
114- disable-animations : false
115- disk-size : 8G
116- script : echo "Generated AVD snapshot for caching."
117-
118- - name : set up JDK
99+ - name : Set up JDK
119100 uses : actions/setup-java@v5
120101 with :
121- distribution : ' zulu'
102+ distribution : zulu
122103 java-version : 17
123- cache : ' gradle'
124-
125- - name : Create build directory
126- run : mkdir app/build
104+ cache : gradle
127105
128106 - name : Build QA Test Artifacts
129- id : build-instrumented-tests
130107 run : |
131- ./gradlew --build-cache --no-daemon -PmanifestEndpoint=http://10.0.2.2:3000/api/ assembleQaDebug assembleQaDebugAndroidTest
108+ ./gradlew --build-cache --no-daemon \
109+ -PmanifestEndpoint=http://10.0.2.2:3000/api/ \
110+ assembleQaDebug assembleQaDebugAndroidTest
132111
133- - name : Android Tests
134- id : run-instrumented-tests
112+ - name : Run Android Instrumentation Tests
135113 uses : reactivecircus/android-emulator-runner@v2
136114 with :
137115 api-level : ${{ env.AVD_API_LEVEL }}
138116 arch : ${{ env.AVD_ARCH }}
139- force-avd-creation : false
140- emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
117+ avd-name : test
118+ force-avd-creation : true
119+ emulator-boot-timeout : 900
120+ disk-size : 16G
121+ ram-size : 2048M
141122 disable-animations : true
142- disk-size : 8G
123+ emulator-options : >
124+ -no-window
125+ -no-audio
126+ -no-boot-anim
127+ -no-snapshot
128+ -gpu swiftshader_indirect
129+ -camera-back none
143130 script : |
144- adb root
131+ echo "Waiting for emulator to boot..."
132+ adb wait-for-device
133+ adb shell getprop sys.boot_completed | grep -m 1 '1'
134+
135+ adb root || true
136+ adb wait-for-device
137+
145138 mkdir -p app/build/outputs/test-artifacts
146- adb install app/build/outputs/apk/qa/debug/app-qa-debug.apk
139+
140+ adb install app/build/outputs/apk/qa/debug/app-qa-debug.apk
147141 adb install app/build/outputs/apk/androidTest/qa/debug/app-qa-debug-androidTest.apk
148- adb shell am instrument -w -e filter org.simple.clinic.benchmark.SelectBenchmarkTests -e benchmark_app_performance false org.simple.clinic.qa.debug.test/org.simple.clinic.AndroidTestJUnitRunner >app/build/outputs/test-artifacts/logs.txt 2>app/build/outputs/test-artifacts/logs.txt
142+
143+ adb shell am instrument -w \
144+ -e filter org.simple.clinic.benchmark.SelectBenchmarkTests \
145+ -e benchmark_app_performance false \
146+ org.simple.clinic.qa.debug.test/org.simple.clinic.AndroidTestJUnitRunner \
147+ > app/build/outputs/test-artifacts/logs.txt 2>&1
148+
149149 cat app/build/outputs/test-artifacts/logs.txt
150- adb pull /storage/emulated/0/Android/data/org.simple.clinic.qa.debug/ app/build/outputs/test-artifacts/ || true
151- adb uninstall org.simple.clinic.qa.debug
152- adb uninstall org.simple.clinic.qa.debug.test
153- ! grep -q "FAILURES\!\!\!" app/build/outputs/test-artifacts/logs.txt
150+
151+ adb pull /storage/emulated/0/Android/data/org.simple.clinic.qa.debug/ \
152+ app/build/outputs/test-artifacts/ || true
153+
154+ adb uninstall org.simple.clinic.qa.debug || true
155+ adb uninstall org.simple.clinic.qa.debug.test || true
156+
157+ ! grep -q "FAILURES!!!" app/build/outputs/test-artifacts/logs.txt
154158
155159 - name : Upload failed test artifacts
156- if : always() && steps.run-instrumented-tests.outcome != 'success'
160+ if : failure()
157161 uses : actions/upload-artifact@v4
158162 with :
159163 name : failed-test-artifacts
@@ -164,7 +168,6 @@ jobs:
164168 run : |
165169 docker cp ${{ env.CONTAINER_ID }}:/home/app/log ./docker_logs
166170 zip -r docker_logs.zip docker_logs/
167-
168171
169172 - name : Upload Docker logs
170173 if : always()
@@ -174,10 +177,10 @@ jobs:
174177 path : docker_logs.zip
175178
176179 - name : Stop Simple Docker server
180+ if : always()
177181 run : |
178182 docker compose -f ".github/docker/simple-server.compose.yml" down
179183
180-
181184 verify_room_schemas :
182185 runs-on : [ ubuntu-latest ]
183186 steps :
0 commit comments