Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android test app #26

Merged
merged 3 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 71 additions & 11 deletions .github/workflows/android-appcenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@ on:
branches: [ main ]
paths:
- '.github/workflows/android-appcenter.yml'
- 'demo/android/Activity/**'
- '!demo/android/Activity/README.md'
- 'binding/android/KoalaTestApp/**'
- 'resources/audio_samples/**'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+']
paths:
- '.github/workflows/android-appcenter.yml'
- 'demo/android/Activity/**'
- '!demo/android/Activity/README.md'
- 'binding/android/KoalaTestApp/**'
- 'resources/audio_samples/**'

defaults:
run:
working-directory: demo/android/Activity
working-directory: binding/android/KoalaTestApp

jobs:
build:
Expand All @@ -43,16 +41,22 @@ jobs:
java-version: '11'
distribution: 'temurin'

- name: Binding pre-build
run: ./gradlew assemble
working-directory: binding/android

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

- name: Inject AccessKey
run: echo pvTestingAccessKey="${{secrets.PV_VALID_ACCESS_KEY}}" >> local.properties

- name: Inject Android keystore variables
run: |
echo storePassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
echo keyPassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
echo keyAlias=picovoice >> local.properties
echo storeFile=../picovoice.jks >> local.properties

- name: Setup Android keystore file
run: echo "${{secrets.ANDROID_RELEASE_KEYSTORE_FILE_B64}}" | base64 -d > picovoice.jks

- name: Build app
run: ./gradlew assembleDebug

Expand All @@ -64,7 +68,63 @@ jobs:
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Koala-Android"
--devices "Picovoice/android-min-max"
--app-path koala-activity-demo-app/build/outputs/apk/debug/koala-activity-demo-app-debug.apk
--app-path koala-test-app/build/outputs/apk/debug/koala-test-app-debug.apk
--test-series "koala-android"
--locale "en_US"
--build-dir koala-test-app/build/outputs/apk/androidTest/debug

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

steps:
- uses: actions/checkout@v3

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

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

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

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

- name: Inject AccessKey
run: echo pvTestingAccessKey="${{secrets.PV_VALID_ACCESS_KEY}}" >> local.properties

- name: Inject Android keystore variables
run: |
echo storePassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
echo keyPassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
echo keyAlias=picovoice >> local.properties
echo storeFile=../picovoice.jks >> local.properties

- name: Setup Android keystore file
run: echo "${{secrets.ANDROID_RELEASE_KEYSTORE_FILE_B64}}" | base64 -d > picovoice.jks

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build app
run: ./gradlew assembleRelease

- name: Build androidTest
run: ./gradlew assembleReleaseAndroidTest -DtestBuildType=integ

- name: Run tests on AppCenter
run: appcenter test run espresso
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Koala-Android"
--devices "Picovoice/android-min-max"
--app-path koala-test-app/build/outputs/apk/release/koala-test-app-release.apk
--test-series "koala-android"
--locale "en_US"
--build-dir koala-activity-demo-app/build/outputs/apk/androidTest/debug
--build-dir koala-test-app/build/outputs/apk/androidTest/release
18 changes: 14 additions & 4 deletions .github/workflows/android-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:

defaults:
run:
working-directory: demo/android/Activity
working-directory: binding/android/KoalaTestApp

jobs:
build:
Expand Down Expand Up @@ -58,6 +58,16 @@ jobs:
- name: Inject AccessKey
run: echo pvTestingAccessKey="${{secrets.PV_VALID_ACCESS_KEY}}" >> local.properties

- name: Inject Android keystore variables
run: |
echo storePassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
echo keyPassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
echo keyAlias=picovoice >> local.properties
echo storeFile=../picovoice.jks >> local.properties

- name: Setup Android keystore file
run: echo "${{secrets.ANDROID_RELEASE_KEYSTORE_FILE_B64}}" | base64 -d > picovoice.jks

- name: Inject Number of Iterations
run: echo numTestIterations="30" >> local.properties

Expand All @@ -71,15 +81,15 @@ jobs:
run: ./gradlew assembleDebug

- name: Build androidTest
run: ./gradlew assembleAndroidTest
run: ./gradlew assembleAndroidTest -DtestBuildType=perf

- name: Run tests on AppCenter
run: appcenter test run espresso
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Koala-Android"
--devices "Picovoice/${{ matrix.device }}"
--app-path koala-activity-demo-app/build/outputs/apk/debug/koala-activity-demo-app-debug.apk
--app-path koala-test-app/build/outputs/apk/debug/koala-test-app-debug.apk
--test-series "koala-android"
--locale "en_US"
--build-dir koala-activity-demo-app/build/outputs/apk/androidTest/debug
--build-dir koala-test-app/build/outputs/apk/androidTest/debug

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions binding/android/KoalaTestApp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.iml
.gradle
/local.properties
/.idea/
.DS_Store
/build
/captures
.externalNativeBuild
release
test_resources

*.pv
*.wav

*.jks
!.dummy.jks
28 changes: 28 additions & 0 deletions binding/android/KoalaTestApp/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
defaultTargetSdkVersion = 31
}

buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
9 changes: 9 additions & 0 deletions binding/android/KoalaTestApp/copy_test_resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if [ ! -d "./koala-test-app/src/androidTest/assets/test_resources/audio" ]
then
echo "Creating test audio samples directory..."
mkdir -p ./koala-test-app/src/androidTest/assets/test_resources/audio
fi

echo "Copying test audio samples..."
cp ../../../resources/audio_samples/test.wav ./koala-test-app/src/androidTest/assets/test_resources/audio/test.wav
cp ../../../resources/audio_samples/noise.wav ./koala-test-app/src/androidTest/assets/test_resources/audio/noise.wav
17 changes: 17 additions & 0 deletions binding/android/KoalaTestApp/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Tue Jun 29 23:02:09 PDT 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading