Skip to content

Commit c1fb406

Browse files
Merge pull request #2372 from nikosavola/nikosavola/push-nopxwmtwsyly
Add caching for KLayout microbits in Azure Pipelines
2 parents adc63e2 + b7ed464 commit c1fb406

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
@@ -90,6 +90,13 @@ jobs:
9090
versionSpec: '$(python.version)'
9191
architecture: '$(python.architecture)'
9292

93+
- task: Cache@2
94+
inputs:
95+
key: 'microbits | "4.0"'
96+
path: $(Build.SourcesDirectory)/klayout-microbits
97+
cacheHitVar: MICROBITS_CACHED
98+
displayName: 'Cache KLayout microbits'
99+
93100
# Add additional tasks to run using each Python version in the matrix above
94101

95102
# PowerShell
@@ -100,9 +107,13 @@ jobs:
100107
#arguments: # Optional
101108
script: | # Required when targetType == Inline
102109
pwd
103-
Invoke-WebRequest -Uri "https://www.klayout.org/downloads/klayout-microbits-4.0.zip" -OutFile klayout-microbits-4.0.zip
104-
dir
105-
Expand-Archive klayout-microbits-4.0.zip -DestinationPath klayout-microbits
110+
if ("$(MICROBITS_CACHED)" -ne "true") {
111+
Write-Host "Cache miss: downloading and extracting KLayout microbits..."
112+
Invoke-WebRequest -Uri "https://www.klayout.org/downloads/klayout-microbits-4.0.zip" -OutFile klayout-microbits-4.0.zip
113+
Expand-Archive klayout-microbits-4.0.zip -DestinationPath klayout-microbits
114+
} else {
115+
Write-Host "Cache hit: restored KLayout microbits from cache."
116+
}
106117
dir klayout-microbits
107118
#errorActionPreference: 'stop' # Optional. Options: stop, continue, silentlyContinue
108119
#failOnStderr: false # Optional

0 commit comments

Comments
 (0)