Skip to content

Add macOS compatibility CI: unit tests + smoke test on macos-14/15 - #769

Merged
lawrencecchen merged 3 commits into
mainfrom
task-cicd-macos-unit-tests
Mar 3, 2026
Merged

lawrencecchen merged 3 commits into
mainfrom
task-cicd-macos-unit-tests

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a new ci-macos-compat.yml workflow that runs on GitHub-hosted macos-14 (Sonoma) and macos-15 (Sequoia) runners. The existing CI uses Depot runners (depot-macos-latest), which only covers one macOS version.

Each matrix entry runs:

  1. Unit tests via the cmux-unit scheme (no XCUITests)
  2. A smoke test that builds the app, launches it, connects to the socket, sends a time command, and verifies the app stays alive for 15 seconds

The smoke test script (scripts/smoke-test-ci.sh) is standalone and reusable. It pings the socket, sends a command, waits 15 seconds, then pings again to confirm the app is still responsive.

Testing

  • Existing CI guard tests all pass locally
  • Workflow will run on this PR itself (self-testing)

Related

  • Task: Set up CI/CD for basic unit tests on older macOS versions with smoke test

Summary by CodeRabbit

  • Chores
    • Enhanced macOS compatibility testing in the CI/CD pipeline with automated tests across multiple macOS versions
    • Added automated smoke testing to verify app stability and socket communication on macOS builds

New workflow runs on GitHub-hosted macos-14 and macos-15 runners
(matrix strategy). Each run: unit tests via cmux-unit scheme, then
a smoke test that builds the app, launches it, sends a command via
the socket, and verifies it stays alive for 15 seconds.
@vercel

vercel Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Mar 3, 2026 1:57am

@coderabbitai

coderabbitai Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@lawrencecchen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d3f4124 and b2333bc.

📒 Files selected for processing (2)
  • .github/workflows/ci-macos-compat.yml
  • scripts/smoke-test-ci.sh
📝 Walkthrough

Walkthrough

Adds macOS compatibility testing infrastructure by introducing a GitHub Actions workflow that runs on macOS 14 and 15, downloading a pre-built GhosttyKit.xcframework with retry mechanisms, executing unit tests, and performing an app smoke test via socket communication validation.

Changes

Cohort / File(s) Summary
CI Workflow Configuration
.github/workflows/ci-macos-compat.yml
New workflow for macOS compatibility testing with matrix strategy (macos-14, macos-15), conditional execution for non-fork PRs, retry logic for framework download and Swift package resolution, DerivedData cleanup, unit test execution with failure handling, and smoke test integration.
Test Automation Script
scripts/smoke-test-ci.sh
New smoke test script that locates the built app, manages UNIX socket cleanup, launches the app with socket mode enabled, polls for socket availability (~30s timeout), validates socket responsiveness via Python ping, executes test commands, verifies process stability (15s window), and provides diagnostic output on failures.

Possibly Related PRs

Poem

🐰 Hop, test, and smoke away!
macOS paths we test each day,
Sockets dance, retries hum,
Compatibility checks have come! ✨


🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding macOS compatibility CI with unit tests and smoke tests on two macOS versions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task-cicd-macos-unit-tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3f41245e2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/smoke-test-ci.sh
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect('$SOCKET_PATH')
s.settimeout(5.0)
s.sendall(b'send time\\\n\n')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Encode newline correctly in smoke-test send payload

The Python bytes literal here sends send time\ followed by two real newlines, not send time\\n plus the command terminator. In Sources/TerminalController.swift (sendInput), only the literal sequence \n is converted to Enter, so this payload does not actually execute time in the terminal and the smoke test can pass without validating terminal command delivery.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
.github/workflows/ci-macos-compat.yml (2)

24-42: Consider using find instead of ls for Xcode discovery.

Static analysis flagged ls -d usage. While Xcode app names are predictable, using find would be more robust:

🔧 Suggested improvement
-            XCODE_APP="$(ls -d /Applications/Xcode*.app 2>/dev/null | head -n 1 || true)"
+            XCODE_APP="$(find /Applications -maxdepth 1 -name 'Xcode*.app' -print -quit 2>/dev/null || true)"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci-macos-compat.yml around lines 24 - 42, Replace the
fragile ls-based discovery in the "Select Xcode" step by using a find-based
lookup to set XCODE_APP and then XCODE_DIR: locate the first
/Applications/Xcode*.app using find (instead of the current XCODE_APP="$(ls -d
/Applications/Xcode*.app ... )"), fall back to the existing
/Applications/Xcode.app check, and then export DEVELOPER_DIR and write
DEVELOPER_DIR="$XCODE_DIR" to GITHUB_ENV as before; update references to
XCODE_APP, XCODE_DIR, and DEVELOPER_DIR accordingly so behavior remains
identical but discovery uses find.

135-148: Virtual display PID is stored but not cleaned up.

VDISPLAY_PID is saved to GITHUB_ENV but never used for cleanup. This is fine for ephemeral CI runners, but if you want explicit cleanup, consider adding a post-step or cleanup in the smoke test.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci-macos-compat.yml around lines 135 - 148, The step that
builds and launches the helper binary (/tmp/create-virtual-display) saves the
background process PID to VDISPLAY_PID and writes it to GITHUB_ENV but never
stops the process; add explicit cleanup by capturing VDISPLAY_PID (from
GITHUB_ENV) and killing the process in a subsequent step or a post-job step
(e.g., a "Cleanup virtual display" step or a post-action) that uses kill (or
pkill) against VDISPLAY_PID and removes the /tmp/create-virtual-display binary;
reference the created binary name (/tmp/create-virtual-display), the environment
variable VDISPLAY_PID, and the source scripts/create-virtual-display.m when
locating where to add the complementary cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/ci-macos-compat.yml:
- Around line 24-42: Replace the fragile ls-based discovery in the "Select
Xcode" step by using a find-based lookup to set XCODE_APP and then XCODE_DIR:
locate the first /Applications/Xcode*.app using find (instead of the current
XCODE_APP="$(ls -d /Applications/Xcode*.app ... )"), fall back to the existing
/Applications/Xcode.app check, and then export DEVELOPER_DIR and write
DEVELOPER_DIR="$XCODE_DIR" to GITHUB_ENV as before; update references to
XCODE_APP, XCODE_DIR, and DEVELOPER_DIR accordingly so behavior remains
identical but discovery uses find.
- Around line 135-148: The step that builds and launches the helper binary
(/tmp/create-virtual-display) saves the background process PID to VDISPLAY_PID
and writes it to GITHUB_ENV but never stops the process; add explicit cleanup by
capturing VDISPLAY_PID (from GITHUB_ENV) and killing the process in a subsequent
step or a post-job step (e.g., a "Cleanup virtual display" step or a
post-action) that uses kill (or pkill) against VDISPLAY_PID and removes the
/tmp/create-virtual-display binary; reference the created binary name
(/tmp/create-virtual-display), the environment variable VDISPLAY_PID, and the
source scripts/create-virtual-display.m when locating where to add the
complementary cleanup.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6f6485 and d3f4124.

📒 Files selected for processing (2)
  • .github/workflows/ci-macos-compat.yml
  • scripts/smoke-test-ci.sh

macos-14 runners default to Xcode 15.4, but sentry-cocoa needs
Swift tools version 6.0 (Xcode 16+). Pick the latest Xcode_*.app
instead of the default symlink.
@greptile-apps

greptile-apps Bot commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a comprehensive macOS compatibility CI workflow that tests on both macos-14 (Sonoma) and macos-15 (Sequoia) runners. The implementation follows established patterns from the existing ci.yml workflow, including proper error handling, retry logic for flaky operations, and guards to prevent running on forks.

Key changes:

  • New workflow runs unit tests via cmux-unit scheme (without XCUITests)
  • Includes standalone smoke test script that launches app, verifies socket communication, sends a command, and confirms 15-second stability
  • Proper virtual display setup for GUI testing in headless CI environment
  • Comprehensive retry and error recovery logic for SwiftPM and Xcode build flakiness

The smoke test provides a lightweight sanity check that complements the existing comprehensive test suite. All code follows repository conventions with clean error handling and appropriate timeouts.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects that both new files follow established repository patterns, include comprehensive error handling and retry logic, and only add new CI infrastructure without modifying existing code. The workflow closely mirrors the proven ci.yml patterns, and the smoke test provides valuable coverage for macOS version compatibility.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/ci-macos-compat.yml New macOS compatibility CI workflow targeting macos-14/15 with unit tests and smoke tests; follows established patterns from existing CI with proper error handling and retry logic
scripts/smoke-test-ci.sh New smoke test script that launches app, verifies socket communication, and confirms 15s stability; includes proper error handling, timeouts, and cleanup

Last reviewed commit: 62db3d1

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62db3d190b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/smoke-test-ci.sh
s.close()
print(data)
")
echo "Send response: $SEND_RESPONSE"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail smoke test when send command is rejected

The smoke test captures SEND_RESPONSE but never checks that it is OK, so this workflow can pass even when the terminal command path is broken (for example, if no terminal is focused or send returns an error) as long as the two ping checks succeed. That makes the new compatibility CI report false positives for exactly the command-delivery behavior it is meant to validate.

Useful? React with 👍 / 👎.

Using `open` can fail silently on CI runners. Launch the binary
directly with env vars set, capture stdout/stderr, and add process
health checks with diagnostic output (debug log tail, crash reports)
on failure.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2333bc439

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# Pick the latest Xcode installed on the runner. GitHub-hosted macos-14
# defaults to Xcode 15.4, but the project needs Xcode 16+ (Swift tools
# version 6.0 required by sentry-cocoa).
XCODE_APP="$(ls -d /Applications/Xcode_*.app 2>/dev/null | sort | tail -n 1)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard Xcode glob lookup so fallback can run

Because this step enables set -euo pipefail, the command substitution at XCODE_APP="$(ls -d /Applications/Xcode_*.app ... | sort | tail -n 1)" exits non-zero when no Xcode_*.app matches, and the shell terminates before the /Applications/Xcode.app fallback branch executes. On runner images that only provide Xcode.app (or use a different naming convention), the workflow fails during Xcode selection even though a usable Xcode is installed.

Useful? React with 👍 / 👎.

@lawrencecchen
lawrencecchen merged commit b3f6f8c into main Mar 3, 2026
10 checks passed
@lawrencecchen
lawrencecchen deleted the task-cicd-macos-unit-tests branch March 3, 2026 02:50
bn-l pushed a commit to bn-l/cmux that referenced this pull request Apr 3, 2026
…anaflow-ai#769)

* Add macOS compatibility CI: unit tests + smoke test on macos-14/15

New workflow runs on GitHub-hosted macos-14 and macos-15 runners
(matrix strategy). Each run: unit tests via cmux-unit scheme, then
a smoke test that builds the app, launches it, sends a command via
the socket, and verifies it stays alive for 15 seconds.

* Select latest Xcode on runner (fix macos-14 Swift tools version)

macos-14 runners default to Xcode 15.4, but sentry-cocoa needs
Swift tools version 6.0 (Xcode 16+). Pick the latest Xcode_*.app
instead of the default symlink.

* Launch app binary directly in smoke test for better CI compatibility

Using `open` can fail silently on CI runners. Launch the binary
directly with env vars set, capture stdout/stderr, and add process
health checks with diagnostic output (debug log tail, crash reports)
on failure.
@coderabbitai coderabbitai Bot mentioned this pull request Apr 29, 2026

This branch was successfully deployed

1 active deployment
Preview — b2333bc4 Deployed Mar 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant