fix(ci): run brew under ARM + drop ios-deploy, use devicectl only
Some checks failed
CI / Detect Changes (pull_request) Successful in 4s
CI / YouTube Worker (pull_request) Has been skipped
CI / Deploy (pull_request) Has been skipped
PR → Build → devicectl Deploy → LGTM / Build & Deploy to iPhone (devicectl) (pull_request) Failing after 30s
PR → Build → devicectl Deploy → LGTM / Wait for LGTM comment (pull_request) Has been skipped

Two related fixes to the Install tools / Deploy steps:

1. Rosetta/ARM-prefix conflict (unblocks run #142 failure)
   Run #142 failed at 'brew install':
     Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
   The act_runner shell runs under Rosetta 2 on Apple Silicon, but Homebrew
   is installed natively in /opt/homebrew (ARM prefix). Brew refuses to mix
   architectures and exits 1 — surfaced now because xcodegen/node registered
   as outdated and brew tried to upgrade them.
   Prefix the brew call with 'arch -arm64' (brew's own suggested workaround)
   so the subprocess runs natively regardless of the parent shell's arch.

2. Drop ios-deploy, use xcrun devicectl only
   The deploy step previously tried devicectl (WiFi) first, then fell back
   to ios-deploy (USB). devicectl handles both network and wired discovery
   natively, so the separate USB-fallback tool is unnecessary — removed
   from the brew install and the deploy step.
   Implication: a devicectl failure = deploy failure (no second tool to
   fall back to). Acceptable: devicectl covers both transports.

Also updates workflow name/job labels and the 'Prêt à tester' comment to
drop 'WiFi/USB' wording, and aligns AGENTS.md §5 step 4 (arch -arm64 +
tool list) and step 7 (devicectl only).
This commit is contained in:
Millian Lamiaux
2026-07-19 20:47:38 +02:00
parent 244270488a
commit 437ec130fe
2 changed files with 18 additions and 24 deletions

View File

@@ -1,8 +1,8 @@
# =============================================================================
# TabataGo — PR → Build → WiFi/USB Direct Deploy → Wait LGTM → Merge
# TabataGo — PR → Build → devicectl Deploy → Wait LGTM → Merge
# =============================================================================
name: PR → Build → WiFi/USB Deploy → LGTM
name: PR → Build → devicectl Deploy → LGTM
on:
pull_request:
@@ -27,7 +27,7 @@ concurrency:
jobs:
build-deploy:
name: Build & Deploy to iPhone (WiFi/USB)
name: Build & Deploy to iPhone (devicectl)
runs-on: macos
timeout-minutes: 30
@@ -82,11 +82,12 @@ jobs:
echo "✅ Caches nettoyés (SPM cache préservé)"
- name: Install tools (xcodegen, node, ios-deploy)
- name: Install tools (xcodegen, node)
run: |
# No `|| true` — if brew is down, fail loudly here instead of producing
# confusing "command not found" errors in the next steps.
brew install xcodegen node ios-deploy
# The act_runner shell can land under Rosetta 2 on Apple Silicon;
# Homebrew lives in /opt/homebrew (ARM prefix), so run brew natively.
# (Brew refuses to install/upgrade under Rosetta in the ARM prefix.)
arch -arm64 brew install xcodegen node
- name: Write Secrets.xcconfig from Gitea secrets
env:
@@ -143,27 +144,20 @@ jobs:
CODE_SIGN_STYLE=Automatic \
DEVELOPMENT_TEAM=2MJF39L8VY
- name: Install to iPhone (WiFi → USB fallback)
- name: Install to iPhone (devicectl)
run: |
UDID="00008120-000925CE3672201E"
APP=$(find build/derived -name 'TabataGo.app' -type d | head -1)
# 1. Try WiFi first (Xcode 15+ devicectl network discovery)
echo "📱 Trying WiFi install via devicectl..."
if xcrun devicectl device install app --device "$UDID" "$APP" > /tmp/devicectl.log 2>&1; then
echo "✅ Installed via WiFi"
exit 0
fi
tail -10 /tmp/devicectl.log
# 2. Fallback to USB via ios-deploy
echo "🔌 WiFi failed, trying USB..."
if ios-deploy --bundle "$APP" --id "$UDID" --justlaunch; then
echo "✅ Installed via USB"
# devicectl handles both WiFi (network) and wired (USB-C/Thunderbolt)
# discovery natively — no separate USB-fallback tool needed.
echo "📱 Installing via devicectl..."
if xcrun devicectl device install app --device "$UDID" "$APP"; then
echo "✅ Installed via devicectl"
exit 0
fi
echo "❌ Install failed (both WiFi and USB)"
echo "❌ devicectl install failed"
exit 1
@@ -177,7 +171,7 @@ jobs:
curl -s -X POST \
-H "Authorization: token ${GT_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"body\":\"## 📱 Prêt à tester !\\n\\nL'app est déployée sur l'iPhone (USB/WiFi).\\n\\n- Teste les changements\\n- Reply **LGTM** pour merger\\n- Reply **KO** pour bloquer\"}" \
-d "{\"body\":\"## 📱 Prêt à tester !\\n\\nL'app est déployée sur l'iPhone (devicectl).\\n\\n- Teste les changements\\n- Reply **LGTM** pour merger\\n- Reply **KO** pour bloquer\"}" \
"${GITEA_URL}/api/v1/repos/${REPO}/issues/${PR}/comments"
wait-approval:

View File

@@ -162,10 +162,10 @@ Complications : `TabataGoComplication`.
- Supprime `build/derived`, `TabataGo.xcodeproj`, `Package.resolved`, DerivedData, ModuleCache.
- **GARDE le cache SPM** (`build/spm-cache` — c'est le chemin passé à `-clonedSourcePackagesDirPath`) — RevenueCat ≈ 1.1 GiB, re-cloner = 5+ min et échecs aléatoires du sandbox. **Ne jamais faire `rm -rf build/`** : ça détruirait ce cache. Le clean step ne touche que `build/derived`.
- Ne touche **pas** à `~/Library/Caches/com.apple.dt.Xcode` (cache Xcode global — le nuke ralentit tous les builds suivants).
4. **Install tools** : `brew install xcodegen node ios-deploy` (sans `|| true` — si brew down, on fail ici, pas deux steps plus loin).
4. **Install tools** : `arch -arm64 brew install xcodegen node` (sans `|| true` — si brew down, on fail ici, pas deux steps plus loin). `arch -arm64` requis car le shell act_runner tourne sous Rosetta 2 sur Apple Silicon, mais Homebrew est dans le prefix ARM `/opt/homebrew` — sans ça, brew refuse d'installer/upgrader.
5. **Write `Config/Secrets.xcconfig`** depuis les secrets Gitea (`SUPABASE_URL`, `SUPABASE_ANON_KEY`, `REVENUECAT_API_KEY`, `POSTHOG_API_KEY`). Preflight : fail loud si un secret requis manque. Le fichier est gitigné (règle #9) ; CI l'écrase à chaque run. `Info.plist` lit les valeurs via `$(SUPABASE_URL)` etc., et `project.yml` wire le xcconfig en Debug+Release — aucun autre change­ment nécessaire côté build.
6. **xcodegen generate**`xcodebuild -resolvePackageDependencies`**build** (`-scheme TabataGo`, Debug, auto-provisioning, team `2MJF39L8VY`). Le scheme build les 4 targets : `TabataGo` (app iOS), `TabataGoWidget` (widget iOS, vrai target — ne pas confondre avec `TabataGoWatchWidget` qui est watchOS), `TabataGoWatch` (app watchOS), `TabataGoWatchWidget` (complication watchOS).
7. **Deploy iPhone** UDID `00008120-000925CE3672201E` : `devicectl` WiFi d'abord, fallback `ios-deploy` USB.
7. **Deploy iPhone** UDID `00008120-000925CE3672201E` : `xcrun devicectl device install app` uniquement. `devicectl` gère nativement la découverte WiFi (réseau) et filaire (USB-C/Thunderbolt) — pas de fallback `ios-deploy`.
8. **Post comment** "Prêt à tester" sur la PR.
9. **Job `wait-approval`** : poll (30s, max 240 = 2h). **Re-fetche TOUS les comments** chaque cycle (pas `since_id`) pour attraper aussi les edits (un reviewer passant de "KO" à "LGTM"). Match LGTM/KO n'importe où dans le body (regex `\bLGTM\b` / `\bKO\b`, case-insensitive) — "Tested, LGTM!" compte ; "KOM" ne compte pas. `LGTM`**squash-merge** (`{"Do":"squash"}`). `KO` → blocage. Timeout → fail.