Skip to content

Commit

Permalink
setup_cache_for_template: support url in template parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
norio-nomura committed Jul 25, 2024
1 parent 2e32b6f commit a1050c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 10 additions & 1 deletion .github/actions/setup_cache_for_template/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ runs:
set -eux
arch="${{ inputs.arch }}"
template="${{ inputs.template }}"
test -f "$template" || exit 1
case "$template" in
https://*)
tmp_yaml=$(mktemp -d)/template.yaml
curl -sSLf "$template" > $tmp_yaml || exit 1
template=$tmp_yaml
;;
*)
test -f "$template" || exit 1
;;
esac
# detect arch from template if not provided
arch="${arch:-$(yq '.arch // ""' "$template")}"
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,10 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Cache ~/Library/Caches/lima/download
uses: actions/cache@v4
- name: Cache image used by ${{ matrix.oldver }}/examples/ubuntu-lts.yaml
uses: ./.github/actions/setup_cache_for_template
with:
path: ~/Library/Caches/lima/download
key: ${{ runner.os }}-upgrade-${{ matrix.oldver }}
template: https://raw.githubusercontent.com/lima-vm/lima/${{ matrix.oldver }}/examples/ubuntu-lts.yaml
- name: Install test dependencies
run: brew install qemu bash coreutils
- name: Test
Expand Down

0 comments on commit a1050c7

Please sign in to comment.