-
-
Notifications
You must be signed in to change notification settings - Fork 6
fix: install Unity Hub as a Homebrew cask, not a versioned formula #119
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
Merged
+80
−32
Merged
Changes from all commits
Commits
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,62 @@ | ||
| import { describe, it, expect, mock, afterEach } from "bun:test"; | ||
| import { SetupMac } from "./setup-mac.ts"; | ||
| import { fsSync as fs } from "../../../dependencies.ts"; | ||
| import { System } from "../../../model/system/system.ts"; | ||
|
|
||
| const originalExistsSync = fs.existsSync; | ||
| const originalSystemRun = System.run; | ||
|
|
||
| afterEach(() => { | ||
| fs.existsSync = originalExistsSync; | ||
| System.run = originalSystemRun; | ||
| }); | ||
|
|
||
| describe("SetupMac", () => { | ||
| // Regression test for a real bug: installUnityHub used to build | ||
| // `brew install unity-hub@<version>`, treating Unity Hub as a versioned | ||
| // Homebrew formula. Unity Hub is only distributed as a cask, so that | ||
| // command fails with "No available formula with the name ...". Confirmed | ||
| // live in game-ci/unity-builder CI: every Mac build failed at Unity Hub | ||
| // install with exactly this error before this fix, while the previously | ||
| // working (pre-thin-wrapper) code path ran the plain, unversioned | ||
| // `brew install unity-hub` cask install successfully. | ||
| it("installs the unversioned unity-hub cask when no version is pinned", async () => { | ||
| // Only the Hub paths are missing; the Editor path exists so setup() doesn't also | ||
| // fall into installUnity, which is unrelated to this fix. | ||
| fs.existsSync = mock((path: string) => !path.includes("Hub.app")) as any; | ||
| let capturedCommand = ""; | ||
| const systemRunMock = mock((command: string) => { | ||
| capturedCommand = command; | ||
|
|
||
| return Promise.resolve({ status: { code: 0 }, output: "" }); | ||
| }); | ||
| System.run = systemRunMock as any; | ||
|
|
||
| await SetupMac.setup({ | ||
| isRunningLocally: false, | ||
| unityHubVersionOnMac: "", | ||
| engineVersion: "2021.3.16f1", | ||
| } as any); | ||
|
|
||
| expect(capturedCommand).toBe("brew install --cask unity-hub"); | ||
| }); | ||
|
|
||
| it("pins the cask version when unityHubVersionOnMac is explicitly set", async () => { | ||
| fs.existsSync = mock((path: string) => !path.includes("Hub.app")) as any; | ||
| let capturedCommand = ""; | ||
| const systemRunMock = mock((command: string) => { | ||
| capturedCommand = command; | ||
|
|
||
| return Promise.resolve({ status: { code: 0 }, output: "" }); | ||
| }); | ||
| System.run = systemRunMock as any; | ||
|
|
||
| await SetupMac.setup({ | ||
| isRunningLocally: false, | ||
| unityHubVersionOnMac: "3.19.5", | ||
| engineVersion: "2021.3.16f1", | ||
| } as any); | ||
|
|
||
| expect(capturedCommand).toBe("brew install --cask unity-hub@3.19.5"); | ||
| }); | ||
| }); |
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.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: game-ci/cli
Length of output: 159
🏁 Script executed:
Repository: game-ci/cli
Length of output: 12748
Do not construct a cask token from an arbitrary Unity Hub version.
Homebrew publishes
unity-hubandunity-hub@beta, but not numeric tokens such asunity-hub@3.19.5. The explicit-version path fails instead of installing the requested version. Use a supported cask mapping or an installation source that provides the requested version. Update the test to cover that behavior.📍 Affects 2 files
src/logic/unity/platform-setup/setup-mac.ts#L38-L39(this comment)src/logic/unity/platform-setup/setup-mac.test.ts#L44-L60🤖 Prompt for AI Agents