Skip to content

Commit 4b2e579

Browse files
committed
v4.0 Web binding & demo
1 parent 0b3ed00 commit 4b2e579

31 files changed

+731
-468
lines changed

.github/workflows/react-codestyle.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ jobs:
3131
with:
3232
node-version: lts/*
3333

34-
- name: Pre-build dependencies
35-
run: npm install yarn
36-
3734
- name: Run Binding Linter
3835
run: yarn && yarn lint
3936
working-directory: binding/react

.github/workflows/react-demos.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
matrix:
2828
os: [ ubuntu-latest, windows-latest, macos-latest ]
29-
node-version: [ 16.x, 18.x, 20.x ]
29+
node-version: [ 18.x, 20.x, 22.x, 24.x ]
3030

3131
steps:
3232
- uses: actions/checkout@v3
@@ -36,8 +36,15 @@ jobs:
3636
with:
3737
node-version: ${{ matrix.node-version }}
3838

39-
- name: Pre-build dependencies
40-
run: npm install yarn
39+
# ************** REMOVE AFTER RELEASE ********************
40+
- name: Build Web SDK
41+
run: yarn install && yarn copywasm && yarn copyppn && yarn build
42+
working-directory: binding/web
43+
44+
- name: Install dependencies
45+
run: yarn install && yarn build
46+
working-directory: binding/react
47+
# ************** REMOVE AFTER RELEASE ********************
4148

4249
- name: Install dependencies
4350
run: yarn install

.github/workflows/react.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929

3030
strategy:
3131
matrix:
32-
node-version: [16.x, 18.x, 20.x]
32+
device: [ cpu:1, cpu ]
33+
node-version: [ 18.x, 20.x, 22.x, 24.x ]
3334

3435
steps:
3536
- uses: actions/checkout@v3
@@ -39,8 +40,11 @@ jobs:
3940
with:
4041
node-version: ${{ matrix.node-version }}
4142

42-
- name: Pre-build dependencies
43-
run: npm install yarn
43+
# ************** REMOVE AFTER RELEASE ********************
44+
- name: Build Web SDK
45+
run: yarn install && yarn copywasm && yarn copyppn && yarn build
46+
working-directory: binding/web
47+
# ************** REMOVE AFTER RELEASE ********************
4448

4549
- name: Install dependencies
4650
run: yarn install
@@ -55,4 +59,4 @@ jobs:
5559
run: yarn setup-test
5660

5761
- name: Run test
58-
run: yarn test --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}}
62+
run: yarn test --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},DEVICE=${{ matrix.device }}

.github/workflows/web-codestyle.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ on:
55
push:
66
branches: [ master ]
77
paths:
8-
- '**/web/*.js'
9-
- '**/web/*.ts'
8+
- 'binding/web/*.js'
9+
- 'binding/web/*.ts'
1010
- '.github/workflows/web-codestyle.yml'
1111
pull_request:
1212
branches: [ master, 'v[0-9]+.[0-9]+' ]
1313
paths:
14-
- '**/web/*.js'
15-
- '**/web/*.ts'
14+
- 'binding/web/*.js'
15+
- 'binding/web/*.ts'
1616
- '.github/workflows/web-codestyle.yml'
1717

1818
jobs:
@@ -27,9 +27,6 @@ jobs:
2727
with:
2828
node-version: lts/*
2929

30-
- name: Pre-build dependencies
31-
run: npm install yarn
32-
3330
- name: Run Binding Linter
3431
run: yarn && yarn lint
3532
working-directory: binding/web

.github/workflows/web-demos.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
strategy:
2727
matrix:
28-
node-version: [18.x, 20.x, 22.x]
28+
node-version: [18.x, 20.x, 22.x, 24.x]
2929

3030
steps:
3131
- uses: actions/checkout@v3
@@ -35,8 +35,11 @@ jobs:
3535
with:
3636
node-version: ${{ matrix.node-version }}
3737

38-
- name: Pre-build dependencies
39-
run: npm install yarn
38+
# ************** REMOVE AFTER RELEASE ********************
39+
- name: Build Web SDK
40+
run: yarn install && yarn copywasm && yarn copyppn && yarn build
41+
working-directory: binding/web
42+
# ************** REMOVE AFTER RELEASE ********************
4043

4144
- name: Install dependencies
4245
run: yarn install

.github/workflows/web-perf.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ jobs:
3939
with:
4040
node-version: ${{ matrix.node-version }}
4141

42-
- name: Pre-build dependencies
43-
run: npm install yarn
44-
4542
- name: Install dependencies
4643
run: yarn install
4744

@@ -55,4 +52,4 @@ jobs:
5552
run: yarn setup-test
5653

5754
- name: Test
58-
run: yarn test-perf --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},NUM_TEST_ITERATIONS=20,INIT_PERFORMANCE_THRESHOLD_SEC=${{matrix.initPerformanceThresholdSec}},PROC_PERFORMANCE_THRESHOLD_SEC=${{matrix.procPerformanceThresholdSec}}
55+
run: yarn test-perf --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},DEVICE=cpu:1,NUM_TEST_ITERATIONS=20,INIT_PERFORMANCE_THRESHOLD_SEC=${{matrix.initPerformanceThresholdSec}},PROC_PERFORMANCE_THRESHOLD_SEC=${{matrix.procPerformanceThresholdSec}}

.github/workflows/web.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535

3636
strategy:
3737
matrix:
38-
node-version: [16.x, 18.x, 20.x]
38+
device: [ cpu:1, cpu ]
39+
node-version: [18.x, 20.x, 22.x, 24.x]
3940

4041
steps:
4142
- uses: actions/checkout@v3
@@ -45,9 +46,6 @@ jobs:
4546
with:
4647
node-version: ${{ matrix.node-version }}
4748

48-
- name: Pre-build dependencies
49-
run: npm install yarn
50-
5149
- name: Install dependencies
5250
run: yarn install
5351

@@ -61,4 +59,4 @@ jobs:
6159
run: yarn setup-test
6260

6361
- name: Test
64-
run: yarn test --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}}
62+
run: yarn test --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},DEVICE=${{ matrix.device }}

binding/react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@picovoice/rhino-react",
3-
"version": "3.0.3",
3+
"version": "4.0.0",
44
"description": "React component for Rhino Web SDK",
55
"entry": "src/index.ts",
66
"module": "dist/esm/index.js",
@@ -73,6 +73,6 @@
7373
"react-dom": ">=17"
7474
},
7575
"dependencies": {
76-
"@picovoice/rhino-web": "=3.0.3"
76+
"@picovoice/rhino-web": "file:../web"
7777
}
7878
}

binding/react/test/use_rhino.test.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import rhinoParams from '@/rhino_params.js';
77
import testData from './test_data.json';
88

99
const ACCESS_KEY = Cypress.env('ACCESS_KEY');
10+
const DEVICE = Cypress.env('DEVICE');
1011

1112
describe('Rhino binding', () => {
1213
it('should be able to init via public path', () => {
@@ -16,7 +17,8 @@ describe('Rhino binding', () => {
1617
() => result.current.init(
1718
ACCESS_KEY,
1819
{ publicPath: "/test/contexts/coffee_maker_wasm.rhn", forceWrite: true },
19-
{ publicPath: "/test/rhino_params.pv", forceWrite: true }
20+
{ publicPath: "/test/rhino_params.pv", forceWrite: true },
21+
{ device: DEVICE }
2022
)
2123
).then(() => {
2224
expect(result.current.isLoaded).to.be.true;
@@ -36,7 +38,8 @@ describe('Rhino binding', () => {
3638
() => result.current.init(
3739
ACCESS_KEY,
3840
{ publicPath: "/test/contexts/coffee_maker_wasm.rhn", forceWrite: true },
39-
{ base64: rhinoParams, forceWrite: true }
41+
{ base64: rhinoParams, forceWrite: true },
42+
{ device: DEVICE }
4043
)
4144
).then(() => {
4245
expect(result.current.isLoaded).to.be.true;
@@ -50,7 +53,8 @@ describe('Rhino binding', () => {
5053
() => result.current.init(
5154
ACCESS_KEY,
5255
{ publicPath: "/test/contexts/coffee_maker_wasm.rhn", forceWrite: true },
53-
{ publicPath: "/rhino_params_failed.pv", forceWrite: true }
56+
{ publicPath: "/rhino_params_failed.pv", forceWrite: true },
57+
{ device: DEVICE }
5458
)
5559
).then(() => {
5660
expect(result.current.isLoaded).to.be.false;
@@ -65,7 +69,8 @@ describe('Rhino binding', () => {
6569
() => result.current.init(
6670
'',
6771
{ publicPath: "/test/contexts/coffee_maker_wasm.rhn", forceWrite: true },
68-
{ publicPath: "/test/rhino_params.pv", forceWrite: true }
72+
{ publicPath: "/test/rhino_params.pv", forceWrite: true },
73+
{ device: DEVICE }
6974
)
7075
).then(() => {
7176
expect(result.current.isLoaded).to.be.false;
@@ -87,7 +92,8 @@ describe('Rhino binding', () => {
8792
{
8893
publicPath: testInfo.language === 'en' ? "/test/rhino_params.pv" : `/test/rhino_params_${testInfo.language}.pv`,
8994
forceWrite: true,
90-
}
95+
},
96+
{ device: DEVICE }
9197
)
9298
).then(() => {
9399
expect(result.current.isLoaded).to.be.true;
@@ -124,7 +130,8 @@ describe('Rhino binding', () => {
124130
{
125131
publicPath: testInfo.language === 'en' ? "/test/rhino_params.pv" : `/test/rhino_params_${testInfo.language}.pv`,
126132
forceWrite: true,
127-
}
133+
},
134+
{ device: DEVICE }
128135
)
129136
).then(() => {
130137
expect(result.current.isLoaded).to.be.true;

binding/web/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
node_modules
22
dist
3-
lib/pv_rhino*.wasm
3+
src/lib/*
44
src/rhino_64.ts
55
contexts/*.rhn
66
test/contexts/*.rhn

0 commit comments

Comments
 (0)