-
-
Notifications
You must be signed in to change notification settings - Fork 262
Add macOS Tart VM build documentation #2441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
tallpsmith
wants to merge
4
commits into
performancecopilot:main
from
tallpsmith:macos_tart_vm_build
+186
−4
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b57ddbf
Introduce Cirrus CLI(Tart VM) task file to build PCP in a macOS vm lo…
tallpsmith 27cc95d
Correct macOS installation packaging script to work better inside a T…
tallpsmith 2dbb6d8
Remove execution of unit/integration tests (this is for a different b…
tallpsmith 33c7282
Added documentation
tallpsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| task: | ||
| name: macOS PCP Build | ||
| macos_instance: | ||
| image: ghcr.io/cirruslabs/macos-tahoe-base:latest | ||
| # Cache Homebrew prefix + download cache | ||
| homebrew_cache: | ||
| folder: /opt/homebrew | ||
| # Also cache downloaded bottles to avoid re-downloading on cache miss/rebuild | ||
| # (you can list multiple folders) | ||
| # folders: | ||
| # - /opt/homebrew | ||
| # - ~/Library/Caches/Homebrew | ||
| fingerprint_script: | | ||
| brew --version | ||
| echo $HOMEBREW_NO_AUTO_UPDATE # if you use it | ||
| brew list --versions | sort # list installed formulae & versions | ||
| populate_script: | | ||
| # This runs only on cache miss — safe to install everything here | ||
| echo "Populating Homebrew cache..." | ||
| # Homebrew is already in base images, but we can ensure update if needed | ||
| brew update --quiet || true | ||
| brew install coreutils gnu-tar pkg-config python3 python-setuptools autoconf || true # idempotent | ||
| # Optional: clean up non-deterministic files before cache upload | ||
| before_cache_script: | | ||
| brew cleanup --prune=all || true | ||
| rm -rf ~/Library/Caches/Homebrew/downloads # optional, if too noisy | ||
| #brew_setup_script: | ||
| # Now this will be very fast if cache hit | ||
| #- echo "Setting up dependencies (cached!)" | ||
| # - brew install coreutils gnu-tar pkg-config python3 python-setuptools autoconf || true # idempotent | ||
| pcp_build_script: | | ||
| [ "$PCP_SKIP_BUILD" == "true" ] && echo "SKIPPING BUILD" || ./Makepkgs --verbose | ||
| pcp_install_script: | | ||
| DMG_PATH=$(find pcp-**/build/mac -name "pcp-*.dmg" | head -1) # Find the generated DMG | ||
| echo "Found DMG: $DMG_PATH" | ||
| MOUNT_OUTPUT=$(hdiutil attach "$DMG_PATH" | tail -1) # Mount the DMG | ||
| VOLUME_PATH=$(echo "$MOUNT_OUTPUT" | awk '{print $3}') | ||
| echo "Mounted at: $VOLUME_PATH" | ||
| PKG_PATH=$(find "$VOLUME_PATH" -name "*.pkg" | head -1) # Find and install the PKG | ||
| echo "Found PKG: $PKG_PATH" | ||
| ls -alh $PKG_PATH | ||
| pkgutil --check-signature $PKG_PATH || true # this returns 1 when things are ok | ||
| sudo installer -pkg "$PKG_PATH" -target / -verbose # Install (sudo is passwordless in GitHub Actions) | ||
| check_pmcd_is_running_postinstall_script: | | ||
| echo "Waiting for pcp service to start (it can take a while after install)..." | ||
| TIMEOUT=180 # 3 minutes | ||
| ELAPSED=0 | ||
| INTERVAL=5 | ||
|
|
||
| while [ $ELAPSED -lt $TIMEOUT ]; do | ||
| if pcp 2>/dev/null; then | ||
| echo "pcp service is responding" | ||
| break | ||
| fi | ||
| sleep $INTERVAL | ||
| ELAPSED=$((ELAPSED + INTERVAL)) | ||
| done | ||
|
|
||
| if [ $ELAPSED -ge $TIMEOUT ]; then | ||
| echo "ERROR: pcp service failed to start within $TIMEOUT seconds" | ||
| exit 1 | ||
| fi | ||
| pause_script: | | ||
| if [ "$PCP_PAUSE_AFTER_INSTALL" == "true" ]; then | ||
| echo "VM IP: $(ipconfig getifaddr en0)" | ||
| sleep 3600 # Keeps VM alive for an hour | ||
| else | ||
| echo "No pause required, finishing" | ||
| fi | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # macOS Development with Tart VMs | ||
|
|
||
| ## Overview | ||
|
|
||
| Developing PCP on MacOS has some quirks. | ||
| We provide Tart VM/CirrusLabs CLI configuration to allow an isolated macOS virtual machine for reproducible, clean-room builds that match the CI environment. | ||
|
|
||
| **Why Tart VMs?** | ||
| - macOS cannot be containerized (no Podman support) | ||
| - Lightweight, fast virtualization using native macOS frameworks | ||
| - Eliminates environment differences between developers | ||
| - Matches GitHub Actions CI as close as possible | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Install Tart and Cirrus CLI: | ||
|
|
||
| ```bash | ||
| brew install cirruslabs/cli/tart cirruslabs/cli/cirrus | ||
| ``` | ||
|
|
||
| ## Basic Usage | ||
|
|
||
| Build PCP in a fresh VM: | ||
|
|
||
| ```bash | ||
| cirrus run --dirty | ||
| ``` | ||
|
|
||
| Note: The `--dirty` flag is required to preserve executable permissions when copying the git tree to the VM. | ||
|
|
||
| ## Useful Options | ||
|
|
||
| ### Simpler Output | ||
|
|
||
| Use `--output simple` to see the complete build log (by default it is very concise): | ||
|
|
||
| ```bash | ||
| cirrus run --dirty --output simple | ||
| ``` | ||
|
|
||
| ### Skip Build (Reuse Existing Package) | ||
|
|
||
| If a valid macOS PKG already exists from a previous successful build, skip the build phase (you'll save 5 minutes!): | ||
|
|
||
| ```bash | ||
| cirrus run --dirty -e PCP_SKIP_BUILD=true | ||
| ``` | ||
|
|
||
| Useful for testing installation without waiting for a full rebuild. | ||
|
|
||
| ### Debug in VM via SSH | ||
|
|
||
| Pause the VM after installation to explore interactively: | ||
|
|
||
| ```bash | ||
| cirrus run --dirty -e PCP_PAUSE_AFTER_INSTALL=true | ||
| ``` | ||
|
|
||
| The build log will show the VM IP address. Connect with: | ||
|
|
||
| ```bash | ||
| ssh admin@<ip-address> # Password: admin | ||
| ``` | ||
|
|
||
| The VM stays alive for up to 1 hour. Press `CTRL-C` to terminate when finished. | ||
|
|
||
| ## Understanding .cirrus.yml | ||
|
|
||
| The `.cirrus.yml` file defines the build task: | ||
|
|
||
| - **Homebrew cache**: Caches `/opt/homebrew` to speed up subsequent builds | ||
| - **Build script**: Runs `./Makepkgs --verbose` (skipped if `PCP_SKIP_BUILD=true`) | ||
| - **Install script**: Mounts the generated DMG and installs the PKG | ||
| - **Verification**: Waits for pmcd service to start, validates installation | ||
| - **Pause script**: Optionally pauses VM if `PCP_PAUSE_AFTER_INSTALL=true` | ||
|
|
||
| See [.cirrus.yml](.cirrus.yml) for implementation details. | ||
|
|
||
| ## Documentation | ||
|
|
||
| - [Tart Virtualization](https://tart.run/) - Official documentation | ||
| - [Tart on GitHub](https://github.com/cirruslabs/tart) - Source and issues | ||
| - [Tart Quick Start](https://tart.run/quick-start/) - Getting started | ||
| - [Cirrus CLI Integration](https://tart.run/integrations/cirrus-cli/) - How Cirrus CLI works with Tart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use $tmp here, which is securely setup, rather than hard-coded /tmp?