@@ -157,12 +157,10 @@ jobs:
157
157
- uses : actions/setup-go@v5
158
158
with :
159
159
go-version : 1.23.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
@@ -230,15 +228,14 @@ jobs:
230
228
- uses : actions/setup-go@v5
231
229
with :
232
230
go-version : 1.23.x
233
- - id : path_for_hashFiles
234
- # It seems that `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
235
- run : echo "NORMALIZED=$(realpath --relative-to=$PWD examples/${{ matrix.template }})" >> "$GITHUB_OUTPUT"
236
- - uses : actions/cache@v4
237
- with :
238
- path : ~/.cache/lima/download
239
- # hashFiles do not seem to support symlinks
240
- # TODO: more fine-grained cache
241
- key : ${{ runner.os }}-${{ hashFiles(steps.path_for_hashFiles.outputs.NORMALIZED) }}
231
+ - name : normalize template path
232
+ id : normalize_template_path
233
+ # `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
234
+ run : echo "NORMALIZED=$(realpath templates/${{ matrix.template }})" >> "$GITHUB_OUTPUT"
235
+ - name : Cache image used by ${{ steps.normalize_template_path.outputs.NORMALIZED }}
236
+ uses : ./.github/actions/setup_cache_for_template
237
+ with :
238
+ template : ${{ steps.normalize_template_path.outputs.NORMALIZED }}
242
239
- name : Make
243
240
run : make
244
241
- name : Install
@@ -331,12 +328,10 @@ jobs:
331
328
- uses : actions/setup-go@v5
332
329
with :
333
330
go-version : 1.23.x
334
- - name : Cache ~/Library/Caches/lima/download
335
- uses : actions/cache@v4
331
+ - name : Cache image used by vmnet.yaml
332
+ uses : ./.github/ actions/setup_cache_for_template
336
333
with :
337
- path : ~/Library/Caches/lima/download
338
- # hashFiles do not seem to support symlinks
339
- key : ${{ runner.os }}-${{ hashFiles('examples/vmnet.yaml') }}
334
+ template : templates/vmnet.yaml
340
335
- name : Make
341
336
run : make
342
337
- name : Install
@@ -386,11 +381,10 @@ jobs:
386
381
- uses : actions/setup-go@v5
387
382
with :
388
383
go-version : 1.23.x
389
- - name : Cache ~/Library/Caches/lima/download
390
- uses : actions/cache@v4
384
+ - name : Cache image used by ${{ matrix.oldver }}/examples/ubuntu-lts.yaml
385
+ uses : ./.github/ actions/setup_cache_for_template
391
386
with :
392
- path : ~/Library/Caches/lima/download
393
- key : ${{ runner.os }}-upgrade-${{ matrix.oldver }}
387
+ template : https://raw.githubusercontent.com/lima-vm/lima/${{ matrix.oldver }}/examples/ubuntu-lts.yaml
394
388
- name : Install test dependencies
395
389
run : brew install qemu bash coreutils
396
390
- name : Test
@@ -420,15 +414,14 @@ jobs:
420
414
- uses : actions/setup-go@v5
421
415
with :
422
416
go-version : 1.23.x
423
- - id : path_for_hashFiles
424
- # It seems that `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
425
- run : echo "NORMALIZED=$(realpath examples/${{ matrix.template }})" >> "$GITHUB_OUTPUT"
426
- - name : Cache ~/Library/Caches/lima/download
427
- uses : actions/cache@v4
428
- with :
429
- path : ~/Library/Caches/lima/download
430
- # hashFiles do not seem to support symlinks
431
- key : ${{ runner.os }}-${{ hashFiles(steps.path_for_hashFiles.outputs.NORMALIZED) }}
417
+ - name : normalize template path
418
+ id : normalize_template_path
419
+ # `hashFiles` cannot use `..` as a path component, so generate a normalized path here.
420
+ run : echo "NORMALIZED=$(realpath templates/${{ matrix.template }})" >> "$GITHUB_OUTPUT"
421
+ - name : Cache image used by ${{ steps.normalize_template_path.outputs.NORMALIZED }}
422
+ uses : ./.github/actions/setup_cache_for_template
423
+ with :
424
+ template : ${{ steps.normalize_template_path.outputs.NORMALIZED }}
432
425
- name : Make
433
426
run : make
434
427
- name : Install
0 commit comments