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

Initial Android #2

Merged
merged 14 commits into from
Apr 16, 2024
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
39 changes: 39 additions & 0 deletions .github/workflows/android-demos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Android Demos

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '.github/workflows/android-demos.yml'
- 'demo/android/**'
- '!demo/android/Activity/README.md'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/android-demos.yml'
- 'demo/android/**'
- '!demo/android/Activity/README.md'

jobs:
build-activity-demo:
runs-on: ubuntu-latest
defaults:
run:
working-directory: demo/android/Activity

steps:
- uses: actions/checkout@v3

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

- name: Build binding
run: ./gradlew assembleRelease
working-directory: binding/android/PicoLLM

- name: Build
run: ./gradlew assembleDebug
52 changes: 52 additions & 0 deletions .github/workflows/android-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Android Tests

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '.github/workflows/android-tests.yml'
- 'binding/android/PicoLLM/**'
- '!binding/android/PicoLLM/README.md'
- 'binding/android/PicoLLMTestApp/**'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+']
paths:
- '.github/workflows/android-tests.yml'
- 'binding/android/PicoLLM/**'
- '!binding/android/PicoLLM/README.md'
- 'binding/android/PicoLLMTestApp/**'

defaults:
run:
working-directory: binding/android/PicoLLMTestApp

jobs:
build:
name: Run Android Tests
runs-on: pv-android

steps:
- uses: actions/checkout@v3

- name: Build binding
run: ./gradlew assembleRelease
working-directory: binding/android/PicoLLM

- name: Download resource files
run: curl http://${{secrets.PV_CICD_RES_SERVER_AUTHORITY}}/github/picollm/res/phi2-290.bin/latest/phi2-290.bin -o phi2-290.bin

- name: Copy resource files
run: ~/Android/Sdk/platform-tools/adb push --sync phi2-290.bin /sdcard/Android/data/ai.picovoice.picollm.testapp/files/external/test_resources/phi2-290.bin

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

- name: Inject Android keystore variables
run: echo pvTestingModelName="phi2-290.bin" >> local.properties

- name: Build androidTest
run: ./gradlew assembleDebugAndroidTest

- name: Run tests
run: ./gradlew connectedAndroidTest --info
28 changes: 28 additions & 0 deletions .github/workflows/java-codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Java CodeStyle

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '**/*.java'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '**/*.java'

jobs:
check-java-codestyle:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: Check Java CodeStyle
run: java -Dconfig_loc=resources/.lint/java/ -jar resources/.lint/java/checkstyle-10.5.0-all.jar -c resources/.lint/java/checkstyle.xml binding/android/ demo/android/
12 changes: 12 additions & 0 deletions binding/android/PicoLLM/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.iml
.gradle
/local.properties
/.idea/
.DS_Store
/build
/captures
test_resources
.settings
.classpath
.project
publish-mavencentral.gradle
25 changes: 25 additions & 0 deletions binding/android/PicoLLM/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ext {
defaultTargetSdkVersion = 31
}

buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
}
}

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

tasks.register('clean', Delete) {
delete rootProject.buildDir
}
17 changes: 17 additions & 0 deletions binding/android/PicoLLM/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,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading