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 NodeJS #4

Merged
merged 11 commits into from
Apr 22, 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
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
Loading