Skip to content

Test also vm-to-host #143

Test also vm-to-host

Test also vm-to-host #143

Workflow file for this run

# SPDX-FileCopyrightText: The vmnet-helper authors
# SPDX-License-Identifier: Apache-2.0
---
name: Integration
on:
pull_request:
push:
branches:
- main
jobs:
example:
name: Example
# macos-15 (arm64) does not support nested virtualization yet.
runs-on: macos-13
strategy:
fail-fast: false
matrix:
driver: [vfkit, qemu]
connection: [fd, socket]
exclude:
- driver: qemu
connection: socket
steps:
- name: Host info
run: |
uname -a
sw_vers
ifconfig
- name: Install requirements
run: brew install meson qemu cdrtools coreutils tree
- name: Inspect qemu
# Looking up both prefixes to make it eaier to port to arm64 in the future.
run: |
tree -h /usr/local/share/qemu || true
tree -h /opt/homebrew/share/qemu || true
- name: Install vfkit
if: matrix.driver == 'vfkit'
run: |
curl -LO https://github.com/crc-org/vfkit/releases/download/v0.6.0/vfkit
sudo install vfkit /usr/local/bin/
- name: Checkout source
uses: actions/checkout@v4
- name: Build vmnet-helper
run: |
meson setup build
meson compile -C build
- name: Install vmnet-helper
run: |
sudo meson install -C build
sudo install -m 0640 sudoers.d/vmnet-helper /etc/sudoers.d/
- name: Ensure bootpd is enabled
run: |
fw=/usr/libexec/ApplicationFirewall/socketfilterfw
sudo $fw --remove /usr/libexec/bootpd
sudo $fw --add /usr/libexec/bootpd
sudo $fw --unblock /usr/libexec/bootpd
- name: Ensure public key
run: |
ssh-keygen -q -N "" </dev/zero
- name: Create virtual env
run: |
python3 -m venv .venv
.venv/bin/pip install pyyaml
- name: Start example VM
run: |
source .venv/bin/activate
./example test --driver ${{ matrix.driver }} --connection ${{ matrix.connection }} -v &
vm="$HOME/.vmnet-helper/vms/test"
if ! timeout 3m bash -c "until test -f "$vm/ip-address"; do sleep 3; done"; then
echo >&2 "Timeout waiting for $vm/ip-address"
exit 1
fi
- name: Inspect VM host data
if: always()
run: |
tree -h ~/.vmnet-helper
vm="$HOME/.vmnet-helper/vms/test"
vm_files=$(find "$vm" -name "*.command" -or -name "*.log")
for f in $vm_files /var/db/dhcpd_leases; do
echo "==> $f <=="
head -n 500 "$f" || true
done
- name: Inspect VM guest data
run: |
vm_ip=$(cat $HOME/.vmnet-helper/vms/test/ip-address)
ssh_cmd="ssh -o StrictHostKeyChecking=no -o LogLevel=ERROR -l ubuntu $vm_ip"
echo "uname: $($ssh_cmd uname -a)"
echo "cmdline: $($ssh_cmd cat /proc/cmdline)"
- name: Prepare example VM
run: |
vm_ip=$(cat $HOME/.vmnet-helper/vms/test/ip-address)
ssh_cmd="ssh -o StrictHostKeyChecking=no -o LogLevel=ERROR -l ubuntu $vm_ip"
$ssh_cmd sudo apt-get update -y
$ssh_cmd sudo DEBIAN_FRONTEND=noninteractive apt-get install -y iperf3
$ssh_cmd sudo systemctl start iperf3.service
- name: Run iperf3 (host to vm)
run: |
vm_ip=$(cat $HOME/.vmnet-helper/vms/test/ip-address)
iperf3-darwin -c $vm_ip
- name: Run iperf3 (vm to host)
run: |
vm_ip=$(cat $HOME/.vmnet-helper/vms/test/ip-address)
iperf3-darwin -c $vm_ip --reverse