Skip to content

Commit b5bec1b

Browse files
committed
Revert "refactor: simplify Unity CI setup by removing game-ci activation and using built-in license handling"
This reverts commit 4e5ffc0.
1 parent e08779e commit b5bec1b

File tree

1 file changed

+57
-24
lines changed

1 file changed

+57
-24
lines changed

.github/workflows/claude-nl-suite.yml

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,49 +67,82 @@ jobs:
6767
echo "No MCP Python deps found (skipping)"
6868
fi
6969
70-
# Cache Unity Library to speed up runs
71-
- uses: actions/cache@v4
70+
# --- Use game-ci for Unity activation (handles all license types) ---
71+
- name: Activate Unity using game-ci
72+
uses: game-ci/unity-activator@v2
73+
env:
74+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
75+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
76+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
77+
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
7278
with:
73-
path: TestProjects/UnityMCPTests/Library
74-
key: Library-UnityMCPTests-2021.3.45f2-${{ hashFiles('TestProjects/UnityMCPTests/Assets/**', 'TestProjects/UnityMCPTests/Packages/**', 'TestProjects/UnityMCPTests/ProjectSettings/**') }}
75-
restore-keys: |
76-
Library-UnityMCPTests-2021.3.45f2-
77-
Library-UnityMCPTests-
79+
unity-version: 2021.3.45f2
80+
81+
# Copy activation artifacts to Docker mount locations
82+
- name: Prepare Unity license for Docker containers
83+
shell: bash
84+
run: |
85+
set -euxo pipefail
86+
mkdir -p "$RUNNER_TEMP/unity-config" "$RUNNER_TEMP/unity-local"
87+
88+
# game-ci stores license files in standard Unity locations
89+
# Copy them to our Docker mount points
90+
if [ -d "$HOME/.local/share/unity3d" ]; then
91+
cp -r "$HOME/.local/share/unity3d"/* "$RUNNER_TEMP/unity-local/" || true
92+
fi
93+
if [ -d "$HOME/.config/unity3d" ]; then
94+
cp -r "$HOME/.config/unity3d"/* "$RUNNER_TEMP/unity-config/" || true
95+
fi
96+
97+
# Verify license files exist
98+
echo "Unity license files prepared:"
99+
find "$RUNNER_TEMP/unity-local" -type f || true
100+
find "$RUNNER_TEMP/unity-config" -type f || true
101+
102+
# ---------- Warm up project (import Library once) ----------
103+
- name: Warm up project (import Library once)
104+
if: steps.detect.outputs.unity_ok == 'true'
105+
shell: bash
106+
env:
107+
UNITY_IMAGE: ${{ env.UNITY_IMAGE }}
108+
run: |
109+
set -euxo pipefail
110+
docker run --rm --network host \
111+
-e HOME=/root \
112+
-v "${{ github.workspace }}:/workspace" -w /workspace \
113+
-v "$RUNNER_TEMP/unity-config:/root/.config/unity3d" \
114+
-v "$RUNNER_TEMP/unity-local:/root/.local/share/unity3d" \
115+
"$UNITY_IMAGE" /opt/unity/Editor/Unity -batchmode -nographics -logFile - \
116+
-projectPath /workspace/TestProjects/UnityMCPTests \
117+
-quit
78118
79119
# ---------- Clean old MCP status ----------
80120
- name: Clean old MCP status
81121
run: |
82122
set -eux
83-
mkdir -p "$RUNNER_TEMP/unity-status"
84-
rm -f "$RUNNER_TEMP/unity-status"/unity-mcp-status-*.json || true
123+
mkdir -p "$HOME/.unity-mcp"
124+
rm -f "$HOME/.unity-mcp"/unity-mcp-status-*.json || true
85125
86-
# ---------- Start headless Unity with MCP bridge ----------
87-
- name: Start Unity MCP bridge in background
126+
# ---------- Start headless Unity (persistent bridge) ----------
127+
- name: Start Unity (persistent bridge)
88128
if: steps.detect.outputs.unity_ok == 'true'
89129
shell: bash
90130
env:
91-
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
92-
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
93-
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
94-
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
131+
UNITY_IMAGE: ${{ env.UNITY_IMAGE }}
95132
run: |
96133
set -euxo pipefail
97-
98-
# The unityci/editor image supports licensing via env vars
99-
# Pass credentials and let Unity activate itself on first run
134+
mkdir -p "$RUNNER_TEMP/unity-status"
100135
docker rm -f unity-mcp >/dev/null 2>&1 || true
101136
docker run -d --name unity-mcp --network host \
102-
-e UNITY_EMAIL \
103-
-e UNITY_PASSWORD \
104-
-e UNITY_LICENSE \
105-
-e UNITY_SERIAL \
137+
-e HOME=/root \
106138
-e UNITY_MCP_ALLOW_BATCH=1 \
107139
-e UNITY_MCP_STATUS_DIR=/root/.unity-mcp \
108140
-e UNITY_MCP_BIND_HOST=127.0.0.1 \
109141
-v "${{ github.workspace }}:/workspace" -w /workspace \
110142
-v "$RUNNER_TEMP/unity-status:/root/.unity-mcp" \
111-
${{ env.UNITY_IMAGE }} \
112-
/opt/unity/Editor/Unity -batchmode -nographics -logFile - \
143+
-v "$RUNNER_TEMP/unity-config:/root/.config/unity3d" \
144+
-v "$RUNNER_TEMP/unity-local:/root/.local/share/unity3d" \
145+
"$UNITY_IMAGE" /opt/unity/Editor/Unity -batchmode -nographics -logFile - \
113146
-stackTraceLogType Full \
114147
-projectPath /workspace/TestProjects/UnityMCPTests \
115148
-executeMethod MCPForUnity.Editor.MCPForUnityBridge.StartAutoConnect

0 commit comments

Comments
 (0)