Skip to content

Commit

Permalink
Add caching for vanilla files
Browse files Browse the repository at this point in the history
  • Loading branch information
coloursofnoise committed Oct 1, 2021
1 parent 0e4a9e6 commit 4b3d381
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
15 changes: 9 additions & 6 deletions azure-pipelines-verify.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ if ($PATCH -eq "/patch") {
Write-Output "Creating patch directories"
Remove-Item -ErrorAction Ignore -Recurse -Force -Path $PATCH
New-Item -ItemType "directory" -Path $PATCH
New-Item -ItemType "directory" -Path $PATCH/build

Write-Output "Downloading Celeste package"
$creds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$($env:BIN_USERNAME):$($env:BIN_PASSWORD)"))
$headers = @{'Authorization'= "Basic $creds"}
Invoke-WebRequest -URI "$env:BIN_URL/Celeste_Linux.zip" -OutFile "$env:AGENT_TEMPDIRECTORY/Celeste.zip" -Headers $headers
Expand-Archive -Path "$env:AGENT_TEMPDIRECTORY/Celeste.zip" -DestinationPath $PATCH
if ($env:CACHE_RESTORED -eq "false") {
Write-Output "Downloading Celeste package"
$creds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$($env:BIN_USERNAME):$($env:BIN_PASSWORD)"))
$headers = @{'Authorization'= "Basic $creds"}
Invoke-WebRequest -URI "$env:BIN_URL/Celeste_Linux.zip" -OutFile "$env:AGENT_TEMPDIRECTORY/Celeste.zip" -Headers $headers
Expand-Archive -Path "$env:AGENT_TEMPDIRECTORY/Celeste.zip" -DestinationPath $env:VANILLA_CACHE
}

Copy-Item -Path "$env:VANILLA_CACHE/*" - Destination $PATCH

Write-Output "Applying Everest patch"
Copy-Item -Path "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/main/*" -Destination $PATCH
Expand Down
7 changes: 7 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
VANILLA_CACHE: $(Pipeline.Workspace)/vanilla

name: '$(Build.BuildId)+$(Build.BuildIdOffset)'

Expand Down Expand Up @@ -53,6 +54,12 @@ steps:
publishLocation: 'Container'

# Verify patches.
- task: Cache@2
displayName: Cache Vanilla files
inputs:
key: '"lib-stripped" | "$(BIN_USERNAME)" | "$(BIN_PASSWORD)"'
path: $(VANILLA_CACHE)
cacheHitVar: CACHE_RESTORED
- task: PowerShell@2
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI'))
displayName: 'Verify patches'
Expand Down

0 comments on commit 4b3d381

Please sign in to comment.