Skip to content

Extract crash processing code #3779

Extract crash processing code

Extract crash processing code #3779

name: Run Functional Tests
on:
workflow_dispatch:
workflow_call:
schedule:
- cron: '0 3 * * *'
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 60
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
matrix:
api-level: [29]
target: [default]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable KVM group perms
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: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# Cache the emulator
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run Functional Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 6
# Grab the failures from the device so we can include them in results.
# Exit with non-zero so GH checks still fail.
script: ./gradlew connectedCheck --stacktrace || (adb logcat '[Embrace]:d' '*:S' -t 100000 > emulator_logcat.log && adb pull /storage/emulated/0/Android/data/io.embrace.android.embracesdk.test/cache/test_failure/ && exit 127)
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: sdk-functional-test-results
path: |
embrace-android-sdk/build/reports/androidTests/connected
test_failure
emulator_logcat.log
- name: Notify Slack of Test Failure
if: failure()
uses: slackapi/[email protected]
with:
payload: |
{
"failed_action_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK