Skip to content

Commit

Permalink
using cache template in the workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jul 11, 2020
1 parent ca37fcf commit b60ba40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 80 deletions.
23 changes: 3 additions & 20 deletions script/vsts/platforms/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,9 @@ jobs:
- script: npm install --global [email protected]
displayName: Update npm

- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/linux.yml'
path: 'node_modules'
cacheHitVar: MainNodeModulesRestored

- task: Cache@2
displayName: Cache script/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/linux.yml'
path: 'script/node_modules'
cacheHitVar: ScriptNodeModulesRestored

- task: Cache@2
displayName: Cache apm/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/linux.yml'
path: 'apm/node_modules'
cacheHitVar: ApmNodeModulesRestored
- template: cache.yml
parameters:
OS: linux

- script: script/bootstrap
displayName: Bootstrap build environment
Expand Down
46 changes: 6 additions & 40 deletions script/vsts/platforms/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,9 @@ jobs:
- script: npm install --global [email protected]
displayName: Update npm

- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/macos.yml'
path: 'node_modules'
cacheHitVar: MainNodeModulesRestored

- task: Cache@2
displayName: Cache script/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/macos.yml'
path: 'script/node_modules'
cacheHitVar: ScriptNodeModulesRestored

- task: Cache@2
displayName: Cache apm/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/macos.yml'
path: 'apm/node_modules'
cacheHitVar: ApmNodeModulesRestored
- template: cache.yml
parameters:
OS: macos

- script: script/bootstrap
displayName: Bootstrap build environment
Expand Down Expand Up @@ -128,26 +111,9 @@ jobs:
- script: npm install --global [email protected]
displayName: Update npm

- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'npm | "$(Agent.OS)" | package.json, package-lock.json, script/vsts/platforms/macos.yml'
path: 'node_modules'
cacheHitVar: MainNodeModulesRestored

- task: Cache@2
displayName: Cache script/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | script/package.json, script/package-lock.json, script/vsts/platforms/macos.yml'
path: 'script/node_modules'
cacheHitVar: ScriptNodeModulesRestored

- task: Cache@2
displayName: Cache apm/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/macos.yml'
path: 'apm/node_modules'
cacheHitVar: ApmNodeModulesRestored
- template: cache.yml
parameters:
OS: macos

# The artifact caching task does not work on forks, so we need to
# bootstrap again for pull requests coming from forked repositories.
Expand Down
23 changes: 3 additions & 20 deletions script/vsts/platforms/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,9 @@ jobs:
npm install
displayName: Install Windows build dependencies
- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'npm | "$(Agent.OS)" | "$(buildArch)" | package.json, package-lock.json, script/vsts/platforms/windows.yml'
path: 'node_modules'
cacheHitVar: MainNodeModulesRestored

- task: Cache@2
displayName: Cache script/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | "$(buildArch)" | script/package.json, script/package-lock.json, script/vsts/platforms/windows.yml'
path: 'script/node_modules'
cacheHitVar: ScriptNodeModulesRestored

- task: Cache@2
displayName: Cache apm/node_modules
inputs:
key: 'npm | "$(Agent.OS)" | "$(buildArch)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/windows.yml'
path: 'apm/node_modules'
cacheHitVar: ApmNodeModulesRestored
- template: cache.yml
parameters:
OS: windows

- script: |
node script\vsts\windows-run.js script\bootstrap.cmd
Expand Down

0 comments on commit b60ba40

Please sign in to comment.