Skip to content

Commit b7ed464

Browse files
committed
Add caching for KLayout microbits in Azure Pipelines
1 parent 6270877 commit b7ed464

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

azure-pipelines.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ jobs:
5252
versionSpec: '$(python.version)'
5353
architecture: '$(python.architecture)'
5454

55+
- task: Cache@2
56+
inputs:
57+
key: 'microbits | "4.0"'
58+
path: $(Build.SourcesDirectory)/klayout-microbits
59+
cacheHitVar: MICROBITS_CACHED
60+
displayName: 'Cache KLayout microbits'
61+
5562
# Add additional tasks to run using each Python version in the matrix above
5663

5764
# PowerShell
@@ -62,9 +69,13 @@ jobs:
6269
#arguments: # Optional
6370
script: | # Required when targetType == Inline
6471
pwd
65-
Invoke-WebRequest -Uri "https://www.klayout.org/downloads/klayout-microbits-4.0.zip" -OutFile klayout-microbits-4.0.zip
66-
dir
67-
Expand-Archive klayout-microbits-4.0.zip -DestinationPath klayout-microbits
72+
if ("$(MICROBITS_CACHED)" -ne "true") {
73+
Write-Host "Cache miss: downloading and extracting KLayout microbits..."
74+
Invoke-WebRequest -Uri "https://www.klayout.org/downloads/klayout-microbits-4.0.zip" -OutFile klayout-microbits-4.0.zip
75+
Expand-Archive klayout-microbits-4.0.zip -DestinationPath klayout-microbits
76+
} else {
77+
Write-Host "Cache hit: restored KLayout microbits from cache."
78+
}
6879
dir klayout-microbits
6980
#errorActionPreference: 'stop' # Optional. Options: stop, continue, silentlyContinue
7081
#failOnStderr: false # Optional

0 commit comments

Comments
 (0)