Update #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: iOS Simulator Smoke | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - ".github/workflows/ios-simulator-smoke.yml" | |
| - "iosApp/**" | |
| - "shared/**" | |
| - "settings.gradle.kts" | |
| - "build.gradle.kts" | |
| - "gradle/**" | |
| - "gradlew" | |
| - "gradlew.bat" | |
| jobs: | |
| simulator-smoke: | |
| runs-on: macos-15 | |
| timeout-minutes: 35 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Java 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Ensure Gradle wrapper is executable | |
| run: chmod +x ./gradlew | |
| - name: Select available iPhone simulator | |
| id: simulator | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| python3 - <<'PY' >> "$GITHUB_OUTPUT" | |
| import json | |
| import subprocess | |
| data = json.loads( | |
| subprocess.check_output( | |
| ["xcrun", "simctl", "list", "devices", "available", "-j"], | |
| text=True, | |
| ) | |
| ) | |
| selected = None | |
| for runtime in sorted(data["devices"].keys(), reverse=True): | |
| if "iOS" not in runtime: | |
| continue | |
| iphones = [ | |
| device | |
| for device in data["devices"][runtime] | |
| if device.get("isAvailable") and device["name"].startswith("iPhone") | |
| ] | |
| if iphones: | |
| selected = (runtime, iphones[0]["name"], iphones[0]["udid"]) | |
| break | |
| if selected is None: | |
| raise SystemExit("No available iPhone simulator found") | |
| runtime, name, udid = selected | |
| print(f"runtime={runtime}") | |
| print(f"name={name}") | |
| print(f"udid={udid}") | |
| PY | |
| - name: Boot simulator | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| xcrun simctl boot "${{ steps.simulator.outputs.udid }}" || true | |
| xcrun simctl bootstatus "${{ steps.simulator.outputs.udid }}" -b | |
| - name: Build iOS app for simulator | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p build/ios-derived-data build | |
| xcodebuild \ | |
| -project iosApp/iosApp.xcodeproj \ | |
| -scheme iosApp \ | |
| -configuration Debug \ | |
| -sdk iphonesimulator \ | |
| -derivedDataPath build/ios-derived-data \ | |
| -destination "id=${{ steps.simulator.outputs.udid }}" \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGN_IDENTITY="" \ | |
| DEVELOPMENT_TEAM="" \ | |
| build | tee build/xcodebuild.log | |
| - name: Install and launch app in smoke mode | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| APP_PATH="$(find build/ios-derived-data/Build/Products -maxdepth 2 -type d -name '*.app' | head -n 1)" | |
| BUNDLE_ID="it.buonacaccia.scouteventi.ios" | |
| test -n "$APP_PATH" | |
| test -d "$APP_PATH" | |
| echo "Using app bundle at $APP_PATH" | |
| xcrun simctl install "${{ steps.simulator.outputs.udid }}" "$APP_PATH" | |
| xcrun simctl terminate "${{ steps.simulator.outputs.udid }}" "$BUNDLE_ID" || true | |
| xcrun simctl launch "${{ steps.simulator.outputs.udid }}" "$BUNDLE_ID" --scouteventi-smoke-data | |
| sleep 10 | |
| xcrun simctl spawn "${{ steps.simulator.outputs.udid }}" log show --style compact --last 5m --predicate 'eventMessage CONTAINS "SCOUTEVENTI_SMOKE_READY"' | tee build/ios-smoke-log.txt | |
| grep -q "SCOUTEVENTI_SMOKE_READY" build/ios-smoke-log.txt | |
| xcrun simctl io "${{ steps.simulator.outputs.udid }}" screenshot build/ios-simulator-smoke.png | |
| xcrun simctl terminate "${{ steps.simulator.outputs.udid }}" "$BUNDLE_ID" | |
| - name: Upload simulator artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ios-simulator-smoke | |
| if-no-files-found: ignore | |
| path: | | |
| build/ios-simulator-smoke.png | |
| build/xcodebuild.log | |
| build/ios-smoke-log.txt |