Skip to content

Commit

Permalink
CI: Use Cache@2 task in place of Lighthouse
Browse files Browse the repository at this point in the history
  • Loading branch information
DeeDeeG committed Jul 11, 2020
1 parent d0f0f60 commit fc4dc84
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 62 deletions.
33 changes: 20 additions & 13 deletions script/vsts/platforms/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,26 @@ jobs:
- script: npm install --global [email protected]
displayName: Update npm

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
displayName: Restore node_modules cache
- task: Cache@2
displayName: Cache node_modules
inputs:
keyfile: 'package.json, script/vsts/platforms/linux.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
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

- script: script/bootstrap
displayName: Bootstrap build environment
Expand All @@ -45,14 +59,7 @@ jobs:
CC: clang-5.0
CXX: clang++-5.0
npm_config_clang: 1
condition: ne(variables['CacheRestored'], 'true')

- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
displayName: Save node_modules cache
inputs:
keyfile: 'package.json, script/vsts/platforms/linux.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))

- script: script/lint
displayName: Run linter
Expand Down
60 changes: 40 additions & 20 deletions script/vsts/platforms/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,26 @@ jobs:
- script: npm install --global [email protected]
displayName: Update npm

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
displayName: Restore node_modules cache
- task: Cache@2
displayName: Cache node_modules
inputs:
keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
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

- script: script/bootstrap
displayName: Bootstrap build environment
Expand All @@ -34,14 +48,7 @@ jobs:
CI_PROVIDER: VSTS
NPM_BIN_PATH: /usr/local/bin/npm
npm_config_build_from_source: true
condition: ne(variables['CacheRestored'], 'true')

- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
displayName: Save node_modules cache
inputs:
keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))

- script: script/lint
displayName: Run linter
Expand Down Expand Up @@ -121,12 +128,26 @@ jobs:
- script: npm install --global [email protected]
displayName: Update npm

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
displayName: Restore node_modules cache
- task: Cache@2
displayName: Cache node_modules
inputs:
keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
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

# The artifact caching task does not work on forks, so we need to
# bootstrap again for pull requests coming from forked repositories.
Expand All @@ -137,8 +158,7 @@ jobs:
CI_PROVIDER: VSTS
NPM_BIN_PATH: /usr/local/bin/npm
npm_config_build_from_source: true

condition: ne(variables['CacheRestored'], 'true')
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))

- task: DownloadBuildArtifacts@0
displayName: Download atom-mac.zip
Expand Down
47 changes: 18 additions & 29 deletions script/vsts/platforms/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,26 @@ jobs:
npm install
displayName: Install Windows build dependencies
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
displayName: Restore node_modules cache (x64)
- task: Cache@2
displayName: Cache node_modules
inputs:
keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
condition: eq(variables['buildArch'], 'x64')
key: 'npm | "$(Agent.OS)" | "$(buildArch)" | package.json, package-lock.json, script/vsts/platforms/windows.yml'
path: 'node_modules'
cacheHitVar: MainNodeModulesRestored

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
displayName: Restore node_modules cache (x86)
- task: Cache@2
displayName: Cache script/node_modules
inputs:
keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
condition: eq(variables['buildArch'], 'x86')
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

- script: |
node script\vsts\windows-run.js script\bootstrap.cmd
Expand All @@ -73,23 +78,7 @@ jobs:
NPM_BIN_PATH: "C:\\hostedtoolcache\\windows\\node\\12.13.1\\x64\\npm.cmd"
npm_config_build_from_source: true
displayName: Bootstrap build environment
condition: ne(variables['CacheRestored'], 'true')
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
displayName: Save node_modules cache (x64)
inputs:
keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x64-cache-key'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
condition: eq(variables['buildArch'], 'x64')

- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
displayName: Save node_modules cache (x86)
inputs:
keyfile: 'package.json, script/vsts/platforms/windows.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json, script/vsts/x86-cache-key'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
condition: eq(variables['buildArch'], 'x86')
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'))
- script: node script\vsts\windows-run.js script\lint.cmd
env:
Expand Down

0 comments on commit fc4dc84

Please sign in to comment.