Skip to content

Instantly share code, notes, and snippets.

@m4rtinpf
Created May 10, 2024 02:44
Show Gist options
  • Save m4rtinpf/54e301bfa20deb82cb20e18595504f4c to your computer and use it in GitHub Desktop.
Save m4rtinpf/54e301bfa20deb82cb20e18595504f4c to your computer and use it in GitHub Desktop.
Record screen for reactivecircus/android-emulator-runner gh action
#!/bin/sh
set -x
echo "Starting the screen recording..."
adb shell "screenrecord --bugreport /data/local/tmp/testRecording.mp4 & echo \$! > /data/local/tmp/screenrecord_pid.txt" &
set +e
npm run test
TEST_STATUS=$?
echo "Test run completed with status $TEST_STATUS"
adb shell "kill -2 \$(cat /data/local/tmp/screenrecord_pid.txt)"
# Wait for the screen recording process to exit
sleep 1
adb pull /data/local/tmp/testRecording.mp4 .
exit $TEST_STATUS
...
test:
runs-on: ubuntu-latest
steps:
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Run E2E Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
script: ./test-ci.sh
- name: Upload Recording
uses: actions/upload-artifact@v4
if: always()
with:
name: Test Recording
path: testRecording.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment