mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-26 19:52:38 +00:00
178 lines
6.6 KiB
YAML
178 lines
6.6 KiB
YAML
parameters:
|
|
- name: NpmVersionSuffix
|
|
type: string
|
|
default: ''
|
|
|
|
- name: CommitOverride
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: BuildConfig
|
|
type: string
|
|
default: 'Debug'
|
|
|
|
jobs:
|
|
- job: build_onnxruntime_web
|
|
pool: 'Win-CPU-2019'
|
|
|
|
timeoutInMinutes: 30
|
|
workspace:
|
|
clean: all
|
|
steps:
|
|
- checkout: self
|
|
submodules: false
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
artifact: '__commit'
|
|
path: $(Pipeline.Workspace)
|
|
displayName: 'Get commit SHA'
|
|
condition: eq('${{ parameters.CommitOverride }}', 'true')
|
|
- script: |
|
|
set /p __commit__=<$(Pipeline.Workspace)\__commit.txt
|
|
git fetch origin +%__commit__%:refs/remotes/origin/%__commit__%
|
|
git checkout --force %__commit__%
|
|
workingDirectory: '$(Build.SourcesDirectory)'
|
|
displayName: 'Read commit SHA and checkout'
|
|
condition: eq('${{ parameters.CommitOverride }}', 'true')
|
|
- script: |
|
|
echo.$(Build.SourceVersion)>$(Pipeline.Workspace)\__commit.txt
|
|
workingDirectory: '$(Build.SourcesDirectory)'
|
|
displayName: 'Write commit SHA to __commit.txt'
|
|
condition: ne('${{ parameters.CommitOverride }}', 'true')
|
|
- script: |
|
|
git submodule sync -- cmake\external\onnx
|
|
git submodule update --init -- cmake\external\onnx
|
|
workingDirectory: '$(Build.SourcesDirectory)'
|
|
displayName: 'Checkout submodule onnx'
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '16.x'
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
patterns: '${{ parameters.BuildConfig }}_*/**/*'
|
|
path: $(Pipeline.Workspace)\artifacts
|
|
displayName: 'Download WebAssembly artifacts'
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: $(Pipeline.Workspace)\artifacts
|
|
contents: |
|
|
**\*.wasm
|
|
targetFolder: $(Build.SourcesDirectory)\js\web\dist
|
|
flattenFolders: true
|
|
displayName: 'Binplace dist files'
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: $(Pipeline.Workspace)\artifacts
|
|
contents: |
|
|
**\*.js
|
|
targetFolder: $(Build.SourcesDirectory)\js\web\lib\wasm\binding
|
|
flattenFolders: true
|
|
displayName: 'Binplace js files'
|
|
- script: |
|
|
npm ci
|
|
workingDirectory: '$(Build.SourcesDirectory)\js'
|
|
displayName: 'npm ci /js/'
|
|
- script: |
|
|
npm ci
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\common'
|
|
displayName: 'npm ci /js/common/'
|
|
- script: |
|
|
npm ci
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'npm ci /js/web/'
|
|
- script: |
|
|
npm run lint
|
|
workingDirectory: '$(Build.SourcesDirectory)\js'
|
|
displayName: 'ESLint'
|
|
- script: |
|
|
npm run format
|
|
workingDirectory: '$(Build.SourcesDirectory)\js'
|
|
displayName: 'Clang-format'
|
|
- script: |
|
|
node -e "a=require('child_process').execSync('git ls-files -m').toString();if(a)throw new Error('Following source files are not formatted: (did you run \"npm run format\"?)\n'+a)"
|
|
workingDirectory: '$(Build.SourcesDirectory)\js'
|
|
displayName: 'Check unformatted files'
|
|
- script: |
|
|
npm run build:doc
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'Generating documents'
|
|
- script: |
|
|
node -e "a=require('child_process').execSync('git ls-files -m').toString();if(a)throw new Error('Following documents are not up-to-date: (did you run \"npm run build:doc\"?)\n'+a)"
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'Check out of dated documents'
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: $(Pipeline.Workspace)
|
|
contents: __commit.txt
|
|
targetFolder: $(Build.SourcesDirectory)\js\common
|
|
displayName: 'Copy commit ID to js/common'
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: $(Pipeline.Workspace)
|
|
contents: __commit.txt
|
|
targetFolder: $(Build.SourcesDirectory)\js\web
|
|
displayName: 'Copy commit ID to js/web'
|
|
- script: |
|
|
set /p __ort_current_version__=<$(Build.SourcesDirectory)\VERSION_NUMBER
|
|
node -p "a=new Date().toISOString();YYYYMMDD=a.slice(0,4)+a.slice(5,7)+a.slice(8,10);REV=0;`${process.env.__ort_current_version__}${{ parameters.NpmVersionSuffix }}`" >$(Build.SourcesDirectory)\VERSION_NUMBER
|
|
python .\tools\python\update_version.py
|
|
workingDirectory: '$(Build.SourcesDirectory)'
|
|
displayName: 'update package version'
|
|
condition: ne('${{ parameters.NpmVersionSuffix }}', '')
|
|
- script: |
|
|
npm run build
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'Build ort-web'
|
|
- script: |
|
|
npm test
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'Run ort-web tests'
|
|
- script: |
|
|
npm test -- --webgl-texture-pack-mode -b=webgl
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'Run ort-web tests - WebGL: packed mode'
|
|
- script: |
|
|
npm test -- --wasm-enable-proxy -b=wasm
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'Run ort-web tests - WebAssembly: proxy'
|
|
- script: |
|
|
npm pack
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\common'
|
|
displayName: 'Generate NPM package (onnxruntime-common)'
|
|
condition: and(succeeded(), eq('${{ parameters.BuildConfig }}', 'Release'))
|
|
- script: |
|
|
npm pack
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'Generate NPM package (onnxruntime-web)'
|
|
condition: and(succeeded(), eq('${{ parameters.BuildConfig }}', 'Release'))
|
|
- script: |
|
|
npm run test:e2e
|
|
workingDirectory: '$(Build.SourcesDirectory)\js\web'
|
|
displayName: 'E2E package consuming test'
|
|
condition: and(succeeded(), eq('${{ parameters.BuildConfig }}', 'Release'))
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: $(Build.SourcesDirectory)\js\common
|
|
contents: onnxruntime-common-*.tgz
|
|
targetFolder: $(Build.ArtifactStagingDirectory)
|
|
displayName: 'Create Artifacts (onnxruntime-common)'
|
|
condition: and(succeeded(), eq('${{ parameters.BuildConfig }}', 'Release'))
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
sourceFolder: $(Build.SourcesDirectory)\js\web
|
|
contents: onnxruntime-web-*.tgz
|
|
targetFolder: $(Build.ArtifactStagingDirectory)
|
|
displayName: 'Create Artifacts (onnxruntime-web)'
|
|
condition: and(succeeded(), eq('${{ parameters.BuildConfig }}', 'Release'))
|
|
- task: PublishPipelineArtifact@0
|
|
inputs:
|
|
artifactName: 'NPM_packages'
|
|
targetPath: '$(Build.ArtifactStagingDirectory)'
|
|
displayName: 'Publish Pipeline Artifact'
|
|
condition: and(succeeded(), eq('${{ parameters.BuildConfig }}', 'Release'))
|
|
- template: component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|
|
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
|
displayName: 'Clean Agent Directories'
|
|
condition: always()
|