fix(ci): pr-iphone-deploy — cache, secrets, LGTM regex, concurrency, watch build, scope #12
38
.github/workflows/pr-iphone-deploy.yml
vendored
38
.github/workflows/pr-iphone-deploy.yml
vendored
@@ -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:
|
||||
|
||||
@@ -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 changement 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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user