Skip to content

Commit

Permalink
Merge pull request #4 from Picovoice/initial-node
Browse files Browse the repository at this point in the history
Initial NodeJS
  • Loading branch information
ErisMik authored Apr 22, 2024
2 parents 4a2f2ef + ae3ce17 commit f25673a
Show file tree
Hide file tree
Showing 41 changed files with 5,440 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/nodejs-codesyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Node.js Codestyle

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '**/nodejs/*.js'
- '**/nodejs/*.ts'
- '.github/workflows/nodejs-codestyle.yml'
pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '**/nodejs/*.js'
- '**/nodejs/*.ts'
- '.github/workflows/nodejs-codestyle.yml'

jobs:
check-nodejs-codestyle:
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: Pre-build dependencies
run: npm install yarn

- name: Run Binding Linter
run: yarn && yarn lint
working-directory: binding/nodejs
52 changes: 52 additions & 0 deletions .github/workflows/nodejs-demos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Node.js Demos

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'demo/nodejs/**'
- 'demo/expressjs/**'
- '!demo/nodejs/README.md'
- '!demo/expressjs/README.md'
- 'lib/node/**'
- '.github/workflows/nodejs-demos.yml'

pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- 'demo/nodejs/**'
- 'demo/expressjs/**'
- '!demo/nodejs/README.md'
- '!demo/expressjs/README.md'
- 'lib/node/**'
- '.github/workflows/nodejs-demos.yml'

defaults:
run:
working-directory: demo/nodejs

jobs:
build-self-hosted:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows]

steps:
- uses: actions/checkout@v3

- name: Install and build Node Binding
run: yarn && yarn build
working-directory: binding/nodejs

- name: Install dependencies
run: yarn install

- 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: Test
run: yarn generate --access_key ${{secrets.PV_VALID_ACCESS_KEY}} --model_file_path phi2-290.bin --completion_token_limit 10 --generate "Hello my name is"
48 changes: 48 additions & 0 deletions .github/workflows/nodejs-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Node.js Tests

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '.github/workflows/nodejs.yml'
- 'binding/nodejs/**'
- '!binding/nodejs/README.md'
- 'lib/common/**'
- 'lib/node/**'
- 'resources/.test/**'

pull_request:
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/nodejs.yml'
- 'binding/nodejs/**'
- '!binding/nodejs/README.md'
- 'lib/common/**'
- 'lib/node/**'
- 'resources/.test/**'

defaults:
run:
working-directory: binding/nodejs

jobs:
build-self-hosted:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows]

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: yarn install

- 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: Test
run: yarn test test/index.test.ts --access_key=${{secrets.PV_VALID_ACCESS_KEY}}
5 changes: 5 additions & 0 deletions binding/nodejs/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
lib
resources
.eslintrc.js
Loading

0 comments on commit f25673a

Please sign in to comment.