Skip to content

Commit

Permalink
Build Cache (#7011)
Browse files Browse the repository at this point in the history
* add build caching

* test caching
  • Loading branch information
Anthony Dresser authored Aug 30, 2019
1 parent b6e7ec5 commit ee1d568
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 121 deletions.
121 changes: 67 additions & 54 deletions azure-pipelines-linux-mac.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,80 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.15.1'
displayName: 'Install Node.js'
- 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
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: |
npm i -g yarn
displayName: 'preinstall'
- task: NodeTool@0
inputs:
versionSpec: "10.15.1"

- 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
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')
- 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: |
yarn
displayName: 'Install'
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
inputs:
versionSpec: "1.10.1"

- script: |
yarn gulp electron-x64
displayName: Download Electron
- script: |
yarn --frozen-lockfile
displayName: Install Dependencies
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
- script: |
yarn gulp hygiene
displayName: Run Hygiene Checks
- 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 tslint
displayName: 'Run TSLint'
- script: |
yarn gulp electron-x64
displayName: Download Electron
- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'
- script: |
yarn gulp hygiene
displayName: Run Hygiene Checks
- script: |
yarn compile
displayName: 'Compile'
- script: |
yarn tslint
displayName: "Run TSLint"
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter
displayName: 'Tests'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- script: |
yarn strict-null-check
displayName: "Run Strict Null Check"
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter --coverage
displayName: 'Tests'
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
- script: |
yarn compile
displayName: "Compile"
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/test-results.xml'
condition: succeededOrFailed()
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter
displayName: "Tests"
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- 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')
- script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter --coverage
displayName: "Tests"
condition: and(succeeded(), 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')
103 changes: 60 additions & 43 deletions azure-pipelines-windows.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,61 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.15.1'
displayName: 'Install Node.js'

- script: |
yarn
displayName: 'Yarn Install'

- script: |
yarn gulp electron-x64
displayName: 'Electron'

- script: |
yarn gulp hygiene
displayName: Run Hygiene Checks

- script: |
yarn tslint
displayName: 'Run TSLint'

- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'

- script: |
yarn compile
displayName: 'Compile'

- 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
- task: NodeTool@0
inputs:
versionSpec: "10.15.1"

- 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: "Electron"
- script: |
yarn gulp hygiene
displayName: Run Hygiene Checks
- script: |
yarn tslint
displayName: "Run TSLint"
- script: |
yarn strict-null-check
displayName: "Run Strict Null Check"
- script: |
yarn compile
displayName: "Compile"
- 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
41 changes: 17 additions & 24 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
trigger:
- master
- releases/*
- master
- release/*

jobs:
- job: Windows
pool:
vmImage: VS2017-Win2016
steps:
- template: azure-pipelines-windows.yml

# All tasks on Windows
- job: build_all_windows
displayName: Build all tasks (Windows)
pool:
vmImage: vs2017-win2016
steps:
- template: azure-pipelines-windows.yml
- job: Linux
pool:
vmImage: "Ubuntu-16.04"
steps:
- template: azure-pipelines-linux-mac.yml

# All tasks on Linux
- job: build_all_linux
displayName: Build all tasks (Linux)
pool:
vmImage: 'Ubuntu 16.04'
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
- job: macOS
pool:
vmImage: macOS 10.13
steps:
- template: azure-pipelines-linux-mac.yml

0 comments on commit ee1d568

Please sign in to comment.