Improve performance hot paths across the app #344
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: Test Suite | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - '**.swift' | |
| - 'Package.swift' | |
| - 'Sources/**' | |
| - 'Tests/**' | |
| - 'Scripts/**' | |
| - '.github/workflows/tests.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - '**.swift' | |
| - 'Package.swift' | |
| - 'Sources/**' | |
| - 'Tests/**' | |
| - 'Scripts/**' | |
| - '.github/workflows/tests.yml' | |
| workflow_dispatch: | |
| jobs: | |
| macos_unit_tests: | |
| name: macOS Unit Tests | |
| runs-on: macos-26 | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Clear SPM artifacts cache | |
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | |
| - name: Run unit tests | |
| run: swift test -q | |
| ios_build_check: | |
| name: iOS Build Check | |
| runs-on: macos-26 | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Clear SPM artifacts cache | |
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | |
| - name: Compile for iOS | |
| run: swift build --triple arm64-apple-ios26.0 --sdk "$(xcrun --sdk iphoneos --show-sdk-path)" | |
| watchos_build_check: | |
| name: watchOS Build Check | |
| runs-on: macos-26 | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Clear SPM artifacts cache | |
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | |
| - name: Compile for watchOS | |
| run: swift build --triple arm64-apple-watchos26.0 --sdk "$(xcrun --sdk watchos --show-sdk-path)" | |
| macos_ui_tests: | |
| name: macOS UI Tests | |
| runs-on: macos-26 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Clear SPM artifacts cache | |
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | |
| - name: Build app for UI tests | |
| env: | |
| AYNA_SIGNING: adhoc | |
| run: Scripts/build-app.sh debug | |
| - name: Install app | |
| run: | | |
| sudo cp -R .build/app/Ayna.app /Applications/Ayna.app | |
| - name: Register app with Launch Services | |
| run: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f /Applications/Ayna.app | |
| - name: Run UI tests (with retry) | |
| run: | | |
| set -o pipefail | |
| for attempt in 1 2; do | |
| echo "Attempt $attempt of 2" | |
| if xcodebuild \ | |
| -project AynaUITests.xcodeproj \ | |
| -scheme AynaUITests \ | |
| -destination 'platform=macOS' \ | |
| -resultBundlePath ./build/TestResults-macOS-UI.xcresult \ | |
| -retry-tests-on-failure \ | |
| test; then | |
| echo "Tests passed on attempt $attempt" | |
| break | |
| fi | |
| if [ $attempt -lt 2 ]; then | |
| echo "Tests failed, retrying..." | |
| rm -rf ./build/TestResults-macOS-UI.xcresult | |
| sleep 5 | |
| else | |
| echo "Tests failed after 2 attempts" | |
| exit 1 | |
| fi | |
| done | |
| - name: Upload test results on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: macOS-UI-TestResults | |
| path: ./build/*.xcresult | |
| retention-days: 7 | |
| ios_ui_tests: | |
| name: iOS UI Tests | |
| runs-on: macos-26 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Clear SPM artifacts cache | |
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | |
| - name: List available simulators | |
| run: | | |
| echo "Available iOS runtimes:" | |
| xcrun simctl list runtimes | grep -i ios || true | |
| echo "Available iOS devices:" | |
| xcrun simctl list devices available | grep -i iphone | head -20 || true | |
| - name: Prepare iOS Simulator | |
| run: | | |
| # Pick the last (latest runtime) device to avoid "multiple devices matched" errors | |
| DEVICE_UDID=$(xcrun simctl list devices available | grep "iPhone 17" | tail -1 | grep -oE '[A-F0-9-]{36}') | |
| echo "DEVICE_UDID=$DEVICE_UDID" >> "$GITHUB_ENV" | |
| echo "Preparing simulator: iPhone 17 ($DEVICE_UDID)" | |
| xcrun simctl shutdown "$DEVICE_UDID" 2>/dev/null || true | |
| sleep 3 | |
| - name: Build iOS app | |
| run: | | |
| set -o pipefail | |
| xcodebuild \ | |
| -project AynaMobile.xcodeproj \ | |
| -scheme Ayna-iOS \ | |
| -destination "id=$DEVICE_UDID" \ | |
| -derivedDataPath ./build \ | |
| -configuration Debug \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| build | |
| - name: Install iOS app on simulator | |
| run: | | |
| APP_PATH=$(find ./build -name "Ayna.app" -path "*/Debug-iphonesimulator/*" | head -1) | |
| xcrun simctl boot "$DEVICE_UDID" 2>/dev/null || true | |
| xcrun simctl bootstatus "$DEVICE_UDID" -b 2>/dev/null || sleep 5 | |
| xcrun simctl install "$DEVICE_UDID" "$APP_PATH" | |
| - name: Run iOS UI tests (with retry) | |
| run: | | |
| set -o pipefail | |
| for attempt in 1 2; do | |
| echo "Attempt $attempt of 2" | |
| if xcodebuild \ | |
| -project AynaUITests.xcodeproj \ | |
| -scheme AynaIOSUITests \ | |
| -destination "id=$DEVICE_UDID" \ | |
| -resultBundlePath ./build/TestResults-iOS-UI.xcresult \ | |
| -parallel-testing-enabled NO \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| -retry-tests-on-failure \ | |
| test; then | |
| echo "Tests passed on attempt $attempt" | |
| break | |
| fi | |
| if [ $attempt -lt 2 ]; then | |
| echo "Tests failed, retrying..." | |
| rm -rf ./build/TestResults-iOS-UI.xcresult | |
| sleep 5 | |
| else | |
| echo "Tests failed after 2 attempts" | |
| exit 1 | |
| fi | |
| done | |
| - name: Upload test results on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: iOS-UI-TestResults | |
| path: ./build/*.xcresult | |
| retention-days: 7 | |
| watchos_ui_tests: | |
| name: watchOS UI Tests | |
| runs-on: macos-26 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Clear SPM artifacts cache | |
| run: rm -rf ~/Library/Caches/org.swift.swiftpm/artifacts | |
| - name: List available simulators | |
| run: | | |
| echo "Available watchOS runtimes:" | |
| xcrun simctl list runtimes | grep -i watch || true | |
| echo "Available watchOS devices:" | |
| xcrun simctl list devices available | grep -i watch | head -20 || true | |
| - name: Prepare watchOS Simulator | |
| run: | | |
| # Pick the last (latest runtime) device to avoid "multiple devices matched" errors | |
| DEVICE_UDID=$(xcrun simctl list devices available | grep "Apple Watch Ultra 3 (49mm)" | tail -1 | grep -oE '[A-F0-9-]{36}') | |
| echo "DEVICE_UDID=$DEVICE_UDID" >> "$GITHUB_ENV" | |
| echo "Preparing simulator: Apple Watch Ultra 3 ($DEVICE_UDID)" | |
| xcrun simctl shutdown "$DEVICE_UDID" 2>/dev/null || true | |
| sleep 3 | |
| - name: Build watchOS app | |
| run: | | |
| set -o pipefail | |
| xcodebuild \ | |
| -project AynaMobile.xcodeproj \ | |
| -scheme Ayna-watchOS \ | |
| -destination "id=$DEVICE_UDID" \ | |
| -derivedDataPath ./build \ | |
| -configuration Debug \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| build | |
| - name: Install watchOS app on simulator | |
| run: | | |
| APP_PATH=$(find ./build -name "Ayna Watch App.app" -path "*/Debug-watchsimulator/*" | head -1) | |
| xcrun simctl boot "$DEVICE_UDID" 2>/dev/null || true | |
| xcrun simctl bootstatus "$DEVICE_UDID" -b 2>/dev/null || sleep 5 | |
| xcrun simctl install "$DEVICE_UDID" "$APP_PATH" | |
| - name: Run watchOS UI tests (with retry) | |
| run: | | |
| set -o pipefail | |
| for attempt in 1 2; do | |
| echo "Attempt $attempt of 2" | |
| if xcodebuild \ | |
| -project AynaUITests.xcodeproj \ | |
| -scheme AynaWatchOSUITests \ | |
| -destination "id=$DEVICE_UDID" \ | |
| -resultBundlePath ./build/TestResults-watchOS-UI.xcresult \ | |
| -parallel-testing-enabled NO \ | |
| CODE_SIGN_IDENTITY="" \ | |
| CODE_SIGNING_REQUIRED=NO \ | |
| CODE_SIGNING_ALLOWED=NO \ | |
| -retry-tests-on-failure \ | |
| test; then | |
| echo "Tests passed on attempt $attempt" | |
| break | |
| fi | |
| if [ $attempt -lt 2 ]; then | |
| echo "Tests failed, retrying..." | |
| rm -rf ./build/TestResults-watchOS-UI.xcresult | |
| sleep 5 | |
| else | |
| echo "Tests failed after 2 attempts" | |
| exit 1 | |
| fi | |
| done | |
| - name: Upload test results on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: watchOS-UI-TestResults | |
| path: ./build/*.xcresult | |
| retention-days: 7 |