Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 7f254fd

Browse files
authored
Enhance xcodegen error diagnostics and retry logic
Improved diagnostics and error handling for xcodegen generation process.
1 parent 2a152b4 commit 7f254fd

File tree

1 file changed

+80
-2
lines changed

1 file changed

+80
-2
lines changed

.github/workflows/build-unsigned-ipa.yml

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,89 @@ jobs:
9292
9393
- name: Generate Xcode Project
9494
run: |
95+
set -euo pipefail
96+
97+
echo "=== diagnostic: PATH and which xcodegen ==="
98+
echo "PATH=$PATH"
99+
which xcodegen || true
100+
101+
if command -v xcodegen >/dev/null 2>&1; then
102+
echo "=== xcodegen --version ==="
103+
xcodegen --version || true
104+
105+
echo "=== file info for xcodegen binary (arch info) ==="
106+
file "$(command -v xcodegen)" || true
107+
else
108+
echo "xcodegen not found — attempting to install via brew"
109+
if command -v brew >/dev/null 2>&1; then
110+
brew update || true
111+
brew install xcodegen || true
112+
fi
113+
fi
114+
115+
echo "=== running xcodegen generate --spec project.yml --verbose ==="
116+
# run xcodegen but capture non-zero rather than letting set -e kill the job immediately
117+
set +e
118+
xcodegen generate --spec project.yml --verbose
119+
rc=$?
95120
set -e
96-
xcodegen generate --spec project.yml
97-
echo "Generated project at: $(pwd)/prostore.xcodeproj"
121+
122+
if [ $rc -ne 0 ]; then
123+
echo "❌ xcodegen exited with code $rc — collecting diagnostics..."
124+
125+
echo "---- macOS unified log for xcodegen (last 5m) ----"
126+
# unified logging (may require permission on some runners) - best-effort
127+
log show --style syslog --predicate 'process == "xcodegen"' --last 5m || true
128+
129+
echo "---- Recent DiagnosticReports (may contain a crash log) ----"
130+
ls -la ~/Library/Logs/DiagnosticReports | tail -n 20 || true
131+
132+
echo "---- /var/log/system.log (tail) ----"
133+
sudo tail -n 200 /var/log/system.log || true
134+
135+
if command -v brew >/dev/null 2>&1; then
136+
echo "Attempting: brew reinstall xcodegen (then retry once)..."
137+
brew reinstall xcodegen || brew install xcodegen || true
138+
139+
echo "Retrying xcodegen generate --spec project.yml --verbose (one retry)..."
140+
set +e
141+
xcodegen generate --spec project.yml --verbose
142+
retry_rc=$?
143+
set -e
144+
145+
if [ $retry_rc -eq 0 ]; then
146+
echo "✅ xcodegen succeeded on retry."
147+
echo "Generated project at: $(pwd)/prostore.xcodeproj"
148+
sed -n '1,60p' prostore.xcodeproj/project.pbxproj || true
149+
exit 0
150+
else
151+
echo "❌ Retry failed with exit code $retry_rc."
152+
fi
153+
fi
154+
155+
echo ""
156+
echo "Possible causes:"
157+
echo "- xcodegen binary is crashing due to incompatible architecture (ARM vs x86_64)."
158+
echo "- Corrupt xcodegen install or an OS-level incompatibility."
159+
echo ""
160+
echo "Quick diagnostics you can run locally:"
161+
echo " file $(which xcodegen) # check binary arch"
162+
echo " xcodegen --version"
163+
echo " arch -x86_64 xcodegen generate --spec project.yml # try forcing x86_64 (only if Rosetta is available)"
164+
echo ""
165+
echo "If this persists on the GitHub-hosted runner, try one of:"
166+
echo "- Force running xcodegen under Rosetta (arch -x86_64) if the binary is x86_64 and Rosetta is installed."
167+
echo "- Use a different runner image (e.g. macos-latest / macos-12) that better matches the xcodegen build."
168+
echo "- Rebuild xcodegen locally from source or use a known-good prebuilt binary."
169+
echo ""
170+
# fail the step with the original rc (keeps behaviour obvious)
171+
exit $rc
172+
fi
173+
174+
echo "✅ Generated project at: $(pwd)/prostore.xcodeproj"
98175
echo "project.pbxproj header (first 60 lines):"
99176
sed -n '1,60p' prostore.xcodeproj/project.pbxproj || true
177+
shell: /bin/bash
100178

101179
- name: Resolve Swift Packages
102180
run: |

0 commit comments

Comments
 (0)