chahinebrini 372aaa43dd fix(ci): pipeline race-condition + health-check retry + maestro secrets
Hauptproblem: Webhook-Deploy (deploy.sh) und GH-Actions-Deploy
(deploy-from-artifact.sh) liefen gleichzeitig → Race auf .output-staging
und doppelter pm2-restart.

Fixes:
- deploy-from-artifact.sh: setzt .deploy-ga.lock (noclobber, mit PID)
  während Deploy läuft; stale locks werden erkannt und überschrieben
- deploy.sh: prüft .deploy-ga.lock bei Start — wenn GH-Actions aktiv,
  sauberes exit 0 statt Kollision
- Health-Check: Retry-Loop (12× × 5s = max 60s) statt einmaligem sleep 5;
  Infisical-Login + Nitro-Start braucht auf gestresstem Server bis 30s
- maestro-cloud.yml: ungültiges `if: secrets.X != ''` entfernt (secrets
  in if-conditions sind in GH-Actions immer leer); stattdessen expliziter
  secrets-check als erster Step mit klarer Fehlermeldung
- pnpm --prefer-offline in deploy-from-artifact.sh: nutzt Store-Cache
- .gitignore: .deploy-ga.lock ergänzt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 09:32:25 +02:00

107 lines
3.4 KiB
YAML

# Maestro Cloud — E2E for rebreak-native.
# STATUS: TEMPLATE ONLY — not active. Requires User confirmation before enabling.
#
# Trigger: manual dispatch only (PR-trigger commented out — enable after User GO).
# Requires:
# - MAESTRO_CLOUD_API_KEY in GitHub Actions secrets (environment: staging)
# - EAS_TOKEN in GitHub Actions secrets
# - E2E_TEST_USER + E2E_TEST_PASSWORD in GitHub Actions secrets
# - Maestro Cloud account configured at mobile.dev
name: Maestro Cloud E2E (rebreak-native)
on:
workflow_dispatch:
inputs:
platform:
description: "Target platform"
required: true
default: "ios"
type: choice
options:
- ios
- android
# Uncomment to run on PRs — only after User approval:
# pull_request:
# branches: [main]
# paths:
# - "apps/rebreak-native/**"
# - "apps/rebreak-native/.maestro/**"
jobs:
maestro-cloud:
name: E2E (${{ inputs.platform || 'ios' }})
runs-on: ubuntu-latest
environment: staging
steps:
- name: Check required secrets
env:
MAESTRO_CLOUD_API_KEY: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
EAS_TOKEN: ${{ secrets.EAS_TOKEN }}
E2E_TEST_USER: ${{ secrets.E2E_TEST_USER }}
E2E_TEST_PASSWORD: ${{ secrets.E2E_TEST_PASSWORD }}
run: |
missing=()
[ -z "$MAESTRO_CLOUD_API_KEY" ] && missing+=("MAESTRO_CLOUD_API_KEY")
[ -z "$EAS_TOKEN" ] && missing+=("EAS_TOKEN")
[ -z "$E2E_TEST_USER" ] && missing+=("E2E_TEST_USER")
[ -z "$E2E_TEST_PASSWORD" ] && missing+=("E2E_TEST_PASSWORD")
if [ ${#missing[@]} -gt 0 ]; then
echo "FATAL: Folgende Secrets fehlen in GitHub Actions (environment: staging):"
printf ' - %s\n' "${missing[@]}"
exit 1
fi
echo "All required secrets present"
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: apps/rebreak-native
# Build app via EAS.
# Profile "preview" must produce a .ipa (iOS) or .apk (Android).
# eas.json in apps/rebreak-native/ muss "preview"-Profile definieren.
- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EAS_TOKEN }}
- name: EAS Build
run: |
eas build \
--platform ${{ inputs.platform || 'ios' }} \
--profile preview \
--non-interactive \
--output ./build-artifact
working-directory: apps/rebreak-native
- name: Install Maestro CLI
run: curl -Ls "https://get.maestro.mobile.dev" | bash
env:
MAESTRO_VERSION: 1.39.0
- name: Add Maestro to PATH
run: echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Run Maestro Cloud
run: |
maestro cloud \
--apiKey "${{ secrets.MAESTRO_CLOUD_API_KEY }}" \
--app ./apps/rebreak-native/build-artifact \
--device "${{ inputs.platform || 'ios' }}" \
--env=E2E_TEST_USER="${{ secrets.E2E_TEST_USER }}" \
--env=E2E_TEST_PASSWORD="${{ secrets.E2E_TEST_PASSWORD }}" \
apps/rebreak-native/.maestro/