onnxruntime/tools/ci_build/github/azure-pipelines/templates/linux-web-init-and-check.yml
Yulong Wang 5af8774a0b
[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>
2023-08-04 16:44:45 -07:00

41 lines
1.5 KiB
YAML

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'