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

View File

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