From aa5e3d0e8f305db2366065ecf87a104ce9fe88e7 Mon Sep 17 00:00:00 2001 From: Eric Mikulin Date: Wed, 15 Jan 2025 11:14:28 -0800 Subject: [PATCH] iOS and Android browserstack workflows --- ...appcenter.yml => android-browserstack.yml} | 78 +++++++++---------- .github/workflows/ios-appcenter.yml | 78 ------------------- .github/workflows/ios-browserstack.yml | 78 +++++++++++++++++++ .github/workflows/ios-demos.yml | 8 +- .github/workflows/ios-perf.yml | 8 +- 5 files changed, 118 insertions(+), 132 deletions(-) rename .github/workflows/{android-appcenter.yml => android-browserstack.yml} (59%) delete mode 100644 .github/workflows/ios-appcenter.yml create mode 100644 .github/workflows/ios-browserstack.yml diff --git a/.github/workflows/android-appcenter.yml b/.github/workflows/android-browserstack.yml similarity index 59% rename from .github/workflows/android-appcenter.yml rename to .github/workflows/android-browserstack.yml index 41dd327066..aa422776bd 100644 --- a/.github/workflows/android-appcenter.yml +++ b/.github/workflows/android-browserstack.yml @@ -1,46 +1,45 @@ -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/PorcupineTestApp/**' - '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/PorcupineTestApp/**' - 'resources/.test/**' - 'resources/audio_samples/**' defaults: run: - working-directory: binding/android/PorcupineTestApp + working-directory: binding/android/PorcupineTestApp/ 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 @@ -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/Porcupine-Android" - --devices "Picovoice/android-min-max" - --app-path porcupine-test-app/build/outputs/apk/en/debug/porcupine-test-app-en-debug.apk - --test-series "porcupine-android" - --locale "en_US" - --build-dir porcupine-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 "Porcupine-Android" + --devices "android-min-max" + --app_path "porcupine-test-app/build/outputs/apk/en/debug/porcupine-test-app-en-debug.apk" + --test_path "porcupine-test-app/build/outputs/apk/androidTest/en/debug/porcupine-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 @@ -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/Porcupine-Android" - --devices "Picovoice/android-min-max" - --app-path porcupine-test-app/build/outputs/apk/en/release/porcupine-test-app-en-release.apk - --test-series "porcupine-android" - --locale "en_US" - --build-dir porcupine-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 "Porcupine-Android-Integration" + --devices "android-min-max" + --app_path "porcupine-test-app/build/outputs/apk/en/release/porcupine-test-app-en-release.apk" + --test_path "porcupine-test-app/build/outputs/apk/androidTest/en/release/porcupine-test-app-en-release-androidTest.apk" diff --git a/.github/workflows/ios-appcenter.yml b/.github/workflows/ios-appcenter.yml deleted file mode 100644 index 3503b7d852..0000000000 --- a/.github/workflows/ios-appcenter.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: iOS AppCenter Tests - -on: - workflow_dispatch: - push: - branches: [ master ] - paths: - - '.github/workflows/ios-appcenter.yml' - - 'binding/ios/PorcupineAppTest/**' - - 'resources/.test/**' - - 'resources/audio_samples/**' - pull_request: - branches: [ master, 'v[0-9]+.[0-9]+' ] - paths: - - '.github/workflows/ios-appcenter.yml' - - 'binding/ios/PorcupineAppTest/**' - - 'resources/.test/**' - - 'resources/audio_samples/**' - -defaults: - run: - working-directory: binding/ios/PorcupineAppTest - -jobs: - build: - name: Run iOS Tests on AppCenter - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up Node.js LTS - uses: actions/setup-node@v3 - with: - node-version: lts/* - - - name: Install Cocoapods - run: gem install cocoapods - - - name: Install AppCenter CLI - run: npm install -g appcenter-cli - - - name: Make build dir - run: mkdir ddp - - - name: Install resource script dependency - run: | - brew update - brew install convmv - - - name: Copy test_resources - run: ./copy_test_resources.sh - - - name: Run Cocoapods - run: pod install - - - name: Inject AppID - run: sed -i '.bak' 's:{TESTING_ACCESS_KEY_HERE}:${{secrets.PV_VALID_ACCESS_KEY}}:' - PorcupineAppTestUITests/BaseTest.swift - - - name: XCode Build - run: xcrun xcodebuild build-for-testing - -configuration Debug - -workspace PorcupineAppTest.xcworkspace - -sdk iphoneos - -scheme PorcupineAppTest - -derivedDataPath ddp - CODE_SIGNING_ALLOWED=NO - - - name: Run Tests on AppCenter - run: appcenter test run xcuitest - --token ${{secrets.APPCENTERAPITOKEN}} - --app "Picovoice/Porcupine-iOS" - --devices "Picovoice/ios-min-max" - --test-series "porcupine-ios" - --locale "en_US" - --build-dir ddp/Build/Products/Debug-iphoneos diff --git a/.github/workflows/ios-browserstack.yml b/.github/workflows/ios-browserstack.yml new file mode 100644 index 0000000000..b163674581 --- /dev/null +++ b/.github/workflows/ios-browserstack.yml @@ -0,0 +1,78 @@ +name: iOS BrowserStack Tests + +on: + workflow_dispatch: + push: + branches: [ master ] + paths: + - '.github/workflows/ios-browserstack.yml' + - 'binding/ios/PorcupineAppTest/**' + - 'resources/.test/**' + - 'resources/audio_samples/**' + pull_request: + branches: [ master, 'v[0-9]+.[0-9]+' ] + paths: + - '.github/workflows/ios-browserstack.yml' + - 'binding/ios/PorcupineAppTest/**' + - 'resources/.test/**' + - 'resources/audio_samples/**' + +defaults: + run: + working-directory: binding/ios/PorcupineAppTest + +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: Make build dir + run: mkdir ddp + + - name: Copy test_resources + run: ./copy_test_resources.sh + + - name: Inject AccessKey + run: sed -i '.bak' 's:{TESTING_ACCESS_KEY_HERE}:${{secrets.PV_VALID_ACCESS_KEY}}:' + PorcupineAppTestUITests/BaseTest.swift + + - name: XCode Build + run: xcrun xcodebuild build-for-testing + -configuration Debug + -project PorcupineAppTest.xcodeproj + -sdk iphoneos + -scheme PorcupineAppTest + -derivedDataPath ddp + CODE_SIGNING_ALLOWED=NO + + - name: Generating ipa + run: cd ddp/Build/Products/Debug-iphoneos/ && + mkdir Payload && + cp -r PorcupineAppTest.app Payload && + zip --symlinks -r PorcupineAppTest.ipa Payload && + rm -r Payload + + - name: Zipping Tests + run: cd ddp/Build/Products/Debug-iphoneos/ && + zip --symlinks -r PorcupineAppTestUITests.zip PorcupineAppTestUITests-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 "Porcupine-iOS" + --devices "ios-min-max" + --app_path "ddp/Build/Products/Debug-iphoneos/PorcupineAppTest.ipa" + --test_path "ddp/Build/Products/Debug-iphoneos/PorcupineAppTestUITests.zip" diff --git a/.github/workflows/ios-demos.yml b/.github/workflows/ios-demos.yml index a2365f1dcb..3aaebcfb81 100644 --- a/.github/workflows/ios-demos.yml +++ b/.github/workflows/ios-demos.yml @@ -52,16 +52,10 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Install Cocoapods - run: gem install cocoapods - - - name: Run Cocoapods - run: pod install - - name: Build run: xcrun xcodebuild build -configuration Debug - -workspace PorcupineBackgroundServiceDemo.xcworkspace + -project PorcupineBackgroundServiceDemo.xcodeproj -sdk iphoneos -scheme PorcupineBackgroundServiceDemo -derivedDataPath ddp diff --git a/.github/workflows/ios-perf.yml b/.github/workflows/ios-perf.yml index 2951485813..eaa1889f83 100644 --- a/.github/workflows/ios-perf.yml +++ b/.github/workflows/ios-perf.yml @@ -42,9 +42,6 @@ jobs: with: node-version: lts/* - - name: Install Cocoapods - run: gem install cocoapods - - name: Install AppCenter CLI run: npm install -g appcenter-cli @@ -59,9 +56,6 @@ jobs: - name: Copy test_resources run: ./copy_test_resources.sh - - name: Run Cocoapods - run: pod install - - name: Inject AppID run: sed -i '.bak' 's:{TESTING_ACCESS_KEY_HERE}:${{secrets.PV_VALID_ACCESS_KEY}}:' PerformanceTest/PerformanceTest.swift @@ -77,7 +71,7 @@ jobs: - name: XCode Build run: xcrun xcodebuild build-for-testing -configuration Debug - -workspace PorcupineAppTest.xcworkspace + -project PorcupineAppTest.xcodeproj -sdk iphoneos -scheme PerformanceTest -derivedDataPath ddp