Skip to content

CI E2E Tests iOS

CI E2E Tests iOS #2

name: CI E2E Tests iOS
on:
workflow_dispatch:
jobs:
build_apps:
name: Build ${{ matrix.app.name }} App
runs-on: macos-latest-xlarge
strategy:
fail-fast: false
matrix:
app:
- name: 'Wallet'
root_path: 'wallets/rn_cli_wallet'
google_services_secret: 'W3W_IOS_INTERNAL_GOOGLE_SERVICES_FILE'
sentry_file_secret: 'W3W_SENTRY_FILE'
sentry_dsn_secret: 'W3W_SENTRY_DSN'
pod_cache_key_suffix: 'wallet'
workspace: 'RNWeb3Wallet.xcworkspace'
scheme: 'RNWallet-Internal'
app_name_in_zip: 'RNWallet-Internal.app'
zip_name: 'wallet.zip'
artifact_name: 'rn_cli_wallet-internal-app'
artifact_path: 'wallets/rn_cli_wallet/wallet.zip'
- name: 'dApp'
root_path: 'dapps/W3MWagmi'
google_services_secret: 'EMPTY_SECRET' # This does not exist, so it will be an empty string
sentry_file_secret: 'W3M_WAGMI_SENTRY_FILE'
sentry_dsn_secret: 'W3M_WAGMI_SENTRY_DSN'
pod_cache_key_suffix: 'dapp'
workspace: 'W3MWagmi.xcworkspace'
scheme: 'W3MWagmi Internal'
app_name_in_zip: 'W3MWagmi Internal.app'
zip_name: 'dapp.zip'
artifact_name: 'W3MWagmi-internal-app'
artifact_path: 'dapps/W3MWagmi/dapp.zip'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup iOS files for ${{ matrix.app.name }}
uses: ./.github/actions/ci-setup-ios-files
with:
root-path: ${{ matrix.app.root_path }}
google-services-file: ${{ secrets[matrix.app.google_services_secret] }}
sentry-file: ${{ secrets[matrix.app.sentry_file_secret] }}
project-id: ${{ secrets.ENV_PROJECT_ID }}
relay-url: ${{ secrets.ENV_RELAY_URL }}
sentry-dsn: ${{ secrets[matrix.app.sentry_dsn_secret] }}
release-type: 'internal'
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_16.2.app
- name: Install dependencies
working-directory: ./${{ matrix.app.root_path }}
run: |
yarn install --immutable
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.0
bundler-cache: true
- name: Install Cocoapods
run: gem install cocoapods
- name: Cache pods
id: pods-cache-wallet
uses: actions/cache@v4
with:
path: ${{ matrix.app.root_path }}/ios/Pods
key: ${{ runner.os }}-pods-${{ matrix.app.pod_cache_key_suffix }}-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.app.root_path)) }}
restore-keys: |
${{ runner.os }}-pods-${{ matrix.app.pod_cache_key_suffix }}-
- name: Install Pods
if: steps.pods-cache-wallet.outputs.cache-hit != 'true'
working-directory: ./${{ matrix.app.root_path }}/ios
run: pod install
- name: Build ${{ matrix.app.name }} App for Simulator
working-directory: ./${{ matrix.app.root_path }}/ios
run: |
export SENTRY_DISABLE_AUTO_UPLOAD=true && set -o pipefail && xcodebuild -workspace ${{ matrix.app.workspace }} -scheme "${{ matrix.app.scheme }}" -configuration Release -sdk iphonesimulator -derivedDataPath ./build
- name: List build products
if: always()
working-directory: ./${{ matrix.app.root_path }}/ios
run: ls -R build
- name: Create app package
working-directory: ./${{ matrix.app.root_path }}/ios
run: |
cd build/Build/Products/Release-iphonesimulator
zip -r ../../../../${{ matrix.app.zip_name }} . -i "${{ matrix.app.app_name_in_zip }}"
- name: Upload ${{ matrix.app.name }} App
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.app.artifact_name }}
path: ${{ matrix.app.artifact_path }}
run_e2e_tests:
name: Run E2E Tests
timeout-minutes: 60
runs-on: macos-14-xlarge
needs: [build_apps]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_16.2.app
- name: Download all Apps
uses: actions/download-artifact@v4
with:
path: apps
merge-multiple: true
- name: List Apps
run: |
echo "Available apps:"
find apps -name "*.zip" | xargs ls -la
- name: Unzip apps
run: |
mkdir -p apps/wallet
unzip apps/rn_cli_wallet-internal-app/wallet.zip -d apps/wallet
mkdir -p apps/dapp
unzip apps/W3MWagmi-internal-app/dapp.zip -d apps/dapp
- name: List extracted apps
run: |
echo "Available apps:"
find apps -name "*.app" | xargs ls -la
- name: Install Maestro
uses: ./.github/actions/ci-setup-maestro
- name: Run iOS Simulator and Tests
run: |
set -x
# Setup debug directory
mkdir -p debug-artifacts
# Start simulator
SIM_DEVICE_NAME="iPhone-13-E2E"
SIM_DEVICE_TYPE="iPhone 13"
SIM_RUNTIME_ID=$(xcrun simctl list runtimes | grep "iOS 18" | awk '{print $NF}' | head -n 1)
if [ -z "$SIM_RUNTIME_ID" ]; then
echo "No iOS 18 runtime found. Please check installed simulators."
exit 1
fi
# Create a new simulator instance
UDID=$(xcrun simctl create "$SIM_DEVICE_NAME" "$SIM_DEVICE_TYPE" "$SIM_RUNTIME_ID" || xcrun simctl list devices | grep "$SIM_DEVICE_NAME" | awk -F'[()]' '{print $2}')
# Boot the simulator
xcrun simctl boot "$UDID"
# Wait for boot completion
echo "Waiting for boot completion..."
xcrun simctl wait "$UDID" boot
echo "Boot completed!"
# Expose UDID for maestro
export MAESTRO_IOS_DEVICE="$UDID"
# Install Apps
WALLET_APP_PATH=$(find apps/wallet -name "*.app" | head -n 1)
DAPP_APP_PATH=$(find apps/dapp -name "*.app" | head -n 1)
# Install apps
echo "Installing apps:"
xcrun simctl install "$UDID" "$WALLET_APP_PATH"
xcrun simctl install "$UDID" "$DAPP_APP_PATH"
# Verify installations
echo "Verifying installed apps:"
xcrun simctl listapps "$UDID" | grep -E "com.walletconnect" || (echo "ERROR: Apps not installed correctly" && exit 1)
echo "Running Maestro native to native tests:"
maestro test .maestro/native/connect_reject.yaml
maestro test .maestro/native/connect_confirm.yaml
maestro test .maestro/native/personal_sign_confirm.yaml
maestro test .maestro/native/personal_sign_reject.yaml
- name: Upload debug artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: debug-artifacts
path: debug-artifacts/
if-no-files-found: warn
- name: Upload Maestro artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: maestro-artifacts
path: |
.maestro/
videos/
*.mp4
*.mov
if-no-files-found: warn