ci(minvmd): run macOS tests on the self-hosted Apple Silicon runner - #283
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughAdds ChangesmacOS CI workflow and FFI smoke testing
Sequence Diagram(s)sequenceDiagram
participant GitHub as GitHub (push/PR/workflow_dispatch)
participant Workflow as ci-macos workflow
participant RunnerQueue as Runner queue
participant Runner as Self-hosted macOS ARM64 Runner
participant Rustup as rustup (stable + clippy)
participant FS as Filesystem (/opt/homebrew/lib/libkrun.dylib)
participant Cargo as Cargo (clippy/tests)
GitHub->>Workflow: trigger ci-macos on matching paths/refs
Workflow->>Workflow: set env, concurrency, permissions
Workflow->>RunnerQueue: enqueue build-macos job (if RUN_MACOS_CI != 'false')
RunnerQueue->>Runner: start job on self-hosted macOS ARM64
Runner->>Rustup: install stable toolchain + clippy
Runner->>FS: verify /opt/homebrew/lib/libkrun.dylib
Runner->>Cargo: run cargo clippy -p minvmd --all-targets -- -D warnings
Runner->>Cargo: run cargo test -p minvmd
Runner->>Cargo: run MINVMD_E2E=1 cargo test -p minvmd --test krun_smoke -- --include-ignored
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 76-84: The build-macos job currently runs unconditionally and can
hang waiting for an offline self-hosted runner; add a gate to skip it when the
runner isn't available by adding an if: condition to the build-macos job
(referencing the job name build-macos and its runs-on/timeout-minutes settings)
that checks a repository or workflow input variable (e.g., a repo secret or
github.event.inputs flag like run_macos) so the job only runs when that flag
indicates the mac runner is online or when manually triggered; alternatively
move build-macos behind a workflow_dispatch/manual trigger and document the
required flag to enable the job.
- Around line 83-86: The build-macos job is inheriting workflow-wide write
permissions; add a job-level permissions override to restrict the token to
read-only for checkout-sensitive actions: under the job named build-macos (the
job that runs on [self-hosted, macOS, ARM64] and uses actions/checkout@v6) add a
permissions block with contents: read (and no broader scopes) so the self-hosted
runner does not receive a write token.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 444ce649-6f5b-4f25-b0c6-cac437951881
📒 Files selected for processing (1)
.github/workflows/ci.yml
Address CodeRabbit on PR #283: - Gate build-macos behind the RUN_MACOS_CI repo variable (defaults to enabled). timeout-minutes counts time queued for a self-hosted runner, so set RUN_MACOS_CI=false to skip the job while the runner is offline rather than letting it stall and time out. - Add job-level `permissions: contents: read` (workflow level is contents: write) and `persist-credentials: false` on checkout, since the job only builds and runs on a persistent self-hosted runner. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci-macos.yml:
- Around line 10-21: The ci-macos workflow is referencing a non-existent crate
and tests (paths: "crates/minvmd/**" and cargo invocation "cargo ... -p minvmd
--test krun_smoke"), so update .github/workflows/ci-macos.yml to point at the
real crate and test targets used in this repo (replace the paths filter entries
and the cargo package/test names such as "-p minvmd", "--test krun_smoke", and
any mention of "krun_start_enter" with the actual crate directory/package name
and test target present in this repo), or alternatively ensure the missing
minvmd package and tests are added/submoduled/generated so the existing filters
and cargo flags are valid.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8d2d9659-6195-46af-b738-7dea88931877
📒 Files selected for processing (1)
.github/workflows/ci-macos.yml
Add a build-macos job to CI on the org self-hosted runner (jks-Mac-mini, labels self-hosted/macOS/ARM64). minvmd links libkrun and only compiles on macOS, so its krun module and FFI smoke have had no CI coverage — the Linux jobs build it as a stub. The job ensures libkrun is installed, then runs clippy + tests for minvmd and the libkrun FFI smoke (MINVMD_E2E=1, create_ctx -> set_vm_config -> set_exec; skips krun_start_enter so no codesigned hypervisor entitlement is needed). Scoped to minvmd, the only macOS-gated crate; widen to --workspace once the rest of the tree is confirmed mac-buildable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
libkrun is not in homebrew-core; `brew install libkrun` fails with "no available formula". Use the fully-qualified `slp/krun/libkrun`, which auto-taps github.com/slp/homebrew-krun. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address CodeRabbit on PR #283: - Gate build-macos behind the RUN_MACOS_CI repo variable (defaults to enabled). timeout-minutes counts time queued for a self-hosted runner, so set RUN_MACOS_CI=false to skip the job while the runner is offline rather than letting it stall and time out. - Add job-level `permissions: contents: read` (workflow level is contents: write) and `persist-credentials: false` on checkout, since the job only builds and runs on a persistent self-hosted runner. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The self-hosted Apple Silicon runner is a single shared bottleneck. Two optimizations so it doesn't block CI on a large repo: - Move build-macos out of ci.yml into ci-macos.yml, scoped via on.*.paths to crates/minvmd/**, Cargo.toml, Cargo.lock, and the workflow itself. PRs that don't touch minvmd skip the workflow entirely, leaving the runner free. - Warm builds: checkout with clean: false so the persistent runner's target/ survives between runs instead of cold-rebuilding minvmd's dependency tree every time. concurrency cancel-in-progress (carried over) keeps superseded commits from queueing on the one runner. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
clean: false on the persistent self-hosted runner let a prior checkout's crates/minvmd and target/ persist, so the job compiled and "passed" code that was not in the branch — a false green (the branch was forked from main before minvmd merged). Use the default clean checkout: correctness over a warm-build speedup on a shared runner. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
af4f5f0 to
1a69059
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci-macos.yml:
- Around line 44-49: The workflow currently treats an unset RUN_MACOS_CI repo
variable as enabled because it checks for inequality with 'false'; change the
job condition so the macOS self-hosted job only runs when RUN_MACOS_CI is
explicitly set to 'true' (i.e., require equality to 'true' rather than checking
!= 'false'), which prevents PRs from queuing on self-hosted macOS runners by
default; update the workflow's if condition that references RUN_MACOS_CI
accordingly and leave the runs-on/timeout configuration unchanged.
- Around line 62-67: The workflow is disabling Homebrew tap trust by setting
HOMEBREW_NO_REQUIRE_TAP_TRUST="1", which bypasses tap verification before
running the conditional installation (the brew install slp/krun/libkrun step);
remove that environment override and instead ensure the tap is trusted or
preprovision libkrun on the runner (e.g., remove HOMEBREW_NO_REQUIRE_TAP_TRUST
from the env block and add a preparatory step that either runs brew tap
--repair/--trust for slp/krun or installs libkrun in the runner image so the
conditional if [ ! -f /opt/homebrew/lib/libkrun.dylib ] ; then brew install
slp/krun/libkrun ; fi runs without bypassing trust).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 081eeb9d-0095-4553-9bd1-40262c257d5c
📒 Files selected for processing (1)
.github/workflows/ci-macos.yml
Address CodeRabbit: HOMEBREW_NO_REQUIRE_TAP_TRUST=1 bypassed Homebrew's tap trust, and auto-installing the third-party slp/krun tap on a persistent self-hosted runner is a supply-chain risk. Provision libkrun as part of runner setup; CI now only verifies the dylib is present and fails with a clear message otherwise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The self-hosted Apple Silicon runner (jks-Mac-mini) is shared with gominimal/minimal-vm-mac's apple/container nightly matrix. libkrun and apple/container both drive Virtualization.framework. Leaving the apple/container BuildKit builder VM running after this job wedges it with stale runc-native snapshot mounts, after which the next tenant's `container build` RUN steps fail with "operation not permitted" unmounting /var/lib/buildkit/runc-native/ snapshots — observed deterministically on the matrix's `latest` entry on 06-02, the first day this workflow ran on the shared runner (gominimal/minimal-vm-mac#25). Add an always() cleanup step that deletes the builder and stops the apple/container system so the next workload starts from clean BuildKit state. Best-effort and guarded: no-op when the container CLI is absent, never fails this job. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Added a post-job cleanup step to This workflow shares the self-hosted runner ( Same apple/container 0.12.3 had passed every prior night. Details and correlation: gominimal/minimal-vm-mac#25. The new Defense-in-depth on the matrix side: gominimal/minimal-vm-mac#26 recreates the builder at job start. |
This reverts commit 1a56282.
|
Retracting the previous comment and reverting the cleanup commit ( The change was wrong. libkrun uses Hypervisor.framework directly; apple/container uses Virtualization.framework — different APIs — and this workflow never invokes the The builder wedge belongs to minimal-vm-mac's matrix itself (sequential apple/container version-switching on the shared runner without recreating the builder) and is fixed there in gominimal/minimal-vm-mac#26. No change to this PR is warranted. |
Adds a
build-macosjob to.github/workflows/ci.yml, running on the org self-hosted Apple Silicon runner (jks-Mac-mini— labelsself-hosted, macOS, ARM64).Why
minvmdlinks libkrun (#[link(name = "krun")]) and only compiles on macOS; the Linux CI builds it as a runtime stub. ItskrunFFI module, safe wrappers, and smoke test have had zero CI coverage until now.What it runs
libkrunis installed (brew install libkrunif missing).cargo clippy -p minvmd --all-targets -- -D warnings(mac-only code path).cargo test -p minvmd(unit tests; the boot smoke stays#[ignore]).MINVMD_E2E=1 cargo test -p minvmd --test krun_smoke -- --include-ignored— exercisescreate_ctx → set_vm_config → set_execagainst real libkrun. Skipskrun_start_enter(no kernel/rootfs), so no codesigned hypervisor entitlement is required.Scope / notes
minvmd(the only macOS-gated crate). Widen to--workspaceonce the rest of the tree is confirmed mac-buildable.paths-ignore(docs/markdown changes don't trigger it).🤖 Generated with Claude Code
Summary by CodeRabbit