mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-19 19:00:47 +00:00
[build] do init and precheck first (#16961)
### Description
This change allows Web CI to do some check as the first step, so that if
there are errors it won't launch the task to build web assembly, which
is heavy.
Checks includes:
- "npm ci" in /js, /js/common and /js/web. this implicitly include:
- typescript compiler in /js
- typescript compiler in /js/common
- webpack build in /js/common
- typescript compiler in /js/web
- ESLint on typescripts
- clang-format formatter (.js, .ts, .cc, .h, .mm)
- Prettier formatter (.json, .jsonc, .md)
---------
Co-authored-by: Caroline Zhu <carolinezhu@microsoft.com@orttrainingdev7.d32nl1ml4oruzj4qz3bqlggovf.px.internal.cloudapp.net>
This commit is contained in:
parent
fc8003349e
commit
5af8774a0b
3 changed files with 59 additions and 47 deletions
|
|
@ -82,46 +82,7 @@ jobs:
|
|||
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 run lint
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js'
|
||||
displayName: 'run ESLint without TS type populated'
|
||||
- script: |
|
||||
npm ci
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js/common'
|
||||
displayName: 'npm ci /js/common/'
|
||||
- script: |
|
||||
npm test
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js/common'
|
||||
displayName: 'run onnxruntime-common tests'
|
||||
- script: |
|
||||
npm ci
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js/web'
|
||||
displayName: 'npm ci /js/web/'
|
||||
- script: |
|
||||
npm run lint
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js'
|
||||
displayName: 'run ESLint'
|
||||
- script: |
|
||||
npm run format
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js'
|
||||
displayName: 'Clang-format'
|
||||
- script: |
|
||||
node -e "a=require('child_process').execSync('git diff --name-only').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 diff --name-only').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'
|
||||
- template: linux-web-init-and-check.yml
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: onnxtestdata | $(Build.SourcesDirectory)\js\scripts\prepare-onnx-node-tests.ts
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
steps:
|
||||
- script: |
|
||||
npm ci
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js'
|
||||
displayName: 'npm ci /js/'
|
||||
- script: |
|
||||
npm run lint
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js'
|
||||
displayName: 'run ESLint without TS type populated'
|
||||
- script: |
|
||||
npm ci
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js/common'
|
||||
displayName: 'npm ci /js/common/'
|
||||
- script: |
|
||||
npm test
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js/common'
|
||||
displayName: 'run onnxruntime-common tests'
|
||||
- script: |
|
||||
npm ci
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js/web'
|
||||
displayName: 'npm ci /js/web/'
|
||||
- script: |
|
||||
npm run lint
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js'
|
||||
displayName: 'run ESLint'
|
||||
- script: |
|
||||
npm run format
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js'
|
||||
displayName: 'Clang-format'
|
||||
- script: |
|
||||
node -e "a=require('child_process').execSync('git diff --name-only').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 diff --name-only').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'
|
||||
|
|
@ -48,9 +48,9 @@ parameters:
|
|||
default: false
|
||||
|
||||
stages:
|
||||
- stage: Extract_commit
|
||||
- stage: Precheck_and_extract_commit
|
||||
jobs:
|
||||
- job: Extract_commit
|
||||
- job: Precheck_and_extract_commit
|
||||
pool: ${{ parameters.PoolName }}
|
||||
variables:
|
||||
runCodesignValidationInjection: false
|
||||
|
|
@ -58,23 +58,33 @@ stages:
|
|||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- checkout: none
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
submodules: false
|
||||
- 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'
|
||||
- template: linux-web-init-and-check.yml
|
||||
- task: Bash@3
|
||||
displayName: 'Extract commit SHA and save to __commit.txt'
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
echo $(Build.SourceVersion)
|
||||
echo $(Build.SourceVersion) > "$(Build.ArtifactStagingDirectory)"/__commit.txt
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline Artifact'
|
||||
displayName: 'Publish __commit.txt'
|
||||
inputs:
|
||||
artifactName: '__commit'
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- stage: Build_wasm_Debug
|
||||
dependsOn: Extract_commit
|
||||
dependsOn: Precheck_and_extract_commit
|
||||
jobs:
|
||||
- template: ${{ parameters.WASMTemplate }}
|
||||
parameters:
|
||||
|
|
@ -100,7 +110,7 @@ stages:
|
|||
PackageName: ${{ parameters.PackageName }}
|
||||
|
||||
- stage: Build_wasm_Release
|
||||
dependsOn: Extract_commit
|
||||
dependsOn: Precheck_and_extract_commit
|
||||
jobs:
|
||||
- template: ${{ parameters.WASMTemplate }}
|
||||
parameters:
|
||||
|
|
@ -113,7 +123,7 @@ stages:
|
|||
|
||||
- ${{ if eq(parameters.BuildStaticLib, 'true') }}:
|
||||
- stage: Build_wasm_Release_static_library
|
||||
dependsOn: Extract_commit
|
||||
dependsOn: Precheck_and_extract_commit
|
||||
jobs:
|
||||
- template: ${{ parameters.WASMTemplate }}
|
||||
parameters:
|
||||
|
|
|
|||
Loading…
Reference in a new issue