@@ -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,66 @@ 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+ adb wait-for-device
132+ adb shell getprop sys.boot_completed | grep -m 1 '1'
133+
134+ adb root || true
135+ adb wait-for-device
136+
145137 mkdir -p app/build/outputs/test-artifacts
146- adb install app/build/outputs/apk/qa/debug/app-qa-debug.apk
138+ adb install app/build/outputs/apk/qa/debug/app-qa-debug.apk
147139 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
140+
141+ adb shell am instrument -w \
142+ -e filter org.simple.clinic.benchmark.SelectBenchmarkTests \
143+ -e benchmark_app_performance false \
144+ org.simple.clinic.qa.debug.test/org.simple.clinic.AndroidTestJUnitRunner \
145+ > app/build/outputs/test-artifacts/logs.txt 2>&1
146+
149147 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
148+
149+ adb pull /storage/emulated/0/Android/data/org.simple.clinic.qa.debug/ \
150+ app/build/outputs/test-artifacts/ || true
151+
152+ adb uninstall org.simple.clinic.qa.debug || true
153+ adb uninstall org.simple.clinic.qa.debug.test || true
154+
155+ ! grep -q "FAILURES!!!" app/build/outputs/test-artifacts/logs.txt
154156
155157 - name : Upload failed test artifacts
156- if : always() && steps.run-instrumented-tests.outcome != 'success'
158+ if : failure()
157159 uses : actions/upload-artifact@v4
158160 with :
159161 name : failed-test-artifacts
@@ -164,7 +166,6 @@ jobs:
164166 run : |
165167 docker cp ${{ env.CONTAINER_ID }}:/home/app/log ./docker_logs
166168 zip -r docker_logs.zip docker_logs/
167-
168169
169170 - name : Upload Docker logs
170171 if : always()
@@ -174,10 +175,10 @@ jobs:
174175 path : docker_logs.zip
175176
176177 - name : Stop Simple Docker server
178+ if : always()
177179 run : |
178180 docker compose -f ".github/docker/simple-server.compose.yml" down
179181
180-
181182 verify_room_schemas :
182183 runs-on : [ ubuntu-latest ]
183184 steps :
0 commit comments