onnxruntime/tools/ci_build/github/azure-pipelines/nodejs/templates/test.yml
Yulong Wang 3577a4bd02
[Node.js binding] Allow installation to download CUDA binaries via script (#20364)
### Description
Currently we try to include all prebuilt binaries into the NPM packages.
This was working until we added libonnxruntime_providers_cuda.so
(>400MB) into the NPM package. The NPM registry refuses to accept new
package publishment because the file is too large.

To make the new NPM package working, we have to remove the large file
from the package, and add a new script on package installation. This
script will try to dynamically install onnxruntime CUDA dynamic library
for Linux/x64.
2024-04-18 13:44:42 -07:00

40 lines
1.5 KiB
YAML

steps:
- checkout: none
- task: DownloadPipelineArtifact@0
displayName: 'Download NPM packages'
inputs:
artifactName: NPM_packages
targetPath: '$(Build.BinariesDirectory)/nodejs-artifact'
- script: mkdir e2e_test
workingDirectory: '$(Build.BinariesDirectory)'
- task: PowerShell@2
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
displayName: 'Extract package file name (Windows)'
inputs:
targetType: 'inline'
script: |
Write-Host "##vso[task.setvariable variable=NpmPackageFilesForTest;]$(ls $(Build.BinariesDirectory)/nodejs-artifact/*.tgz)"
workingDirectory: '$(Build.BinariesDirectory)/e2e_test'
- task: CmdLine@2
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
displayName: 'Extract package file name (POSIX)'
inputs:
script: |
# Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote.
set +x
echo "##vso[task.setvariable variable=NpmPackageFilesForTest;]`ls $(Build.BinariesDirectory)/nodejs-artifact/*.tgz | tr '\n' ' '`"
workingDirectory: '$(Build.BinariesDirectory)/e2e_test'
- script: |
npm init -y
npm install $(NpmPackageFilesForTest) --onnxruntime-node-install-cuda=skip
node -p "require('onnxruntime-node')"
workingDirectory: '$(Build.BinariesDirectory)/e2e_test'
- template: ../../templates/component-governance-component-detection-steps.yml
parameters :
condition : 'always'
- template: ../../templates/clean-agent-build-directory-step.yml