Skip to content

fix(messaging, android): handle nullable broadcast intent (#7893) (#7… #2178

fix(messaging, android): handle nullable broadcast intent (#7893) (#7…

fix(messaging, android): handle nullable broadcast intent (#7893) (#7… #2178

name: Testing E2E Android
on:
workflow_dispatch:
pull_request:
branches:
- '**'
paths-ignore:
- 'docs/**'
- 'website/**'
- '.spellcheck.dict.txt'
- '**/*.md'
push:
branches:
- main
- v14-release
paths-ignore:
- 'docs/**'
- 'website/**'
- '.spellcheck.dict.txt'
- '**/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
android:
name: Android
runs-on: ubuntu-latest-l
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# all APIs below 23 just do not work
# google-apis doesn't have an emulator for 27
# 23-25, 28-29 appears to work locally but fails in CI
# 26 does not support performance tracing due to hardware acceleration bugs
# min-possible + max-possible skew looks like 29 and 34 then
# running anything below 34 fails at the moment though, so using only it for now
api-level: [34]
arch: [x86_64]
target: [google_apis]
# This is useful for benchmarking, do 0, 1, 2, etc (up to 256 max job-per-matrix limit) for averages
iteration: [0]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- 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
- uses: actions/checkout@v4
with:
fetch-depth: 50
# Set up tool versions
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
# Set path variables needed for caches
- name: Set workflow variables
id: workflow-variables
run: |
echo "metro-cache=$HOME/.metro" >> $GITHUB_OUTPUT
echo "tempdir=$TMPDIR" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Yarn Cache
id: yarn-cache
with:
path: .yarn/cache
key: ${{ runner.os }}-android-yarn-v1-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-android-yarn-v1
- name: Yarn Install
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
retry_wait_seconds: 60
max_attempts: 3
command: DETOX_DISABLE_POSTINSTALL=1 yarn && yarn lerna:prepare
- name: Cache Firestore Emulator
uses: actions/cache@v4
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-v1-${{ github.run_id }}
restore-keys: firebase-emulators-v1
- name: Start Firestore Emulator
run: yarn tests:emulator:start-ci
- uses: actions/cache@v4
name: Gradle Cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-v1-${{ hashFiles('yarn.lock', 'tests/android/build.gradle', 'tests/android/app/build.gradle') }}
restore-keys: ${{ runner.os }}-gradle-v1
- name: Build Android App
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
retry_wait_seconds: 60
max_attempts: 3
command: yarn tests:android:build
- name: Metro Bundler Cache
uses: actions/cache@v4
with:
path: ${{ steps.workflow-variables.outputs.metro-cache }}
key: ${{ runner.os }}-metro-v1-${{ github.run_id }}
restore-keys: ${{ runner.os }}-metro-v1
- name: Pre-fetch Javascript bundle
# Prebuild the bundle so that's fast when the app starts.
run: |
nohup yarn tests:packager:jet-ci &
printf 'Waiting for packager to come online'
until curl --output /dev/null --silent --head --fail http://localhost:8081/status; do
printf '.'
sleep 2
done
echo "Packager is online! Preparing javascript bundle..."
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&inlineSourceMap=true"
echo "...javascript bundle ready."
- name: Test Tapper
# Detox uses Espresso to choreograph UI events, we send a stream of taps to keep choreography moving quickly
# Run this outside the emulator runner so the emulator runner does not wait on it for cleanup
run: |
nohup sh -c "until false; do $ANDROID_HOME/platform-tools/adb shell input tap 100 800; sleep 0.2; done" &
shell: bash
- name: Detox Tests
uses: reactivecircus/android-emulator-runner@v2
timeout-minutes: 45
with:
api-level: ${{ matrix.api-level }}
avd-name: TestingAVD
target: ${{ matrix.target }}
disable-spellchecker: true
arch: ${{ matrix.arch }}
pre-emulator-launch-script: |
sudo mkdir /mnt/avd
sudo chown $USER:$USER /mnt/avd
mkdir -p $HOME/.android
ln -s /mnt/avd $HOME/.android/avd
script: |
$ANDROID_HOME/platform-tools/adb devices
nohup sh -c "$ANDROID_HOME/platform-tools/adb logcat '*:D' > adb-log.txt" &
yarn tests:android:test-cover --headless
yarn tests:android:test:jacoco-report
- uses: codecov/codecov-action@v4
with:
verbose: true
- name: Upload Emulator Log
uses: actions/upload-artifact@v4
if: always()
with:
name: adb_logs_${{ matrix.api-level}}_${{ matrix.arch }}_${{ matrix.target }}_${{ matrix.iteration }}
path: adb-*.txt