Skip to content

Commit

Permalink
Migrate mobile testing to BrowserStack (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
albho authored Nov 25, 2024
1 parent 3df6954 commit bfd2d3a
Show file tree
Hide file tree
Showing 24 changed files with 882 additions and 695 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Android AppCenter Tests
name: Android BrowserStack Tests

on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- '.github/workflows/android-appcenter.yml'
- '.github/workflows/android-browserstack.yml'
- 'binding/android/RhinoTestApp/**'
- 'resources/.test/**'
- 'resources/audio_samples/**'
pull_request:
branches: [ master, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/android-appcenter.yml'
- '.github/workflows/android-browserstack.yml'
- 'binding/android/RhinoTestApp/**'
- 'resources/.test/**'
- 'resources/audio_samples/**'
Expand All @@ -23,24 +23,23 @@ defaults:

jobs:
build:
name: Run Android Tests on AppCenter
name: Run Android Tests on BrowserStack
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js LTS
uses: actions/setup-node@v3
- name: Installing Python
uses: actions/setup-python@v5
with:
node-version: lts/*
python-version: '3.10'
- run:
pip3 install requests

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Copy test_resources
Expand Down Expand Up @@ -68,35 +67,34 @@ jobs:
- name: Build androidTest
run: ./gradlew assembleEnDebugAndroidTest

- name: Run tests on AppCenter
run: appcenter test run espresso
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Rhino-Android-Activity"
--devices "Picovoice/android-min-max"
--app-path rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk
--test-series "rhino-android"
--locale "en_US"
--build-dir rhino-test-app/build/outputs/apk/androidTest/en/debug
- name: Run tests on BrowserStack
run: python3 ../../../script/automation/browserstack.py
--type espresso
--username "${{secrets.BROWSERSTACK_USERNAME}}"
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
--project_name "Rhino-Android"
--devices "android-min-max"
--app_path "rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk"
--test_path "rhino-test-app/build/outputs/apk/androidTest/en/debug/rhino-test-app-en-debug-androidTest.apk"

build-integ:
name: Run Android Integration Tests on AppCenter
name: Run Android Integration Tests on BrowserStack
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js LTS
uses: actions/setup-node@v3
- name: Installing Python
uses: actions/setup-python@v5
with:
node-version: lts/*

- name: Install AppCenter CLI
run: npm install -g appcenter-cli
python-version: '3.10'
- run:
pip3 install requests

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Copy test_resources
Expand Down Expand Up @@ -124,12 +122,12 @@ jobs:
- name: Build androidTest
run: ./gradlew assembleEnReleaseAndroidTest -DtestBuildType=integ

- name: Run tests on AppCenter
run: appcenter test run espresso
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Rhino-Android-Activity"
--devices "Picovoice/android-min-max"
--app-path rhino-test-app/build/outputs/apk/en/release/rhino-test-app-en-release.apk
--test-series "rhino-android"
--locale "en_US"
--build-dir rhino-test-app/build/outputs/apk/androidTest/en/release
- name: Run tests on BrowserStack
run: python3 ../../../script/automation/browserstack.py
--type espresso
--username "${{secrets.BROWSERSTACK_USERNAME}}"
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
--project_name "Rhino-Android-Integration"
--devices "android-min-max"
--app_path "rhino-test-app/build/outputs/apk/en/release/rhino-test-app-en-release.apk"
--test_path "rhino-test-app/build/outputs/apk/androidTest/en/release/rhino-test-app-en-release-androidTest.apk"
4 changes: 2 additions & 2 deletions .github/workflows/android-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Build
Expand Down
41 changes: 19 additions & 22 deletions .github/workflows/android-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,30 @@ defaults:

jobs:
build:
name: Run Android Speed Tests on AppCenter
name: Run Android Speed Tests on BrowserStack
runs-on: ubuntu-latest

strategy:
matrix:
device: [single-android, 32bit-android]
device: [ android-perf ]
include:
- device: single-android
- device: android-perf
performanceThresholdSec: 0.2
- device: 32bit-android
performanceThresholdSec: 1.0

steps:
- uses: actions/checkout@v3

- name: Set up Node.js LTS
uses: actions/setup-node@v3
- name: Installing Python
uses: actions/setup-python@v5
with:
node-version: lts/*
python-version: '3.10'
- run:
pip3 install requests

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Copy test_resources
Expand Down Expand Up @@ -79,12 +76,12 @@ jobs:
- name: Build androidTest
run: ./gradlew assembleEnDebugAndroidTest -DtestBuildType=perf

- name: Run tests on AppCenter
run: appcenter test run espresso
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Rhino-Android-Activity"
--devices "Picovoice/${{ matrix.device }}"
--app-path rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk
--test-series "rhino-android"
--locale "en_US"
--build-dir rhino-test-app/build/outputs/apk/androidTest/en/debug
- name: Run tests on BrowserStack
run: python3 ../../../script/automation/browserstack.py
--type espresso
--username "${{secrets.BROWSERSTACK_USERNAME}}"
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
--project_name "Rhino-Android-Performance"
--devices "${{ matrix.device }}"
--app_path "rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk"
--test_path "rhino-test-app/build/outputs/apk/androidTest/en/debug/rhino-test-app-en-debug-androidTest.apk"
78 changes: 0 additions & 78 deletions .github/workflows/ios-appcenter.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/ios-browserstack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: iOS BrowserStack Tests

on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- '.github/workflows/ios-browserstack.yml'
- 'binding/ios/RhinoAppTest/**'
- 'resources/.test/**'
- 'resources/audio_samples/**'
pull_request:
branches: [ master, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/ios-browserstack.yml'
- 'binding/ios/RhinoAppTest/**'
- 'resources/.test/**'
- 'resources/audio_samples/**'

defaults:
run:
working-directory: binding/ios/RhinoAppTest

jobs:
build:
name: Run iOS Tests on BrowserStack
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Installing Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- run:
pip3 install requests

- name: Install Cocoapods
run: gem install cocoapods

- name: Make build dir
run: mkdir ddp

- name: Copy test_resources
run: ./copy_test_resources.sh

- name: Run Cocoapods
run: pod install

- name: Inject AccessKey
run: sed -i '.bak' 's:{TESTING_ACCESS_KEY_HERE}:${{secrets.PV_VALID_ACCESS_KEY}}:'
RhinoAppTestUITests/BaseTest.swift

- name: XCode Build
run: xcrun xcodebuild build-for-testing
-configuration Debug
-workspace RhinoAppTest.xcworkspace
-sdk iphoneos
-scheme RhinoAppTest
-derivedDataPath ddp
CODE_SIGNING_ALLOWED=NO

- name: Generating ipa
run: cd ddp/Build/Products/Debug-iphoneos/ &&
mkdir Payload &&
cp -r RhinoAppTest.app Payload &&
zip --symlinks -r RhinoAppTest.ipa Payload &&
rm -r Payload

- name: Zipping Tests
run: cd ddp/Build/Products/Debug-iphoneos/ &&
zip --symlinks -r RhinoAppTestUITests.zip RhinoAppTestUITests-Runner.app

- name: Run tests on BrowserStack
run: python3 ../../../script/automation/browserstack.py
--type xcuitest
--username "${{secrets.BROWSERSTACK_USERNAME}}"
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
--project_name "Rhino-iOS"
--devices "ios-min-max"
--app_path "ddp/Build/Products/Debug-iphoneos/RhinoAppTest.ipa"
--test_path "ddp/Build/Products/Debug-iphoneos/RhinoAppTestUITests.zip"
3 changes: 0 additions & 3 deletions .github/workflows/ios-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jobs:
- name: Install Cocoapods
run: gem install cocoapods

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: Make build dir
run: mkdir ddp

Expand Down
Loading

0 comments on commit bfd2d3a

Please sign in to comment.