Skip to content

Commit

Permalink
CI: Cache the packages/ directory (atom#21884)
Browse files Browse the repository at this point in the history
Ensures we do not miss restoring these packages' node_modules folders
when running the post-build jobs (the test jobs in particular).
  • Loading branch information
DeeDeeG authored Jan 21, 2021
1 parent 9c8b097 commit 79446ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion script/vsts/platforms/templates/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ steps:
GITHUB_TOKEN: $(GITHUB_TOKEN)
CI: true
CI_PROVIDER: VSTS
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'), ne(variables['LocalPackagesRestored'], 'true'))
13 changes: 10 additions & 3 deletions script/vsts/platforms/templates/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,27 @@ steps:
- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'npm_main | "$(Agent.OS)" | "$(BUILD_ARCH)" | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
key: 'npm_main | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'node_modules'
cacheHitVar: MainNodeModulesRestored

- task: Cache@2
displayName: Cache script/node_modules
inputs:
key: 'npm_script | "$(Agent.OS)" | "$(BUILD_ARCH)" | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
key: 'npm_script | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'script/node_modules'
cacheHitVar: ScriptNodeModulesRestored

- task: Cache@2
displayName: Cache apm/node_modules
inputs:
key: 'npm_apm | "$(Agent.OS)" | "$(BUILD_ARCH)" | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
key: 'npm_apm | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'apm/node_modules'
cacheHitVar: ApmNodeModulesRestored

- task: Cache@2
displayName: Cache packages/
inputs:
key: 'npm_local_packages | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'packages'
cacheHitVar: LocalPackagesRestored

0 comments on commit 79446ad

Please sign in to comment.