ci: activate caching of yarn packages in azure pipelines

See: https://docs.microsoft.com/en-us/azure/devops/pipelines/caching/?view=azure-devops#nodejsyarn
This commit is contained in:
Michael Bradley, Jr 2019-11-26 15:12:10 -06:00 committed by Michael Bradley
parent 3416b051d0
commit 70115a20e0
1 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,5 @@
variables: variables:
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
ipfsVersion: '0.4.22' ipfsVersion: '0.4.22'
node10: '^10.17.0' node10: '^10.17.0'
pythonVersion: '2.7.x' pythonVersion: '2.7.x'
@ -72,12 +73,21 @@ steps:
condition: succeeded() condition: succeeded()
displayName: 'Install Yarn' displayName: 'Install Yarn'
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: 'Cache Yarn packages'
- bash: | - bash: |
pushd "$PWD" &>/dev/null pushd "$PWD" &>/dev/null
cd ../Downloads cd ../Downloads
export PATH="${PWD}/go-ipfs:${PATH}" export PATH="${PWD}/go-ipfs:${PATH}"
export PATH="${HOME}/.yarn/bin:${HOME}/.config/yarn/global/node_modules/.bin:${PATH}" export PATH="${HOME}/.yarn/bin:${HOME}/.config/yarn/global/node_modules/.bin:${PATH}"
yarn config set cache-folder "${PWD}/Yarn" &>/dev/null yarn config set cache-folder "${YARN_CACHE_FOLDER}" &>/dev/null
popd &>/dev/null popd &>/dev/null
npm run ci:full npm run ci:full
condition: and( succeeded(), ne( variables['Agent.OS'], 'Windows_NT' ) ) condition: and( succeeded(), ne( variables['Agent.OS'], 'Windows_NT' ) )
@ -88,7 +98,7 @@ steps:
cd ..\Downloads cd ..\Downloads
$env:PATH="$($PWD.Path)\go-ipfs;$($env:PATH)" $env:PATH="$($PWD.Path)\go-ipfs;$($env:PATH)"
$env:PATH="$($env:USERPROFILE)\.yarn\bin;$($env:USERPROFILE)\.config\yarn\global\node_modules\.bin;$($env:PATH)" $env:PATH="$($env:USERPROFILE)\.yarn\bin;$($env:USERPROFILE)\.config\yarn\global\node_modules\.bin;$($env:PATH)"
yarn config set cache-folder "$($PWD.Path)\Yarn" | out-null yarn config set cache-folder "$($YARN_CACHE_FOLDER)" | out-null
popd popd
npm run ci:full npm run ci:full
condition: and( succeeded(), eq( variables['Agent.OS'], 'Windows_NT' ) ) condition: and( succeeded(), eq( variables['Agent.OS'], 'Windows_NT' ) )