Skip to content

Commit

Permalink
android test app
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Aug 17, 2023
1 parent ff05b24 commit 57ae95a
Show file tree
Hide file tree
Showing 64 changed files with 1,171 additions and 72 deletions.
83 changes: 67 additions & 16 deletions .github/workflows/android-appcenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,66 @@ 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/KoalaTestAppy/**'
- 'resources/audio_samples/**'

defaults:
run:
working-directory: demo/android/Activity
working-directory: binding/
- '!demo/android/Activity/README.md'
- 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: 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

jobs:
build:
name: Run Android Tests on AppCenter
- name: Build app
run: ./gradlew assembleDebug

- name: Build androidTest
run: ./gradlew assembleAndroidTest

- 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/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:
Expand All @@ -43,28 +85,37 @@ 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: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build app
run: ./gradlew assembleDebug
run: ./gradlew assembleRelease

- name: Build androidTest
run: ./gradlew assembleAndroidTest
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-activity-demo-app/build/outputs/apk/debug/koala-activity-demo-app-debug.apk
--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-activity-test-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.
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

0 comments on commit 57ae95a

Please sign in to comment.