Skip to content

fix: add x86_64 CI verification and fix cross-compilation macro errors#544

Open
Sagart-cactus wants to merge 1 commit intosteipete:mainfrom
Sagart-cactus:fix/x86_64-ci-verification-and-macro-fixes
Open

fix: add x86_64 CI verification and fix cross-compilation macro errors#544
Sagart-cactus wants to merge 1 commit intosteipete:mainfrom
Sagart-cactus:fix/x86_64-ci-verification-and-macro-fixes

Conversation

@Sagart-cactus
Copy link

Summary

PR #331 made package_app.sh default to universal binaries — great for Intel users. However, CI only ran swift test on the arm64 runner, so x86_64-breaking regressions could still merge silently and corrupt those universal release builds.

This PR closes that gap and fixes two existing x86_64 compilation failures that were already present.

Why

Without an x86_64 build step in CI, the universal binary guarantee is only as good as the last time someone manually verified it. These failures were invisible on arm64 and would have shipped in the next release.

Changes

.github/workflows/ci.yml

  • Added a swift build -c release --arch x86_64 step (cross-compiles all three products from the arm64 runner — catches arm64-only APIs and conditional code)
  • Added a package_app.sh release step with CODEXBAR_SIGNING=adhoc that verifies the output binary contains both slices via lipo -archs

Sources/CodexBar/MenuHighlightStyle.swift

  • Replaced @Entry macro with the explicit EnvironmentKey pattern — SwiftUIMacros.EntryMacro is unavailable when cross-compiling to x86_64. Functionally identical on arm64.

Scripts/package_app.sh

  • Added patch_keyboard_shortcuts_recorder(), parallel to the existing patch_keyboard_shortcuts(), that strips #Preview blocks from KeyboardShortcuts/Recorder.swift before the build loop — PreviewsMacros is similarly unavailable during x86_64 cross-compilation. No runtime impact on either architecture.

Testing

Verified locally on an Apple Silicon Mac:

ARCHES="arm64 x86_64" CODEXBAR_SIGNING=adhoc ./Scripts/package_app.sh release
lipo -archs CodexBar.app/Contents/MacOS/CodexBar
# x86_64 arm64

The app also launched and ran correctly from the resulting bundle.

Copy link

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

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: d49e63909c

ℹ️ 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".

run: swift test --no-parallel

- name: Compile for x86_64
run: swift build -c release --arch x86_64 --product CodexBar --product CodexBarCLI --product CodexBarClaudeWatchdog

Choose a reason for hiding this comment

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

P2 Badge Build each x86_64 product in separate SwiftPM invocations

The new x86_64 verification step passes --product three times on one swift build command, but swift build --help defines this as a singular option (--product <product> Build the specified product.), so only the last product is actually validated. In this workflow that means the step compiles CodexBarClaudeWatchdog but does not verify CodexBar or CodexBarCLI for x86_64 here, leaving the intended coverage gap in this check.

Useful? React with 👍 / 👎.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

Sagart-cactus added a commit to Sagart-cactus/CodexBar that referenced this pull request Mar 17, 2026
swift build only accepts a single --product flag; passing multiple flags
means only the last product is actually built. Split into three separate
invocations to ensure all products are verified for x86_64.

Fixes Codex bot feedback on PR steipete#544.
@Sagart-cactus Sagart-cactus force-pushed the fix/x86_64-ci-verification-and-macro-fixes branch 3 times, most recently from eeb5038 to e7dd1fd Compare March 17, 2026 05:02
- Add x86_64 build step that compiles CodexBar, CodexBarCLI, and CodexBarClaudeWatchdog
- Patch Recorder.swift to strip #Preview blocks (PreviewsMacros unavailable in CLI builds)
- Use perl one-liner instead of Python heredoc to avoid YAML indentation parse error
@Sagart-cactus Sagart-cactus force-pushed the fix/x86_64-ci-verification-and-macro-fixes branch from e7dd1fd to 2c12920 Compare March 17, 2026 05:03
@ratulsarna
Copy link
Collaborator

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Nice work!

ℹ️ 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".

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.

2 participants