Skip to content

Commit ef194ac

Browse files
committed
CI: prime license, robust Unity start/wait, sanitize markdown via heredoc
1 parent cecbb06 commit ef194ac

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

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

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ concurrency:
1515

1616
env:
1717
UNITY_VERSION: 2021.3.45f1
18-
# Use the SAME image everywhere to avoid a s econd pull and env drift
1918
UNITY_IMAGE: unityci/editor:ubuntu-2021.3.45f1-linux-il2cpp-3
20-
# Where GameCI writes /root in its container on the host:
2119
UNITY_CACHE_ROOT: /home/runner/work/_temp/_github_home
2220

2321
jobs:
@@ -64,22 +62,27 @@ jobs:
6462
uv pip install -e UnityMcpBridge/UnityMcpServer~/src
6563
elif [ -f UnityMcpBridge/UnityMcpServer~/src/requirements.txt ]; then
6664
uv pip install -r UnityMcpBridge/UnityMcpServer~/src/requirements.txt
65+
elif [ -f UnityMcpBridge/UnityMcpServer~/pyproject.toml ]; then
66+
uv pip install -e UnityMcpBridge/UnityMcpServer~/
67+
elif [ -f UnityMcpBridge/UnityMcpServer~/requirements.txt ]; then
68+
uv pip install -r UnityMcpBridge/UnityMcpServer~/requirements.txt
69+
else
70+
echo "No MCP Python deps found (skipping)"
6771
fi
6872
6973
# ---------- License prime on host (handles ULF or EBL) ----------
7074
- name: Prime Unity license on host (GameCI)
7175
if: steps.detect.outputs.unity_ok == 'true'
7276
uses: game-ci/unity-test-runner@v4
7377
env:
74-
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} # optional ULF (raw or base64)
75-
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} # optional sign-in
78+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
79+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
7680
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
77-
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} # optional serial
81+
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
7882
with:
7983
projectPath: TestProjects/UnityMCPTests
8084
testMode: EditMode
8185
customParameters: -runTests -testFilter __NoSuchTest__ -batchmode -nographics
82-
# Ensure GameCI uses the same editor version
8386
unityVersion: ${{ env.UNITY_VERSION }}
8487

8588
# (Optional) Show where the license actually got written
@@ -98,13 +101,15 @@ jobs:
98101
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
99102
run: |
100103
set -eu
104+
if [ ! -d "${{ github.workspace }}/TestProjects/UnityMCPTests/ProjectSettings" ]; then
105+
echo "Unity project not found; failing fast."
106+
exit 1
107+
fi
101108
mkdir -p "$HOME/.unity-mcp"
102-
# Only pass manualLicenseFile if the ULF actually exists from priming
103109
MANUAL_ARG=()
104110
if [ -f "${UNITY_CACHE_ROOT}/.local/share/unity3d/Unity_lic.ulf" ]; then
105111
MANUAL_ARG=(-manualLicenseFile /root/.local/share/unity3d/Unity_lic.ulf)
106112
fi
107-
# Only pass EBL args that are present
108113
EBL_ARGS=()
109114
[ -n "${UNITY_SERIAL:-}" ] && EBL_ARGS+=(-serial "$UNITY_SERIAL")
110115
[ -n "${UNITY_EMAIL:-}" ] && EBL_ARGS+=(-username "$UNITY_EMAIL")
@@ -121,11 +126,14 @@ jobs:
121126
"${EBL_ARGS[@]}" \
122127
-executeMethod UnityMcpBridge.Editor.UnityMcpBridge.StartAutoConnect
123128
124-
# ---------- Wait for Unity bridge ----------
129+
# ---------- Wait for Unity bridge (fail fast if not running/ready) ----------
125130
- name: Wait for Unity bridge
126131
if: steps.detect.outputs.unity_ok == 'true'
127132
run: |
128133
set -eux
134+
if ! docker ps --format '{{.Names}}' | grep -qx 'unity-mcp'; then
135+
echo "Unity container failed to start"; docker ps -a || true; exit 1
136+
fi
129137
docker logs -f unity-mcp & LOGPID=$!
130138
deadline=$((SECONDS+420))
131139
while [ $SECONDS -lt $deadline ]; do
@@ -143,22 +151,21 @@ jobs:
143151
docker logs unity-mcp || true
144152
exit 1
145153
146-
# ---------- Claude suites ----------
147-
# Removed short sanity suite; full suite below contains coverage
148-
154+
# ---------- Prepare reports ----------
149155
- name: Prepare NL/T reports dir
150156
run: |
151157
set -eux
152158
mkdir -p reports
153159
: > reports/claude-nl-tests.xml
154160
: > reports/claude-nl-tests.md
155161
162+
# ---------- Claude NL/T suite (full) ----------
156163
- name: Claude NL/T suite (full)
157164
uses: anthropics/claude-code-base-action@beta
158165
if: steps.detect.outputs.anthropic_ok == 'true'
159166
with:
160167
prompt_file: .claude/prompts/nl-unity-suite-full.md
161-
allowed_tools: >
168+
allowed_tools: > # RESTRICTED like “71”
162169
Bash(git:*),Read,Write,LS,Glob,Grep,
163170
ListMcpResourcesTool,ReadMcpResourceTool,
164171
mcp__unity__script_apply_edits,mcp__unity__apply_text_edits,
@@ -189,6 +196,21 @@ jobs:
189196
timeout_minutes: "30"
190197
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
191198

199+
# sanitize only the markdown (does not touch JUnit xml)
200+
- name: Sanitize NL/T markdown (UTF-8, strip NULs)
201+
if: always()
202+
run: |
203+
set -eu
204+
if [ -f reports/claude-nl-tests.md ]; then
205+
python - <<'PY'
206+
from pathlib import Path
207+
p=Path('reports/claude-nl-tests.md')
208+
b=p.read_bytes().replace(b'\x00', b'')
209+
s=b.decode('utf-8','replace').replace('\r\n','\n')
210+
p.write_text(s, encoding='utf-8', newline='\n')
211+
PY
212+
fi
213+
192214
- name: Publish JUnit report
193215
if: always()
194216
uses: mikepenz/action-junit-report@v4

0 commit comments

Comments
 (0)