@@ -249,185 +249,26 @@ jobs:
249249 runs-on : macos-latest
250250 timeout-minutes : 60
251251
252- env :
253- PLATFORM_VERSION : ${{ inputs.platform-version || '26.0' }}
254- DEVICE_NAME : ${{ inputs.device-name || 'iPhone 16' }}
255-
256252 steps :
257253 - name : Checkout code
258254 uses : actions/checkout@v4
259255
260- # === INSTALL PHASE (from ios-install-template.yml) ===
261- - name : Download iOS app from artifact
262- uses : actions/download-artifact@v4
256+ # Install phase using composite action template
257+ - name : Install iOS App
258+ id : install-ios
259+ uses : ./.github/workflows/ios-install-template.yml
263260 with :
264- name : ${{ needs.build-ios.outputs.artifact_name }}
265- path : ./downloaded-app
266-
267- - name : Unzip app bundle
268- run : |
269- echo "📦 Extracting app bundle..."
270-
271- if [ -f "./downloaded-app/app_bundle.zip" ]; then
272- unzip "./downloaded-app/app_bundle.zip" -d ./downloaded-app/
273- echo "✅ App bundle extracted"
274- else
275- echo "❌ ERROR: app_bundle.zip not found"
276- ls -la ./downloaded-app/
277- exit 1
278- fi
279-
280- - name : Verify app bundle
281- id : verify-app
282- run : |
283- echo "🔍 Verifying .app bundle..."
284- APP_PATH=$(find ./downloaded-app -name "*.app" -type d -maxdepth 2 | head -n 1)
285-
286- if [ -z "$APP_PATH" ]; then
287- echo "❌ ERROR: .app bundle not found"
288- find ./downloaded-app -name "*.app" -type d
289- exit 1
290- fi
291-
292- BUNDLE_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$APP_PATH/Info.plist")
293- echo "📱 Found app: $(basename "$APP_PATH")"
294- echo "📋 Bundle ID: $BUNDLE_ID"
295-
296- echo "APP_PATH=$APP_PATH" >> $GITHUB_ENV
297- echo "BUNDLE_ID=$BUNDLE_ID" >> $GITHUB_ENV
298-
299- - name : Find and boot iOS Simulator
300- id : boot-simulator
301- run : |
302- echo "🔍 Looking for: ${{ env.DEVICE_NAME }} with iOS ${{ env.PLATFORM_VERSION }}"
303-
304- UDID=$(xcrun simctl list devices available -j | python3 -c "
305- import json, sys
306- data = json.load(sys.stdin)
307- target_device = '${{ env.DEVICE_NAME }}'
308- target_version = '${{ env.PLATFORM_VERSION }}'
309- formatted_version = 'iOS-' + target_version.replace(' ', '-').replace('.', '-')
310-
311- for runtime_key, devices in data.get('devices', {}).items():
312- if formatted_version in runtime_key:
313- for device in devices:
314- if device.get('name') == target_device and device.get('isAvailable', False):
315- print(device['udid'])
316- sys.exit(0)
317- sys.exit(1)
318- " 2>/dev/null)
319-
320- if [ -z "$UDID" ]; then
321- echo "❌ ERROR: Could not find ${{ env.DEVICE_NAME }} with iOS ${{ env.PLATFORM_VERSION }}"
322- xcrun simctl list devices available
323- exit 1
324- fi
325-
326- echo "DEVICE_UDID=$UDID" >> $GITHUB_ENV
327- echo "✅ Found simulator: ${{ env.DEVICE_NAME }} ($UDID)"
328-
329- # Boot simulator
330- echo "🚀 Booting simulator..."
331- xcrun simctl boot $UDID 2>/dev/null || echo "Already booted"
332-
333- # Wait for boot (simple approach)
334- echo "⏳ Waiting for simulator to boot..."
335- for i in $(seq 1 120); do
336- if xcrun simctl list devices | grep "$UDID" | grep -q "(Booted)"; then
337- echo "✅ Simulator booted after ${i} seconds"
338- break
339- fi
340- if [ $i -eq 120 ]; then
341- echo "❌ ERROR: Simulator failed to boot"
342- exit 1
343- fi
344- sleep 1
345- done
346-
347- - name : Install and launch app
348- run : |
349- echo "📲 Installing app on simulator..."
350- xcrun simctl install "${{ env.DEVICE_UDID }}" "${{ env.APP_PATH }}"
351-
352- echo "🚀 Launching app..."
353- xcrun simctl launch "${{ env.DEVICE_UDID }}" "${{ env.BUNDLE_ID }}"
354- sleep 5
261+ artifact_name : ${{ needs.build-ios.outputs.artifact_name }}
262+ ios_version : ${{ inputs.platform-version || '26.0' }}
263+ device_name : ${{ inputs.device-name || 'iPhone 16' }}
355264
356- echo "✅ App installed and ready for testing"
357-
358- # === TEST PHASE (from ios-testing-template.yml) ===
359- - name : Setup Node.js
360- uses : actions/setup-node@v4
361- with :
362- node-version : ' 20'
363- cache : ' npm'
364- cache-dependency-path : app/package-lock.json
365-
366- - name : Install dependencies
367- run : npm ci
368- working-directory : ./app
369-
370- - name : Install Appium
371- run : |
372- npm install -g appium@3.1.1
373- appium driver install xcuitest
374- appium --version
375-
376- - name : Start Appium Server
377- run : |
378- echo "Starting Appium server..."
379- appium --log-level info --log appium.log &
380- APPIUM_PID=$!
381- echo ${APPIUM_PID} > appium.pid
382-
383- # Wait for Appium to start
384- for i in $(seq 1 60); do
385- if curl -s "http://localhost:4723/status" > /dev/null; then
386- echo "✅ Appium server ready"
387- break
388- fi
389- if [ $i -eq 60 ]; then
390- echo "❌ ERROR: Appium failed to start"
391- cat appium.log
392- exit 1
393- fi
394- sleep 1
395- done
396-
397- - name : Run Appium Tests
398- env :
399- APPIUM_HOST : localhost
400- APPIUM_PORT : 4723
401- DEVICE_UDID : ${{ env.DEVICE_UDID }}
402- DEVICE_NAME : ${{ env.DEVICE_NAME }}
403- PLATFORM_VERSION : ${{ env.PLATFORM_VERSION }}
404- APP_BUNDLE_ID : ${{ env.BUNDLE_ID }}
405- AUTOMATION_NAME : XCUITest
406- PLATFORM_NAME : iOS
407- run : |
408- echo "🧪 Running Appium tests..."
409- echo "Device: ${{ env.DEVICE_NAME }} (${{ env.DEVICE_UDID }})"
410- echo "App: ${{ env.BUNDLE_ID }}"
411-
412- npm test -- --testNamePattern="Appium"
413- working-directory : ./app
414-
415- - name : Stop Appium Server
416- if : always()
417- run : |
418- if [ -f appium.pid ]; then
419- APPIUM_PID=$(cat appium.pid)
420- kill $APPIUM_PID || true
421- echo "Appium server stopped"
422- fi
423-
424- - name : Upload test results
425- if : always()
426- uses : actions/upload-artifact@v4
265+ # Test phase using composite action template
266+ - name : Test iOS App
267+ uses : ./.github/workflows/ios-testing-template.yml
427268 with :
428- name : ios-test-results- ${{ github.sha }}
429- path : |
430- app/test-results/
431- appium.log
432- retention-days : 7
433- if-no-files-found : warn
269+ device_uuid : ${{ steps.install-ios.outputs.device_udid }}
270+ ios_version : ${{ inputs.platform-version || '26.0' }}
271+ device_name : ${{ inputs.device-name || 'iPhone 16' }}
272+ node_version : ' 20 '
273+ appium_version : ' 3.1.1 '
274+ app_bundle_id : ${{ steps.install-ios.outputs.bundle_id }}
0 commit comments