Skip to content

Commit 154f8eb

Browse files
authored
Merge pull request #1712 from AkihiroSuda/debug-cache
CI: debug cache
2 parents 6deae73 + ee9c332 commit 154f8eb

File tree

4 files changed

+66
-36
lines changed

4 files changed

+66
-36
lines changed

.cirrus.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ common_template: &common_template
2626
- apt-get install -y --no-install-recommends ca-certificates curl git golang jq openssh-client make netcat ovmf sudo qemu-system-x86 qemu-utils
2727
go_cache:
2828
fingerprint_script: uname -s ; cat go.sum
29-
folder: $GOPATH/pkg/mod
29+
folder: /root/go/pkg/mod
3030
build_script: make
3131
install_script: make install
3232
prepare_user_script:
@@ -51,7 +51,9 @@ task:
5151
fingerprint_script: uname -s ; cat templates/$TEMPLATE
5252
folder: /home/testuser/.cache/lima
5353
lima_cache_fix_perm_script: chown -R testuser.testuser /home/testuser
54+
debug_cache_script: sudo -iu testuser $(pwd)/hack/debug-cache.sh
5455
test_script: sudo -iu testuser $(pwd)/hack/test-templates.sh $(pwd)/templates/$TEMPLATE
56+
debug_cache2_script: sudo -iu testuser $(pwd)/hack/debug-cache.sh
5557

5658
colima_task:
5759
<<: *common_template
@@ -68,4 +70,6 @@ colima_task:
6870
fingerprint_script: uname -s ; colima version
6971
folder: /home/testuser/.cache/lima
7072
lima_cache_fix_perm_script: chown -R testuser.testuser /home/testuser
73+
debug_cache_script: sudo -iu testuser $(pwd)/hack/debug-cache.sh
7174
test_script: sudo -iu testuser $(pwd)/hack/test-colima.sh
75+
debug_cache2_script: sudo -iu testuser $(pwd)/hack/debug-cache.sh

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
run: |
2727
sudo xcode-select --switch /Applications/Xcode_14.1.app
2828
xcrun --show-sdk-version
29-
- uses: actions/setup-go@v4
30-
with:
31-
go-version: 1.20.x
3229
- uses: actions/checkout@v3
3330
with:
3431
fetch-depth: 1
32+
- uses: actions/setup-go@v4
33+
with:
34+
go-version: 1.20.x
3535
- name: Make darwin artifacts
3636
run: make artifacts-darwin
3737
- name: "Upload artifacts"

.github/workflows/test.yml

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
runs-on: ubuntu-22.04
1414
timeout-minutes: 30
1515
steps:
16-
- uses: actions/setup-go@v4
17-
with:
18-
go-version: 1.20.x
1916
- uses: actions/checkout@v3
2017
with:
2118
fetch-depth: 1
19+
- uses: actions/setup-go@v4
20+
with:
21+
go-version: 1.20.x
2222
- name: Run golangci-lint
2323
uses: golangci/[email protected]
2424
with:
@@ -54,12 +54,12 @@ jobs:
5454
runs-on: windows-2022
5555
timeout-minutes: 30
5656
steps:
57-
- uses: actions/setup-go@v4
58-
with:
59-
go-version: 1.20.x
6057
- uses: actions/checkout@v3
6158
with:
6259
fetch-depth: 1
60+
- uses: actions/setup-go@v4
61+
with:
62+
go-version: 1.20.x
6363
- name: Unit tests
6464
run: go test -v ./...
6565
- name: Make
@@ -70,12 +70,18 @@ jobs:
7070
runs-on: macos-12
7171
timeout-minutes: 120
7272
steps:
73+
- uses: actions/checkout@v3
74+
with:
75+
fetch-depth: 1
7376
- uses: actions/setup-go@v4
7477
with:
7578
go-version: 1.20.x
76-
- uses: actions/checkout@v3
79+
- name: Cache ~/Library/Caches/lima/download
80+
uses: actions/cache@v3
7781
with:
78-
fetch-depth: 1
82+
path: ~/Library/Caches/lima/download
83+
# hashFiles do not seem to support symlinks
84+
key: ${{ runner.os }}-${{ hashFiles('examples/*.yaml') }}
7985
- name: Unit tests
8086
run: go test -v ./...
8187
- name: Make
@@ -95,11 +101,8 @@ jobs:
95101
# Github runners seem to have lima installed by brew already; we don't want/need it
96102
time brew uninstall --ignore-dependencies lima colima
97103
time brew install qemu bash coreutils curl jq
98-
- name: Cache ~/Library/Caches/lima/download
99-
uses: actions/cache@v3
100-
with:
101-
path: ~/Library/Caches/lima/download
102-
key: ${{ runner.os }}-integration
104+
- name: "Show cache"
105+
run: ./hack/debug-cache.sh
103106
- name: "Test default.yaml"
104107
uses: nick-invision/retry@v2
105108
with:
@@ -130,29 +133,34 @@ jobs:
130133
command: ./hack/test-templates.sh hack/test-templates/test-misc.yaml
131134
# GHA macOS is slow and flaky, so we only test a few YAMLS here.
132135
# Other yamls are tested on Linux instances of Cirrus.
136+
#
137+
- name: "Show cache"
138+
if: always()
139+
run: ./hack/debug-cache.sh
133140

134141
vmnet:
135142
name: "VMNet test"
136143
runs-on: macos-11
137144
timeout-minutes: 120
138145
steps:
146+
- uses: actions/checkout@v3
147+
with:
148+
fetch-depth: 1
139149
- uses: actions/setup-go@v4
140150
with:
141151
go-version: 1.20.x
142-
- uses: actions/checkout@v3
152+
- name: Cache ~/Library/Caches/lima/download
153+
uses: actions/cache@v3
143154
with:
144-
fetch-depth: 1
155+
path: ~/Library/Caches/lima/download
156+
# hashFiles do not seem to support symlinks
157+
key: ${{ runner.os }}-${{ hashFiles('examples/vmnet.yaml') }}
145158
- name: Make
146159
run: make
147160
- name: Install
148161
run: make install
149162
- name: Install test dependencies
150163
run: brew install qemu bash coreutils iperf3
151-
- name: Cache ~/Library/Caches/lima/download
152-
uses: actions/cache@v3
153-
with:
154-
path: ~/Library/Caches/lima/download
155-
key: ${{ runner.os }}-vmnet
156164
- name: Install vde_switch and vde_vmnet (Deprecated)
157165
env:
158166
VDE_VMNET_VERSION: v0.6.0
@@ -209,19 +217,19 @@ jobs:
209217
matrix:
210218
oldver: ["v0.10.0"]
211219
steps:
212-
- uses: actions/setup-go@v4
213-
with:
214-
go-version: 1.20.x
215220
- uses: actions/checkout@v3
216221
with:
217222
fetch-depth: 0
218-
- name: Install test dependencies
219-
run: brew install qemu bash coreutils
223+
- uses: actions/setup-go@v4
224+
with:
225+
go-version: 1.20.x
220226
- name: Cache ~/Library/Caches/lima/download
221227
uses: actions/cache@v3
222228
with:
223229
path: ~/Library/Caches/lima/download
224230
key: ${{ runner.os }}-upgrade-${{ matrix.oldver }}
231+
- name: Install test dependencies
232+
run: brew install qemu bash coreutils
225233
- name: Test
226234
uses: nick-invision/retry@v2
227235
with:
@@ -235,22 +243,23 @@ jobs:
235243
runs-on: macos-13
236244
timeout-minutes: 120
237245
steps:
246+
- uses: actions/checkout@v3
247+
with:
248+
fetch-depth: 1
238249
- uses: actions/setup-go@v4
239250
with:
240251
go-version: 1.20.x
241-
- uses: actions/checkout@v3
252+
- name: Cache ~/Library/Caches/lima/download
253+
uses: actions/cache@v3
242254
with:
243-
fetch-depth: 1
255+
path: ~/Library/Caches/lima/download
256+
# hashFiles do not seem to support symlinks
257+
key: ${{ runner.os }}-${{ hashFiles('examples/experimental/vz.yaml') }}
244258
- name: Make
245259
run: make
246260
- name: Install
247261
run: make install
248262
- name: Install test dependencies
249263
run: brew install qemu bash coreutils
250-
- name: Cache ~/Library/Caches/lima/download
251-
uses: actions/cache@v3
252-
with:
253-
path: ~/Library/Caches/lima/download
254-
key: ${{ runner.os }}-vz
255264
- name: Test
256265
run: ./hack/test-templates.sh templates/experimental/vz.yaml

hack/debug-cache.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -eu -o pipefail
3+
cache_dir="${HOME}/Library/Caches"
4+
if [ "$(uname -s)" != "Darwin" ]; then
5+
cache_dir="${HOME}/.cache"
6+
fi
7+
if [ ! -e "${cache_dir}/lima" ]; then
8+
echo "No cache"
9+
exit 0
10+
fi
11+
for f in "${cache_dir}/lima/download/by-url-sha256/"*; do
12+
echo "$f"
13+
ls -l "$f"
14+
cat "${f}/url"
15+
echo
16+
echo ---
17+
done

0 commit comments

Comments
 (0)