Testing: Enhancement - misc CI updates #35
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: E2E iOS | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: e2e-ios-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| changes: | |
| name: Detect changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| native: ${{ steps.filter.outputs.native }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| native: | |
| - 'ios/**' | |
| - 'yarn.lock' | |
| build-ios: | |
| name: Build iOS App | |
| needs: changes | |
| if: needs.changes.outputs.native == 'true' | |
| runs-on: macos-latest-xlarge | |
| timeout-minutes: 75 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Node | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version-file: '.node-version' | |
| - name: Cache node_modules | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ hashFiles('yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: yarn install --frozen-lockfile | |
| - name: Create env file | |
| env: | |
| ENV_FILE: ${{ secrets.ENV_DEVELOPMENT }} | |
| run: | | |
| echo "$ENV_FILE" > .env.development | |
| echo "IS_MAESTRO=true" >> .env.development | |
| - name: Create Sentry properties | |
| run: | | |
| echo "${{ secrets.SENTRY_PROPERTIES }}" > sentry.properties | |
| echo "${{ secrets.SENTRY_PROPERTIES }}" > ios/sentry.properties | |
| echo "${{ secrets.SENTRY_PROPERTIES }}" > android/sentry.properties | |
| - name: Set native config values | |
| run: yarn set:dev | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '2.7.6' | |
| bundler-cache: true | |
| - name: Select Xcode | |
| run: sudo xcode-select -switch /Applications/Xcode.app | |
| - name: Clean Xcode caches | |
| run: | | |
| rm -rf ios/build | |
| rm -rf ~/Library/Developer/Xcode/DerivedData || true | |
| - name: Cache CocoaPods | |
| uses: actions/cache@v4 | |
| with: | |
| path: ios/Pods | |
| key: pods-${{ hashFiles('ios/Podfile.lock') }} | |
| - name: Install CocoaPods | |
| run: cd ios && bundle exec pod install | |
| - name: Build iOS app for simulator | |
| env: | |
| SENTRY_DISABLE_AUTO_UPLOAD: true | |
| NODE_OPTIONS: "--max_old_space_size=8192" | |
| run: | | |
| xcodebuild \ | |
| -workspace ios/BitPayApp.xcworkspace \ | |
| -scheme BitPayApp \ | |
| -configuration Debug \ | |
| -sdk iphonesimulator \ | |
| -derivedDataPath ios/build \ | |
| -destination 'generic/platform=iOS Simulator' \ | |
| SWIFT_ACTIVE_COMPILATION_CONDITIONS="DEBUG MAESTRO" \ | |
| FORCE_BUNDLING=YES \ | |
| ONLY_ACTIVE_ARCH=YES \ | |
| ARCHS=arm64 \ | |
| build | |
| - name: Save .app to cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app | |
| key: ios-app-${{ hashFiles('ios/Podfile.lock', 'yarn.lock') }} | |
| test-ios: | |
| name: E2E iOS Smoke | |
| needs: [changes, build-ios] | |
| if: always() && (needs.build-ios.result == 'success' || needs.build-ios.result == 'skipped') | |
| runs-on: macos-latest-xlarge | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Node | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version-file: '.node-version' | |
| - name: Cache node_modules | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ hashFiles('yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: yarn install --frozen-lockfile | |
| - name: Create env file | |
| env: | |
| ENV_FILE: ${{ secrets.ENV_DEVELOPMENT }} | |
| run: | | |
| echo "$ENV_FILE" > .env.development | |
| echo "IS_MAESTRO=true" >> .env.development | |
| - name: Restore .app from cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app | |
| key: ios-app-${{ hashFiles('ios/Podfile.lock', 'yarn.lock') }} | |
| fail-on-cache-miss: true | |
| - name: Bundle JS and inject into app | |
| env: | |
| NODE_OPTIONS: "--max_old_space_size=8192" | |
| run: | | |
| npx react-native bundle \ | |
| --platform ios \ | |
| --dev false \ | |
| --entry-file index.js \ | |
| --bundle-output main.jsbundle \ | |
| --assets-dest ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app | |
| cp main.jsbundle ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app/main.jsbundle | |
| - name: Cache Maestro | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.maestro | |
| key: maestro-${{ runner.os }} | |
| restore-keys: maestro-${{ runner.os }} | |
| - name: Install Maestro | |
| run: | | |
| curl -Ls "https://get.maestro.mobile.dev" | bash | |
| echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
| - name: Boot simulator | |
| run: | | |
| UDID=$(xcrun simctl list devices available | grep -E "iPhone [0-9]" | head -1 | grep -E -o '\(([0-9A-F-]+)\)' | tr -d '()') | |
| echo "Booting simulator: $UDID" | |
| xcrun simctl boot "$UDID" | |
| xcrun simctl bootstatus "$UDID" -b | |
| echo "SIMULATOR_UDID=$UDID" >> $GITHUB_ENV | |
| - name: Install app on simulator | |
| run: xcrun simctl install "$SIMULATOR_UDID" ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app | |
| - name: Run Maestro smoke tests | |
| run: maestro test .maestro/flows/ --format junit --output maestro-results.xml | |
| env: | |
| MAESTRO_DRIVER_STARTUP_TIMEOUT: 600000 | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: maestro-ios-results | |
| path: | | |
| maestro-results.xml | |
| ~/.maestro/tests/ | |
| retention-days: 7 | |
| - name: Upload screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: maestro-ios-screenshots | |
| path: ~/.maestro/tests/**/*.png | |
| retention-days: 7 |