@@ -157,12 +157,10 @@ jobs:
157
157
- uses : actions/setup-go@v5
158
158
with :
159
159
go-version : 1.22.x
160
- - name : Cache ~/Library/Caches/lima/download
161
- uses : actions/cache@v4
160
+ - name : Cache image used by default.yaml
161
+ uses : ./.github/ actions/setup_cache_for_template
162
162
with :
163
- path : ~/Library/Caches/lima/download
164
- # hashFiles do not seem to support symlinks
165
- key : ${{ runner.os }}-${{ hashFiles('templates/default.yaml') }}
163
+ template : templates/default.yaml
166
164
- name : Unit tests
167
165
run : go test -v ./...
168
166
- name : Make
@@ -225,15 +223,13 @@ jobs:
225
223
- uses : actions/setup-go@v5
226
224
with :
227
225
go-version : 1.22.x
228
- - id : path_for_hashFiles
229
- # It seems that `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
230
- run : echo "NORMALIZED=$(realpath --relative-to=$PWD examples/${{ matrix.template }})" >> "$GITHUB_OUTPUT"
231
- - uses : actions/cache@v4
226
+ - id : normalize_template_path
227
+ # `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
228
+ run : echo "NORMALIZED=$(realpath templates/${{ matrix.template }})" >> "$GITHUB_OUTPUT"
229
+ - name : Cache image used by ${{ steps.normalize_template_path.outputs.NORMALIZED }}
230
+ uses : ./.github/actions/setup_cache_for_template
232
231
with :
233
- path : ~/.cache/lima/download
234
- # hashFiles do not seem to support symlinks
235
- # TODO: more fine-grained cache
236
- key : ${{ runner.os }}-${{ hashFiles(steps.path_for_hashFiles.outputs.NORMALIZED) }}
232
+ template : ${{ steps.normalize_template_path.outputs.NORMALIZED }}
237
233
- name : Make
238
234
run : make
239
235
- name : Install
@@ -322,12 +318,10 @@ jobs:
322
318
- uses : actions/setup-go@v5
323
319
with :
324
320
go-version : 1.22.x
325
- - name : Cache ~/Library/Caches/lima/download
326
- uses : actions/cache@v4
321
+ - name : Cache image used by vmnet.yaml
322
+ uses : ./.github/ actions/setup_cache_for_template
327
323
with :
328
- path : ~/Library/Caches/lima/download
329
- # hashFiles do not seem to support symlinks
330
- key : ${{ runner.os }}-${{ hashFiles('examples/vmnet.yaml') }}
324
+ template : templates/vmnet.yaml
331
325
- name : Make
332
326
run : make
333
327
- name : Install
@@ -404,15 +398,13 @@ jobs:
404
398
- uses : actions/setup-go@v5
405
399
with :
406
400
go-version : 1.22.x
407
- - id : path_for_hashFiles
408
- # It seems that `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
409
- run : echo "NORMALIZED=$(realpath examples /${{ matrix.template }})" >> "$GITHUB_OUTPUT"
410
- - name : Cache ~/Library/Caches/lima/download
411
- uses : actions/cache@v4
401
+ - id : normalize_template_path
402
+ # `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
403
+ run : echo "NORMALIZED=$(realpath templates /${{ matrix.template }})" >> "$GITHUB_OUTPUT"
404
+ - name : Cache image used by ${{ steps.normalize_template_path.outputs.NORMALIZED }}
405
+ uses : ./.github/ actions/setup_cache_for_template
412
406
with :
413
- path : ~/Library/Caches/lima/download
414
- # hashFiles do not seem to support symlinks
415
- key : ${{ runner.os }}-${{ hashFiles(steps.path_for_hashFiles.outputs.NORMALIZED) }}
407
+ template : ${{ steps.normalize_template_path.outputs.NORMALIZED }}
416
408
- name : Make
417
409
run : make
418
410
- name : Install
0 commit comments