Skip to content

Commit cf43e44

Browse files
committed
M3: add cli stage (cocoon-macos vm run clones+boots tahoe:26 + SSH test) + setup-go in workflow
1 parent 08aa3a2 commit cf43e44

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/build-macos-image.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ jobs:
6666
| sudo tar -xz -C /usr/local/bin oras
6767
oras version
6868
69+
- name: Set up Go (for the cli stage's go build)
70+
if: ${{ github.event.inputs.stage == 'cli' }}
71+
uses: actions/setup-go@v6
72+
with:
73+
go-version-file: 'go.mod'
74+
6975
- name: Build (stage=${{ github.event.inputs.stage }})
7076
run: bash scripts/build-qemu-macos.sh
7177

scripts/build-qemu-macos.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,33 @@ stage_verify() { # boot the turnkey tahoe:26 (OpenCore auto-boots it via HideAu
315315
[[ -n "$ok" ]] && log "VERIFY PASS: turnkey macOS boots + SSH works" || log "VERIFY: SSH not reachable yet (inspect vf-*.png + ssh-output.txt)"
316316
}
317317

318+
stage_cli() { # M3: clone+launch tahoe:26 via the Go CLI (cocoon-macos vm run), then SSH in
319+
cd "$ROOT_DIR"
320+
go build -o "$WORKDIR/cocoon-macos" . || { log "go build failed"; return 1; }
321+
log "built cocoon-macos: $("$WORKDIR/cocoon-macos" vm --help 2>&1 | head -1)"
322+
local sd="$WORKDIR/cli-state"
323+
"$WORKDIR/cocoon-macos" vm run "$OSX_KVM_DIR/$QCOW2_NAME" \
324+
--name t1 --cpus "$CPUS" --memory "$MEMORY" --vnc "$VNC_DISP" --ssh-port "$SSH_PORT" \
325+
--opencore "$OSX_KVM_DIR/OpenCore/OpenCore.qcow2" \
326+
--ovmf-code "$OSX_KVM_DIR/OVMF_CODE_4M.fd" \
327+
--ovmf-vars "$OSX_KVM_DIR/OVMF_VARS-1920x1080.fd" \
328+
--state-dir "$sd" || { log "cocoon-macos vm run failed"; return 1; }
329+
"$WORKDIR/cocoon-macos" vm list --state-dir "$sd"
330+
QEMU_PID="$(cat "$sd/vms/t1/qemu.pid" 2>/dev/null || echo "")"
331+
log "CLI launched VM (pid $QEMU_PID); OpenCore auto-boots macOS; waiting for SSH"
332+
sleep 180
333+
local ok="" w
334+
for w in $(seq 1 12); do
335+
if sshpass -p cocoon ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 \
336+
-p "$SSH_PORT" cocoon@localhost 'sw_vers; hostname; id' >"$ARTIFACT_DIR/cli-ssh.txt" 2>&1; then
337+
ok=1; log "M3 CLI SSH OK:"; cat "$ARTIFACT_DIR/cli-ssh.txt"; break
338+
fi
339+
log "CLI SSH attempt $w not ready"; sleep 30
340+
done
341+
[[ -n "$ok" ]] && log "=== M3 PASS: cocoon-macos vm run clones + boots macOS + SSH works ===" \
342+
|| log "M3 CLI: SSH not reachable (inspect $ARTIFACT_DIR/cli-ssh.txt)"
343+
}
344+
318345
main() {
319346
require_kvm
320347
setup_osx_kvm
@@ -327,6 +354,8 @@ main() {
327354
pull_image "$GHCR_TAG-base"; fetch_recovery; launch_qemu; stage_setup ;;
328355
verify)
329356
pull_image "$GHCR_TAG"; configure_opencore hide; launch_qemu; stage_verify ;;
357+
cli)
358+
pull_image "$GHCR_TAG"; configure_opencore hide; stage_cli ;;
330359
*)
331360
log "unknown STAGE=$STAGE"; exit 2 ;;
332361
esac

0 commit comments

Comments
 (0)