Skip to content

Commit 3249a72

Browse files
committed
feat: add more comments. Catch crash log only if a crash happened
1 parent 13e4f91 commit 3249a72

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/update.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ jobs:
164164
sudo udevadm control --reload-rules
165165
sudo udevadm trigger --name-match=kvm
166166
167+
# Run tests over emulator and catch crash logs
167168
- name: Run Emulator & Execute tests
168169
uses: reactivecircus/android-emulator-runner@v2
169170
id: execution
@@ -177,24 +178,43 @@ jobs:
177178
disable-animations: true
178179
emulator-options: -no-window -no-audio -no-boot-anim -accel auto -memory 2048
179180
script: |
181+
# To catch only crashes in background
182+
adb logcat -b crash *:E > crash_log.txt 2>&1 &
183+
LOGCAT_PID=$!
184+
180185
./gradlew clean test -Dserver="${{ secrets.OC_SERVER_URL }}" -Dusername="${{ secrets.OC_SERVER_USERNAME_TEST }}" -Dpassword="${{ secrets.OC_SERVER_PASSWORD_TEST }}" -Dcommit="$(echo $GITHUB_SHA | cut -c1-7)"
181186
187+
# Kill logcat to serve crash_log.txt
188+
kill $LOGCAT_PID || true
189+
190+
# If crash happened, upload crash log
191+
- name: Upload crash log artifact
192+
if: always() && hashFiles('crash_log.txt') != ''
193+
uses: actions/upload-artifact@v4
194+
with:
195+
name: crash-log
196+
path: crash_log.txt
197+
198+
# Prepare crash log file to be uploaded
182199
- name: Rename log file
183200
if: always()
184201
run: |
185202
cp logs/*.log logs/log.log || true
186203
204+
# Upload log file
187205
- name: Upload Execution Log
188206
if: always()
189207
uses: actions/upload-artifact@v4
190208
with:
191209
name: logs
192210
path: ./logs/log.log
193211

212+
# Prepare video file to be uploaded by compressing it
194213
- name: Zip video files
195214
if: always()
196215
run: zip -r -9 test-recording.zip video || true
197216

217+
# Upload video file
198218
- name: Upload Video
199219
if: always()
200220
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)