Skip to content

Migrate to OTel semantic convention keys #2620

Migrate to OTel semantic convention keys

Migrate to OTel semantic convention keys #2620

name: Run Functional Tests
on:
workflow_dispatch:
workflow_call:
schedule:
- cron: '0 3 * * *'
pull_request:
branches: [ master ]
env:
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 60
jobs:
test:
runs-on: macos-12
timeout-minutes: 45
strategy:
matrix:
jdk-version: ["17"]
ndk-version: ["21.4.7075529"]
api-level: [29]
target: [default]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
~/.sonar/cache
key: ${{ runner.os }}-gradle-jdk${{ matrix.jdk-version }}-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties', '**/libs.versions.toml', 'gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle
# 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: embrace-io/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: Install JDK ${{ matrix.jdk-version }}
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.jdk-version }}
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Run Functional Tests
uses: embrace-io/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/slack-github-action@v1.26.0
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
- name: Cleanup Gradle Cache
if: always()
# Based on https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle#caching-dependencies
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties