Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
laves committed Feb 7, 2024
1 parent db70896 commit 16c2e27
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 12 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ on:
push:
branches: [ main ]
paths:
- '.github/workflows/example.yml'
- 'example/**'
- '**'
- '!example/README.md'
- '!README.md'
- '!test/**'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/example.yml'
- 'example/**'
- '**'
- '!example/README.md'
- '!README.md'
- '!test/**'

jobs:
build-android:
Expand All @@ -22,6 +24,19 @@ jobs:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
include:
- node-version: 16.x
gradle-version: 6.5
agp-version: 4.1.3
java-version: 11
- node-version: 18.x
gradle-version: 7.5
agp-version: 7.4.2
java-version: 11
- node-version: 20.x
gradle-version: 8.2
agp-version: 8.2.2
java-version: 17

steps:
- uses: actions/checkout@v3
Expand All @@ -31,12 +46,28 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Pre-build dependencies
run: npm install yarn
- name: Use JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'

- name: Use Gradle ${{ matrix.gradle-version }}
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ matrix.gradle-version }}

- name: Inject AGP version
run: echo agpVersion="${{ matrix.agp-version }}" >> local.properties
working-directory: example/android

- name: Install dependencies
run: yarn bootstrap

- name: Generate gradle wrapper
run: gradle wrapper --gradle-version ${{ matrix.gradle-version }} --distribution-type all
working-directory: example/android

- name: Build bundle
run: yarn example android-bundle

Expand All @@ -59,9 +90,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Pre-build dependencies
run: npm install yarn

- name: Install dependencies
run: yarn bootstrap

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
paths:
- '**'
- '!README.md'
- '!example/README.md'
- '!example/**'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '**'
- '!README.md'
- '!example/README.md'
- '!example/**'

defaults:
run:
Expand Down
10 changes: 10 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ def reactNativeArchitectures() {
}

android {
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
namespace "ai.picovoice.reactnative.voiceprocessorexample"
}

if (agpVersion.tokenize('.')[0].toInteger() >= 8) {
buildFeatures {
buildConfig = true
}
}
compileSdk rootProject.ext.compileSdkVersion

namespace "ai.picovoice.reactnative.voiceprocessorexample"
Expand Down
16 changes: 15 additions & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@ buildscript {
google()
mavenCentral()
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def agpVersion = localProperties.getProperty('agpVersion')
if (agpVersion == null) {
agpVersion = '7.4.2'
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "com.android.tools.build:gradle:$agpVersion"
classpath 'com.facebook.react:react-native-gradle-plugin'
}
}

0 comments on commit 16c2e27

Please sign in to comment.