Use pipeline cache to cache onnx node test data. (#16659)

### Description
Use pipeline cache instead of reading data from the image.


### Motivation and Context
1. To reduce the browser dependency of custom image.
2. The onnx node test data is less than 30M and the cache download time
is very short.
This commit is contained in:
Yi Zhang 2023-07-13 09:26:27 +08:00 committed by GitHub
parent 111382746e
commit f3b40abe29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 18 deletions

View file

@ -30,6 +30,9 @@ jobs:
workspace:
clean: all
steps:
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()
- checkout: self
submodules: false
- task: DownloadPipelineArtifact@2
@ -115,12 +118,14 @@ jobs:
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'
- script: |
if [[ -e "/data/onnx/test/data/node/__generated_onnx_node_tests" ]] then
cp -r /data/onnx/test/ $(Build.SourcesDirectory)/js/test/
fi
workingDirectory: '$(Build.SourcesDirectory)/js/web'
displayName: 'Copy pre-downloaded test data'
- task: Cache@2
inputs:
key: onnxtestdata | $(Build.SourcesDirectory)\js\scripts\prepare-onnx-node-tests.ts
restoreKeys: |
onnxtestdata | $(Build.SourcesDirectory)\js\scripts\prepare-onnx-node-tests.ts
onnxtestdata
path: $(Build.SourcesDirectory)/js/test/
displayName: 'Cache ONNX node test data'
- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/js/pack-npm-packages.ps1'
@ -169,6 +174,3 @@ jobs:
- template: component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()

View file

@ -30,6 +30,9 @@ jobs:
workspace:
clean: all
steps:
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()
- checkout: self
submodules: false
- task: DownloadPipelineArtifact@2
@ -123,12 +126,14 @@ jobs:
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'
- script: |
if exist "C:\local\data\onnx\test\data\node\__generated_onnx_node_tests" (
xcopy C:\local\data\onnx\test\ $(Build.SourcesDirectory)\js\test\ /E
)
workingDirectory: '$(Build.SourcesDirectory)\js\web'
displayName: 'Copy pre-downloaded test data'
- task: Cache@2
inputs:
key: onnxtestdata | $(Build.SourcesDirectory)\js\scripts\prepare-onnx-node-tests.ts
restoreKeys: |
onnxtestdata | $(Build.SourcesDirectory)\js\scripts\prepare-onnx-node-tests.ts
onnxtestdata
path: $(Build.SourcesDirectory)/js/test/
displayName: 'Cache ONNX node test data'
- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)\tools\ci_build\github\js\pack-npm-packages.ps1'
@ -177,6 +182,3 @@ jobs:
- template: component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()