merge: integrate iOS and Android variants #6
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 UI Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - ".github/workflows/ios-ui-tests.yml" | |
| - ".github/workflows/ios-simulator-smoke.yml" | |
| - "iosApp/**" | |
| - "shared/**" | |
| - "settings.gradle.kts" | |
| - "build.gradle.kts" | |
| - "gradle/**" | |
| - "gradlew" | |
| - "gradlew.bat" | |
| jobs: | |
| ui-tests: | |
| runs-on: macos-15 | |
| timeout-minutes: 40 | |
| 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: Run XCUITests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p build/ios-ui-tests | |
| xcodebuild \ | |
| -project iosApp/iosApp.xcodeproj \ | |
| -scheme iosAppUITests \ | |
| -configuration Debug \ | |
| -sdk iphonesimulator \ | |
| -derivedDataPath build/ios-ui-tests/derived-data \ | |
| -resultBundlePath build/ios-ui-tests/ios-ui-tests.xcresult \ | |
| -destination "id=${{ steps.simulator.outputs.udid }}" \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGN_IDENTITY="" \ | |
| DEVELOPMENT_TEAM="" \ | |
| test | tee build/ios-ui-tests/xcodebuild-ui-tests.log | |
| - name: Capture post-test screenshot | |
| if: always() | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p build/ios-ui-tests | |
| xcrun simctl io "${{ steps.simulator.outputs.udid }}" screenshot build/ios-ui-tests/post-test-screenshot.png || true | |
| - name: Upload UI test artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ios-ui-tests | |
| if-no-files-found: ignore | |
| path: | | |
| build/ios-ui-tests/xcodebuild-ui-tests.log | |
| build/ios-ui-tests/ios-ui-tests.xcresult | |
| build/ios-ui-tests/post-test-screenshot.png |