diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 000000000..ed62b35a1 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,36 @@ +name: Node.js CI +permissions: + contents: read + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + # Test against multiple Node.js versions + node-version: [20.x, 22.x, 24.x] + arch: [x64] + include: + - os: ubuntu-latest + arch: arm64 + steps: + - uses: actions/checkout@v5 + - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.arch }} + uses: actions/setup-node@v5 + with: + node-version: ${{ matrix.node-version }} + architecture: ${{ matrix.arch }} + - name: Install dependencies + run: npm install + working-directory: js/quick-start_onnxruntime-node + + - name: Run the example + run: node . + working-directory: js/quick-start_onnxruntime-node \ No newline at end of file diff --git a/js/api-usage_inference-session/package.json b/js/api-usage_inference-session/package.json index 1b3878760..5f52e2ef3 100644 --- a/js/api-usage_inference-session/package.json +++ b/js/api-usage_inference-session/package.json @@ -5,6 +5,6 @@ "description": "This example is a demonstration of basic usage of InferenceSession.", "main": "index.js", "dependencies": { - "onnxruntime-node": "^1.15.1" + "onnxruntime-node": "^1.23.0" } } diff --git a/js/api-usage_tensor/package.json b/js/api-usage_tensor/package.json index 7ec3613d7..e9a2e40f3 100644 --- a/js/api-usage_tensor/package.json +++ b/js/api-usage_tensor/package.json @@ -4,6 +4,6 @@ "version": "1.0.0", "description": "This example is a demonstration of basic usage of Tensor.", "dependencies": { - "onnxruntime-node": "^1.15.1" + "onnxruntime-node": "^1.23.0" } } diff --git a/js/quick-start_onnxruntime-node-bundler/package.json b/js/quick-start_onnxruntime-node-bundler/package.json index 916dbb992..d9bda191d 100644 --- a/js/quick-start_onnxruntime-node-bundler/package.json +++ b/js/quick-start_onnxruntime-node-bundler/package.json @@ -8,7 +8,7 @@ "dev": "webpack --config ./webpack.config.js --mode development" }, "dependencies": { - "onnxruntime-node": "^1.15.1" + "onnxruntime-node": "^1.23.0" }, "devDependencies": { "copy-webpack-plugin": "^8.1.1", diff --git a/js/quick-start_onnxruntime-node/index.js b/js/quick-start_onnxruntime-node/index.js index 962d3d48c..42ebb63c0 100644 --- a/js/quick-start_onnxruntime-node/index.js +++ b/js/quick-start_onnxruntime-node/index.js @@ -29,6 +29,7 @@ async function main() { const dataC = results.c.data; console.log(`data of result tensor 'c': ${dataC}`); + await session.release() } catch (e) { console.error(`failed to inference ONNX model: ${e}.`); } diff --git a/js/quick-start_onnxruntime-node/package.json b/js/quick-start_onnxruntime-node/package.json index ca1a4a5cd..4ff661658 100644 --- a/js/quick-start_onnxruntime-node/package.json +++ b/js/quick-start_onnxruntime-node/package.json @@ -5,6 +5,6 @@ "description": "This example is a demonstration of basic usage of ONNX Runtime Node.js binding.", "main": "index.js", "dependencies": { - "onnxruntime-node": "^1.15.1" + "onnxruntime-node": "^1.23.0" } }