chore(ios): GitHub Actions test workflow and complete Vietnamese localization #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 Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - "TableProMobile/**" | |
| - "Packages/TableProCore/**" | |
| - "Libs/**" | |
| - ".github/workflows/ios-tests.yml" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "TableProMobile/**" | |
| - "Packages/TableProCore/**" | |
| - "Libs/**" | |
| - ".github/workflows/ios-tests.yml" | |
| workflow_dispatch: | |
| env: | |
| XCODE_PROJECT: TableProMobile/TableProMobile.xcodeproj | |
| XCODE_SCHEME: TableProMobile | |
| jobs: | |
| test: | |
| name: Run iOS Tests | |
| runs-on: macos-26 | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Select Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '26.5-beta' | |
| - name: Install xcbeautify | |
| run: brew list xcbeautify &>/dev/null || brew install xcbeautify | |
| - name: Show installed iOS simulator runtimes | |
| run: | | |
| echo "=== xcodebuild -showsdks ===" | |
| xcodebuild -showsdks | grep -i ios || true | |
| echo "=== xcrun simctl list runtimes ===" | |
| xcrun simctl list runtimes | |
| echo "=== xcrun simctl list devices available (iOS section) ===" | |
| xcrun simctl list devices available | sed -n '/iOS/,/^--/p' | head -80 | |
| - name: Install latest iOS simulator runtime | |
| run: | | |
| # Always run -downloadPlatform; it is idempotent and ensures the runtime | |
| # matching the Xcode SDK is present. Older partial-version runtimes are | |
| # not enough on Xcode 26.5 because xcodebuild rejects simulators whose | |
| # SDK is older than the project's compile SDK. | |
| sudo xcodebuild -downloadPlatform iOS | |
| - name: Download static libraries | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: scripts/download-libs.sh --force | |
| - name: Resolve Swift package dependencies | |
| run: | | |
| xcodebuild -resolvePackageDependencies \ | |
| -project "$XCODE_PROJECT" \ | |
| -scheme "$XCODE_SCHEME" \ | |
| -skipPackagePluginValidation | |
| - name: Show destinations xcodebuild sees | |
| run: | | |
| xcodebuild -showdestinations \ | |
| -project "$XCODE_PROJECT" \ | |
| -scheme "$XCODE_SCHEME" \ | |
| -skipPackagePluginValidation 2>&1 | head -80 || true | |
| - name: Pick iOS simulator destination | |
| id: sim | |
| run: | | |
| # Pick a specific iPhone simulator UDID by walking installed iOS runtimes | |
| # (highest version first) and trying preferred device names. Returning a | |
| # UDID via `id=` avoids both the runtime-version-string mismatch (26.4 vs | |
| # 26.4.1) and the `OS=latest` template-vs-installed mismatch. | |
| udid=$(xcrun simctl list -j devices available | python3 -c ' | |
| import json, re, sys | |
| data = json.load(sys.stdin) | |
| ios_runtimes = sorted( | |
| [k for k in data["devices"] if "iOS" in k], | |
| key=lambda k: tuple(int(p) for p in re.findall(r"\d+", k)), | |
| reverse=True, | |
| ) | |
| preferred = ["iPhone 17 Pro", "iPhone 16 Pro", "iPhone 16", "iPhone 15 Pro", "iPhone 15"] | |
| for runtime in ios_runtimes: | |
| for name in preferred: | |
| for dev in data["devices"][runtime]: | |
| if dev.get("isAvailable") and dev["name"] == name: | |
| print("%s|%s|%s" % (dev["udid"], name, runtime)) | |
| sys.exit(0) | |
| ') | |
| if [ -z "$udid" ]; then | |
| echo "No matching iPhone simulator found" | |
| xcrun simctl list devices available | |
| exit 1 | |
| fi | |
| UDID="${udid%%|*}" | |
| rest="${udid#*|}" | |
| NAME="${rest%%|*}" | |
| RUNTIME="${rest#*|}" | |
| echo "Picked $NAME ($UDID) on $RUNTIME" | |
| echo "udid=$UDID" >> "$GITHUB_OUTPUT" | |
| - name: Run unit tests | |
| run: | | |
| set -o pipefail | |
| xcodebuild test \ | |
| -project "$XCODE_PROJECT" \ | |
| -scheme "$XCODE_SCHEME" \ | |
| -destination "platform=iOS Simulator,id=${{ steps.sim.outputs.udid }}" \ | |
| -only-testing:TableProMobileTests \ | |
| -skipPackagePluginValidation \ | |
| -resultBundlePath TestResults.xcresult \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| | xcbeautify --renderer github-actions | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ios-test-results | |
| path: TestResults.xcresult | |
| retention-days: 7 |