Skip to content

Commit c0334c5

Browse files
authored
Merge pull request #1511 from AkihiroSuda/ci-vz
CI: add vz
2 parents bff25e5 + 4a7747c commit c0334c5

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

.github/workflows/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,28 @@ jobs:
229229
retry_on: error
230230
max_attempts: 3
231231
command: ./hack/test-upgrade.sh ${{ matrix.oldver }} ${{ github.sha }}
232+
233+
vz:
234+
name: "vz"
235+
runs-on: macos-13
236+
timeout-minutes: 120
237+
steps:
238+
- uses: actions/setup-go@v4
239+
with:
240+
go-version: 1.20.x
241+
- uses: actions/checkout@v3
242+
with:
243+
fetch-depth: 1
244+
- name: Make
245+
run: make
246+
- name: Install
247+
run: make install
248+
- name: Install test dependencies
249+
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
255+
- name: Test
256+
run: ./hack/test-example.sh examples/experimental/vz.yaml

hack/test-example.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ NAME="$(basename -s .yaml "$FILE")"
1616
INFO "Validating \"$FILE\""
1717
limactl validate "$FILE"
1818

19+
# --cpus=1 is needed for running vz on GHA: https://github.com/lima-vm/lima/pull/1511#issuecomment-1574937888
20+
LIMACTL_CREATE_SET='.cpus = 1 | .memory="1GiB"'
21+
# TODO: add "limactl create" command
22+
LIMACTL_CREATE_AND_START=(limactl start --tty=false --set="${LIMACTL_CREATE_SET}")
23+
1924
declare -A CHECKS=(
2025
["systemd"]="1"
2126
["systemd-strict"]="1"
@@ -60,6 +65,12 @@ case "$NAME" in
6065
CHECKS["snapshot-online"]=""
6166
CHECKS["user-v2"]=1
6267
;;
68+
"vz")
69+
CHECKS["systemd-strict"]=
70+
CHECKS["port-forwards"]=""
71+
CHECKS["snapshot-online"]=""
72+
CHECKS["snapshot-offline"]=""
73+
;;
6374
esac
6475

6576
if limactl ls -q | grep -q "$NAME"; then
@@ -83,8 +94,8 @@ function diagnose() {
8394
NAME="$1"
8495
set -x +e
8596
tail "$HOME/.lima/${NAME}"/*.log
86-
limactl shell "$NAME" systemctl status
87-
limactl shell "$NAME" systemctl
97+
limactl shell "$NAME" systemctl --no-pager status
98+
limactl shell "$NAME" systemctl --no-pager
8899
limactl shell "$NAME" sudo cat /var/log/cloud-init-output.log
89100
set +x -e
90101
}
@@ -102,7 +113,7 @@ if [[ -n ${CHECKS["disk"]} ]]; then
102113
fi
103114

104115
set -x
105-
if ! limactl start --tty=false "$FILE"; then
116+
if ! "${LIMACTL_CREATE_AND_START[@]}" "$FILE"; then
106117
ERROR "Failed to start \"$NAME\""
107118
diagnose "$NAME"
108119
exit 1
@@ -317,7 +328,7 @@ fi
317328
if [[ -n ${CHECKS["user-v2"]} ]]; then
318329
INFO "Testing user-v2 network"
319330
secondvm="$NAME-1"
320-
limactl start "$FILE" --name "$secondvm" --tty=false
331+
"${LIMACTL_CREATE_AND_START[@]}" "$FILE" --name "$secondvm"
321332
guestNewip="$(limactl shell "$secondvm" ip -4 -j addr show dev eth0 | jq -r '.[0].addr_info[0].local')"
322333
INFO "IP of $secondvm is $guestNewip"
323334
set -x

0 commit comments

Comments
 (0)