Run Tests #913
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
with: | |
fetch-depth: 2 | |
submodules: recursive | |
token: ${{ secrets.ACCESS_TOKEN }} | |
persist-credentials: false | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11.0.10 | |
distribution: "adopt" | |
cache: gradle | |
- name: Write to local.properties | |
run: | | |
echo BACKTRACE_SUBMISSION_URL=\"https://submit.backtrace.io/yolo/2dd86e8e779d1fc7e22e7b19a9489abeedec3b1426abe7e2209888e92362fba4/json\" > ./local.properties | |
- name: Build and check | |
run: ./gradlew assembleDebug assembleDebugAndroidTest build check | |
- name: Upload symbols.zip | |
uses: actions/upload-artifact@v3 | |
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@v3 | |
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@v3 | |
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@v3 | |
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@v3 | |
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@v3 | |
with: | |
name: example-app-debug.apk | |
- name: Download Test APK | |
uses: actions/download-artifact@v3 | |
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@v3 | |
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="Samsung_Galaxy_S20_FE_5G_backtrace_us" | |
# 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=12.0" | |
# 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=5.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=6.0.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) |