Skip to content

fix: native macOS builds silently ignored almost every CLI option - #64

Merged
frostebite merged 1 commit into
mainfrom
fix-mac-build-env-passthrough
Aug 13, 2026
Merged

fix: native macOS builds silently ignored almost every CLI option#64
frostebite merged 1 commit into
mainfrom
fix-mac-build-env-passthrough

Conversation

@frostebite

Copy link
Copy Markdown
Member

Severity-1 bug found while auditing for other regressions

Found while systematically diffing cli's build scripts against unity-builder's real source (via unity-engine-core), after the Docker commands-ignored bug in #61 turned up the same way.

MacBuilder.run() invokes entrypoint.sh via System.run(), but never converted any parsed CLI option (--unity-serial, --project-path, --target-platform, --build-name, licensing, Android signing — everything) into an environment variable. System.run()'s underlying spawn() call had no env override at all, so it fell back to inheriting the cli process's own environment. In practice: game-ci build on macOS only respected CLI flags if a user also manually exported every setting as a real shell env var outside of cli's own options — the flags themselves were silently ignored on macOS specifically (Docker-based builds on Linux/Windows were unaffected, since Docker.run() already constructs explicit --env flags from options).

Also found while confirming this:

  • entrypoint.sh/build.sh on mac reference $ACTION_FOLDER and $GITHUB_WORKSPACE, neither of which ImageEnvironmentFactory produces (Docker gets these via explicit --env flags and volume-mount path remapping instead, which doesn't apply to a native process). Added both directly from options.cliDistPath/options.currentWorkDir.
  • mac/steps/activate.sh had no Unity Licensing Server (floating license) branch at all — UNITY_LICENSING_SERVER was silently ignored and activation always attempted (likely empty) serial-mode auth instead. Linux and Windows already handle this correctly; ported the same structure the real unity-builder source uses on mac (confirmed via unity-engine-core).

Fix

  • System.run()'s RunOptions gains an env field, merged on top of the current process env when spawning (existing callers unaffected — omitting it preserves today's inherit-everything behavior).
  • MacBuilder.run() now builds a full env var map from options, reusing the exact same ImageEnvironmentFactory/UnityEnvironment construction the already-tested Docker path uses, and passes it through via the new env option.
  • mac/steps/activate.sh gets the missing UNITY_LICENSING_SERVER branch, matching Linux/Windows and real unity-builder.

Testing

  • New tests: mac-builder.test.ts (env map construction: generic options, GITHUB_WORKSPACE/ACTION_FOLDER, Unity-only vars gated by engine, empty/undefined values omitted) and system.test.ts (env merge vs. inherit-by-default, using a node -e probe command that works identically under sh and powershell).
  • bash -n syntax-checked the modified shell script.
  • Full suite: bun test — 122 pass, 0 fail. bun run build — builds clean.

I don't have a real macOS + Unity environment to verify end-to-end, so this is verified at the unit level (env map construction, script syntax) rather than a live build — flagging that explicitly rather than claiming full verification.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Severity-1 bug found while auditing cli's build scripts against
unity-builder's real source (via unity-engine-core) for other
divergence, after finding and fixing the Docker `commands`-ignored
bug in #61.

MacBuilder.run() invoked entrypoint.sh via System.run() but never
converted any parsed option (--unity-serial, --project-path,
--target-platform, --build-name, licensing, Android signing, etc.)
into an environment variable. System.run()'s underlying spawn() call
had no `env` override at all, so it fell back to inheriting the cli
process's own environment - meaning `game-ci build` on macOS only
worked at all if a user separately, manually exported every setting
as a real shell env var outside of cli's own flags, silently ignoring
everything passed via CLI options.

Also found while confirming this: mac's entrypoint.sh/build.sh
reference $ACTION_FOLDER and $GITHUB_WORKSPACE, neither of which
ImageEnvironmentFactory produces (Docker builds get these via
explicit --env flags and volume-mount remapping instead) - added
both directly from options.cliDistPath/options.currentWorkDir.

And: mac's activate.sh had no Unity Licensing Server (floating
license) branch at all - UNITY_LICENSING_SERVER was silently ignored
and activation always attempted (likely empty) serial mode instead.
Linux and Windows already had this; ported the same structure real
unity-builder uses on mac.

Fix:
- System.run()'s RunOptions gains an `env` field, merged on top of
  the current process env when spawning.
- MacBuilder.run() now builds a full env var map from options (reusing
  the same ImageEnvironmentFactory/UnityEnvironment construction
  Docker builds already use and trust) and passes it through.
- mac activate.sh gets the missing UNITY_LICENSING_SERVER branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@frostebite, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 95 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 03910189-b238-4287-a759-8f4f94c2cde4

📥 Commits

Reviewing files that changed from the base of the PR and between 9e677a3 and 3ad212a.

⛔ Files ignored due to path filters (2)
  • dist/index.js is excluded by !**/dist/**
  • dist/platforms/mac/steps/activate.sh is excluded by !**/dist/**
📒 Files selected for processing (4)
  • src/model/mac-builder.test.ts
  • src/model/mac-builder.ts
  • src/model/system/system.test.ts
  • src/model/system/system.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@frostebite
frostebite merged commit 6f8e30e into main Aug 13, 2026
8 checks passed
@frostebite
frostebite deleted the fix-mac-build-env-passthrough branch August 13, 2026 04:37
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