Build Cache (#7011)

* add build caching

* test caching
This commit is contained in:
Anthony Dresser
2019-08-30 11:34:43 -07:00
committed by GitHub
parent b6e7ec51f0
commit ee1d5680a7
3 changed files with 135 additions and 112 deletions

View File

@@ -1,14 +1,5 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.15.1'
displayName: 'Install Node.js'
- script: |
npm i -g yarn
displayName: 'preinstall'
- script: |
- script: |
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:10
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
@@ -17,51 +8,73 @@ steps:
sudo apt-get install -y libkrb5-dev
# sh -e /etc/init.d/xvfb start
# sleep 3
displayName: 'Linux preinstall'
displayName: "Linux preinstall"
condition: eq(variables['Agent.OS'], 'Linux')
- script: |
yarn
displayName: 'Install'
- task: NodeTool@0
inputs:
versionSpec: "10.15.1"
- script: |
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
inputs:
keyfile: ".yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock"
targetfolder: "**/node_modules, !**/node_modules/**/node_modules"
vstsFeed: "$(build-cache)"
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
inputs:
versionSpec: "1.10.1"
- script: |
yarn --frozen-lockfile
displayName: Install Dependencies
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
inputs:
keyfile: ".yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock"
targetfolder: "**/node_modules, !**/node_modules/**/node_modules"
vstsFeed: "$(build-cache)"
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
- script: |
yarn gulp electron-x64
displayName: Download Electron
- script: |
- script: |
yarn gulp hygiene
displayName: Run Hygiene Checks
- script: |
- script: |
yarn tslint
displayName: 'Run TSLint'
displayName: "Run TSLint"
- script: |
- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'
displayName: "Run Strict Null Check"
- script: |
- script: |
yarn compile
displayName: 'Compile'
displayName: "Compile"
- script: |
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter
displayName: 'Tests'
displayName: "Tests"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- script: |
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter --coverage
displayName: 'Tests'
displayName: "Tests"
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
- task: PublishTestResults@2
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
testResultsFiles: "**/test-results.xml"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
codeCoverageTool: "cobertura"
summaryFileLocation: $(System.DefaultWorkingDirectory)/.build/coverage/cobertura-coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)/.build/coverage/lcov-reports
condition: ne(variables['Agent.OS'], 'Linux')

View File

@@ -1,44 +1,61 @@
steps:
- task: NodeTool@0
- task: NodeTool@0
inputs:
versionSpec: '10.15.1'
displayName: 'Install Node.js'
versionSpec: "10.15.1"
- script: |
yarn
displayName: 'Yarn Install'
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
inputs:
keyfile: ".yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock"
targetfolder: "**/node_modules, !**/node_modules/**/node_modules"
vstsFeed: "$(build-cache)"
- script: |
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
inputs:
versionSpec: "1.10.1"
- script: |
yarn --frozen-lockfile
displayName: Install Dependencies
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
inputs:
keyfile: ".yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock"
targetfolder: "**/node_modules, !**/node_modules/**/node_modules"
vstsFeed: "$(build-cache)"
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
- script: |
yarn gulp electron-x64
displayName: 'Electron'
displayName: "Electron"
- script: |
- script: |
yarn gulp hygiene
displayName: Run Hygiene Checks
- script: |
- script: |
yarn tslint
displayName: 'Run TSLint'
displayName: "Run TSLint"
- script: |
- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'
displayName: "Run Strict Null Check"
- script: |
- script: |
yarn compile
displayName: 'Compile'
displayName: "Compile"
- script: |
- script: |
.\scripts\test.bat --reporter mocha-junit-reporter --coverage
displayName: 'Test'
displayName: "Test"
- task: PublishTestResults@2
- task: PublishTestResults@2
inputs:
testResultsFiles: 'test-results.xml'
testResultsFiles: "test-results.xml"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
codeCoverageTool: "cobertura"
summaryFileLocation: $(System.DefaultWorkingDirectory)\.build\coverage\cobertura-coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)\.build\coverage\lcov-report

View File

@@ -1,29 +1,22 @@
trigger:
- master
- releases/*
- master
- release/*
jobs:
# All tasks on Windows
- job: build_all_windows
displayName: Build all tasks (Windows)
- job: Windows
pool:
vmImage: vs2017-win2016
vmImage: VS2017-Win2016
steps:
- template: azure-pipelines-windows.yml
# All tasks on Linux
- job: build_all_linux
displayName: Build all tasks (Linux)
- job: Linux
pool:
vmImage: 'Ubuntu 16.04'
vmImage: "Ubuntu-16.04"
steps:
- template: azure-pipelines-linux-mac.yml
# All tasks on macOS
- job: build_all_darwin
displayName: Build all tasks (macOS)
- job: macOS
pool:
vmImage: macos-10.13
vmImage: macOS 10.13
steps:
- template: azure-pipelines-linux-mac.yml