Skip to content

Commit

Permalink
Azure CI: Build caching (mono#65)
Browse files Browse the repository at this point in the history
* Add caching

* More pipeline fixes

* Fix cache config

* Add ContinueOnError for the initial case, where the cache has not been populated yet
  • Loading branch information
bryphe authored Nov 24, 2018
1 parent 4c126a6 commit 52a75b0
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@ jobs:
- job: Linux
pool:
vmImage: 'Ubuntu 16.04'

variables:
ESY__CACHE_INSTALL_PATH: /home/vsts/.esy/3_____________________________________________________________________/i/
ESY__CACHE_SOURCE_TARBALL_PATH: /home/vsts/.esy/source-tarballs

steps:
- script: sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libegl1-mesa-dev mesa-utils mesa-utils-extra ragel
- template: esy-build-steps.yml

- job: MacOS
pool:
vmImage: 'macOS 10.13'

variables:
ESY__CACHE_INSTALL_PATH: /Users/vsts/.esy/3____________________________________________________________________/i/
ESY__CACHE_SOURCE_TARBALL_PATH: /Users/vsts/.esy/source-tarballs

steps:
- script: brew update
- script: brew install libpng
Expand All @@ -23,8 +33,15 @@ jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'

variables:
ESY__CACHE_INSTALL_PATH: C:\Users\VssAdministrator\.esy\3_\i
ESY__CACHE_SOURCE_TARBALL_PATH: C:\Users\VssAdministrator\.esy\source-tarballs

steps:
- template: restore-build-cache.yml
- template: esy-build-steps.yml
- template: publish-build-cache.yml

- job: Release
displayName: Release
Expand Down
20 changes: 20 additions & 0 deletions .ci/publish-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Steps for publishing project cache

steps:
- task: PublishBuildArtifacts@1
displayName: 'Cache: Upload source tarballs'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
pathToPublish: '$(ESY__CACHE_SOURCE_TARBALL_PATH)'
artifactName: 'cache-$(Agent.OS)-source-tarballs'
parallel: true
parallelCount: 8

- task: PublishBuildArtifacts@1
displayName: 'Cache: Upload install folder'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
pathToPublish: '$(ESY__CACHE_INSTALL_PATH)'
artifactName: 'cache-$(Agent.OS)-install'
parallel: true
parallelCount: 8
40 changes: 40 additions & 0 deletions .ci/restore-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Steps for restoring project cache

steps:
- task: DownloadBuildArtifacts@0
displayName: 'Cache: Restore source-tarballs'
inputs:
buildType: 'specific'
project: 'revery'
pipeline: 'build'
branchName: 'refs/heads/master'
buildVersionToDownload: 'latestFromBranch'
downloadType: 'single'
artifactName: 'cache-$(Agent.OS)-source-tarballs'
downloadPath: '$(System.ArtifactsDirectory)'
continueOnError: true

- task: CopyFiles@2
inputs:
sourceFolder: '$(System.ArtifactsDirectory)\cache-$(Agent.OS)-source-tarballs'
targetFolder: '$(ESY__CACHE_SOURCE_TARBALL_PATH)'
continueOnError: true

- task: DownloadBuildArtifacts@0
displayName: 'Cache: Restore install'
inputs:
buildType: 'specific'
project: 'revery'
pipeline: 'build'
branchName: 'refs/heads/master'
buildVersionToDownload: 'latestFromBranch'
downloadType: 'single'
artifactName: 'cache-$(Agent.OS)-install'
downloadPath: '$(System.ArtifactsDirectory)'
continueOnError: true

- task: CopyFiles@2
inputs:
sourceFolder: '$(System.ArtifactsDirectory)\cache-$(Agent.OS)-install'
targetFolder: '$(ESY__CACHE_INSTALL_PATH)'
continueOnError: true

0 comments on commit 52a75b0

Please sign in to comment.