|
| 1 | +name: store-screenshots |
| 2 | + |
| 3 | +# Genera gli screenshot App Store iOS su un runner macOS (non serve un Mac locale). |
| 4 | +# Esecuzione manuale: Actions → store-screenshots → Run workflow. |
| 5 | +# Gli artifact `ios-raw-screenshots` vanno scaricati in |
| 6 | +# mobile/store/screenshots/_raw/ios/ e poi composti con: |
| 7 | +# pwsh mobile/scripts/store-screenshots.ps1 -Mode compose-ios |
| 8 | +# |
| 9 | +# Prerequisiti (una tantum): |
| 10 | +# - secret EAS_TOKEN (expo.dev → account → access tokens) |
| 11 | +# - variabili/secret MAESTRO_EMAIL + MAESTRO_PASSWORD di un account demo |
| 12 | +# con dati pre-popolati (cerchio "Famiglia Rossi", timeline, documenti...) |
| 13 | + |
| 14 | +on: |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +jobs: |
| 18 | + ios-screenshots: |
| 19 | + runs-on: macos-15 |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + working-directory: mobile |
| 23 | + env: |
| 24 | + EXPO_TOKEN: ${{ secrets.EAS_TOKEN }} |
| 25 | + # Il profilo store-screenshots (eas.json) usa APP_VARIANT=preview -> |
| 26 | + # bundle id app.accanto.mobile.preview (vedi app.config.ts resolveVariant). |
| 27 | + MAESTRO_APP_ID: app.accanto.mobile.preview |
| 28 | + MAESTRO_EMAIL: ${{ secrets.MAESTRO_EMAIL }} |
| 29 | + MAESTRO_PASSWORD: ${{ secrets.MAESTRO_PASSWORD }} |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: 20 |
| 36 | + cache: npm |
| 37 | + cache-dependency-path: mobile/package-lock.json |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: npm ci |
| 41 | + |
| 42 | + - name: Install Maestro |
| 43 | + run: curl -Ls https://get.maestro.mobile.dev | bash |
| 44 | + # Maestro CLI si installa in $HOME/.maestro/bin |
| 45 | + |
| 46 | + - name: Boot iPhone 16 Pro Max simulator (6.9") |
| 47 | + run: | |
| 48 | + UDID=$(xcrun simctl create "store-shot" "iPhone 16 Pro Max" 2>/dev/null || true) |
| 49 | + if [ -z "$UDID" ]; then |
| 50 | + # fallback se il device type non e' disponibile sull'immagine |
| 51 | + UDID=$(xcrun simctl create "store-shot" "iPhone 15 Pro Max") |
| 52 | + fi |
| 53 | + echo "SIM_UDID=$UDID" >> "$GITHUB_ENV" |
| 54 | + xcrun simctl boot "$UDID" |
| 55 | + xcrun simctl bootstatus "$UDID" -b |
| 56 | +
|
| 57 | + # Il flow Maestro naviga per testi VISIBILI in italiano ("Il tuo spazio", |
| 58 | + # "Diario", ...). Il simulator su runner macOS parte in inglese: senza |
| 59 | + # questo step l'app userebbe EN (se l'account demo non ha lingua salvata) |
| 60 | + # e le asserzioni fallirebbero. Forza IT a livello di simulator. |
| 61 | + - name: Set simulator language to Italian |
| 62 | + run: | |
| 63 | + xcrun simctl spawn "$SIM_UDID" defaults write "Apple Global Domain" AppleLanguages -array it |
| 64 | + xcrun simctl spawn "$SIM_UDID" defaults write "Apple Global Domain" AppleLocale -string it_IT |
| 65 | +
|
| 66 | + - name: Build iOS app (simulator profile) on EAS |
| 67 | + run: npx eas-cli build --platform ios --profile store-screenshots --non-interactive --wait --local 2>&1 | tee eas-build.log |
| 68 | + # Profilo `store-screenshots` (eas.json): ios.simulator=true -> produce |
| 69 | + # un .app installabile sul simulator. --local compila sul runner |
| 70 | + # (Xcode presente su macos-15), nessuna attesa della coda EAS remota. |
| 71 | + |
| 72 | + - name: Install app on simulator |
| 73 | + run: | |
| 74 | + APP=$(find . -name "*.app" -maxdepth 3 | head -n1) |
| 75 | + if [ -z "$APP" ]; then |
| 76 | + TAR=$(find . -name "*.tar.gz" -maxdepth 2 | head -n1) |
| 77 | + tar -xzf "$TAR" -C /tmp/app |
| 78 | + APP=$(find /tmp/app -name "*.app" | head -n1) |
| 79 | + fi |
| 80 | + xcrun simctl install "$SIM_UDID" "$APP" |
| 81 | +
|
| 82 | + - name: Run Maestro screenshot flow |
| 83 | + run: | |
| 84 | + export PATH="$HOME/.maestro/bin:$PATH" |
| 85 | + maestro test --output store/screenshots/_raw/ios .maestro/screenshots.yaml |
| 86 | +
|
| 87 | + - name: Flatten raw screenshots |
| 88 | + run: | |
| 89 | + # maestro salva in una sottocartella con timestamp: sposta i PNG in _raw/ios |
| 90 | + find store/screenshots/_raw/ios -name "*.png" -exec mv {} store/screenshots/_raw/ios/ \; |
| 91 | + ls -la store/screenshots/_raw/ios |
| 92 | +
|
| 93 | + - uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: ios-raw-screenshots |
| 96 | + path: mobile/store/screenshots/_raw/ios/*.png |
| 97 | + retention-days: 30 |
0 commit comments