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