Skip to content

Run Tests

Run Tests #1605

Workflow file for this run

name: Run Tests
on:
push:
branches: [master]
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout submodules
uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: false
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17.0.10
distribution: "adopt"
cache: gradle
- name: Write to local.properties
run: |
echo BACKTRACE_SUBMISSION_URL=\"${{ secrets.BACKTRACE_SUBMISSION_URL }}\" >> ./local.properties
echo BACKTRACE_CORONER_URL=\"${{ secrets.BACKTRACE_CORONER_URL }}\" >> ./local.properties
echo BACKTRACE_CORONER_TOKEN=\"${{ secrets.BACKTRACE_CORONER_TOKEN }}\" >> ./local.properties
- name: Build and check
run: ./gradlew assembleDebug assembleDebugAndroidTest build check
- name: Upload symbols.zip
uses: actions/upload-artifact@v4
with:
name: native-debug-symbols.zip
path: example-app/build/outputs/native-debug-symbols/release/native-debug-symbols.zip
- name: Upload example-app APK
uses: actions/upload-artifact@v4
with:
name: example-app-debug.apk
path: example-app/build/outputs/apk/debug/example-app-debug.apk
- name: Upload example-app Test APK
uses: actions/upload-artifact@v4
with:
name: example-app-debug-androidTest.apk
path: example-app/build/outputs/apk/androidTest/debug/example-app-debug-androidTest.apk
- name: Upload backtrace-library AAR
uses: actions/upload-artifact@v4
with:
name: backtrace-library-debug.aar
path: backtrace-library/build/outputs/aar/backtrace-library-debug.aar
- name: Upload backtrace-library Test APK
uses: actions/upload-artifact@v4
with:
name: backtrace-library-debug-androidTest.apk
path: backtrace-library/build/outputs/apk/androidTest/debug/backtrace-library-debug-androidTest.apk
test:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
test-apk:
[
example-app-debug-androidTest.apk,
backtrace-library-debug-androidTest.apk,
]
steps:
- name: Download APK
uses: actions/download-artifact@v4
with:
name: example-app-debug.apk
- name: Download Test APK
uses: actions/download-artifact@v4
with:
name: ${{ matrix.test-apk }}
- name: Get Saucectl
run: curl -L https://saucelabs.github.io/saucectl/install | bash
- name: Install saucectl
uses: saucelabs/saucectl-run-action@v4
with:
skip-run: true
- name: Run Saucectl
run: |
saucectl configure --username ${{ secrets.SAUCE_USERNAME }} --accessKey ${{ secrets.SAUCE_ACCESS_KEY }}
# recent real device
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --device name=".*,platformVersion=14" --region us-west-1
# newest Android version
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --emulator name="Android GoogleApi Emulator,platformVersion=15.0" --region us-west-1
# oldest Android version
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --emulator name="Android GoogleApi Emulator,platformVersion=8.0" --region us-west-1
# oldest real device (aiming for armv7 / 32bit)
saucectl run espresso -c "" --name "From Github Actions" --app example-app-debug.apk --testApp ${{ matrix.test-apk }} --device name=".*,platformVersion=9" --region us-west-1
# --device name=".*,platformVersion=6.0.1"
# --device name="Samsung_Galaxy_S20_FE_5G_backtrace_us"
# --device name="Samsung_Galaxy_S22_Ultra_5G_backtrace_us"
- name: Run morgue
run: |
npm install backtrace-morgue --location=global
morgue --version || true
# Todo: currently just looks 15 minutes in the past and doesn't filter at all.
# --csv=crash.csv
morgue --token=${{ secrets.BACKTRACE_API_TOKEN }} --endpoint="https://yolo.sp.backtrace.io" list yolo/android-library --select timestamp --filter=timestamp,greater-than,`date +%s%3N -d "15 minutes ago"` || true
# if [ $(wc -l < crash.csv) -gt 0 ]; then
# echo "Success"
# else
# exit 1
# fi
# runs-on: macos-latest # necessary for reactivecircus/android-emulator-runner@v2
# - name: Emulator test
# uses: reactivecircus/android-emulator-runner@v2
# with:
# target: google_apis
# api-level: ${{ matrix.api-level }}
# arch: x86_64
# script: ./gradlew connectedCheck
# - name: Code coverage
# run: bash <(curl -s https://codecov.io/bash)