Skip to content

Commit 6f1ea64

Browse files
committed
ios: build & upload XCTest ipa + install
1 parent ecc420d commit 6f1ea64

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

.github/workflows/harness-aws-device.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ env:
6363
HARNESS_IOS_APP_BUILD_OUTPUT: apps/simple-camera/ios/build/devicefarm/SimpleCamera.ipa
6464
HARNESS_IOS_DERIVED_DATA_OUTPUT: apps/simple-camera/ios/build/devicefarm/DerivedData
6565
HARNESS_IOS_IPA_ARTIFACT_NAME: harness-ios-ipa
66+
HARNESS_IOS_HARNESS_XCTEST_RUNNER_IPA_ARTIFACT_NAME: harness-xctest-agent-ipa
67+
HARNESS_IOS_HARNESS_XCTEST_RUNNER_IPA_PATH: apps/simple-camera/ios/build/devicefarm/HarnessXCTestAgentUITests.ipa
6668
HARNESS_DEVICE_FARM_TEST_PACKAGE_OUTPUT: devicefarm-test-package.zip
6769
HARNESS_ANDROID_BUNDLE_ID: com.margelo.nitro.camera.example.simple
6870
HARNESS_ANDROID_DEVICE_ARCH: ${{ github.event.inputs.device_arch || 'arm64-v8a' }}
@@ -405,6 +407,51 @@ jobs:
405407
zip -qry "$GITHUB_WORKSPACE/$IPA_PATH" Payload
406408
)
407409
410+
- name: Build Harness XCTest UI runner IPA
411+
run: |
412+
set -euo pipefail
413+
414+
PLATFORM_PACKAGE_JSON="$(node -p "require.resolve('@react-native-harness/platform-apple/package.json')")"
415+
PLATFORM_APPLE_ROOT="$(dirname "$PLATFORM_PACKAGE_JSON")"
416+
417+
DERIVED_DATA="apps/simple-camera/ios/build/devicefarm/HarnessXCTestAgentDerivedData"
418+
IPA_PATH="apps/simple-camera/ios/build/devicefarm/HarnessXCTestAgentUITests.ipa"
419+
PROJECT_PATH="$PLATFORM_APPLE_ROOT/xctest-agent/HarnessXCTestAgent.xcodeproj"
420+
421+
PAYLOAD_ROOT="$(mktemp -d)"
422+
PAYLOAD_DIR="$PAYLOAD_ROOT/Payload"
423+
424+
rm -rf "$DERIVED_DATA" "$IPA_PATH"
425+
mkdir -p "$DERIVED_DATA" "$(dirname "$IPA_PATH")" "$PAYLOAD_DIR"
426+
427+
xcodebuild \
428+
-project "$PROJECT_PATH" \
429+
-scheme HarnessXCTestAgent \
430+
-configuration Debug \
431+
-sdk iphoneos \
432+
-destination generic/platform=iOS \
433+
-derivedDataPath "$DERIVED_DATA" \
434+
-showBuildTimingSummary \
435+
build-for-testing \
436+
CODE_SIGNING_ALLOWED=NO \
437+
CODE_SIGNING_REQUIRED=NO \
438+
CODE_SIGN_IDENTITY= \
439+
DEVELOPMENT_TEAM= \
440+
COMPILER_INDEX_STORE_ENABLE=NO | xcbeautify --renderer github-actions
441+
442+
RUNNER_APP="$(find "$DERIVED_DATA/Build/Products/Debug-iphoneos" -maxdepth 1 -type d -name '*UITests-Runner.app' -print -quit)"
443+
test -n "$RUNNER_APP"
444+
test -d "$RUNNER_APP"
445+
446+
cp -R "$RUNNER_APP" "$PAYLOAD_DIR/"
447+
448+
(
449+
cd "$PAYLOAD_ROOT"
450+
zip -qry "$GITHUB_WORKSPACE/$IPA_PATH" Payload
451+
)
452+
453+
test -f "$IPA_PATH"
454+
408455
- name: Save DerivedData cache
409456
if: steps.cache-deriveddata-restore.outputs.cache-hit != 'true' && success()
410457
uses: actions/cache/save@v4
@@ -423,6 +470,14 @@ jobs:
423470
if-no-files-found: error
424471
retention-days: 7
425472

473+
- name: Upload Harness XCTest UI runner IPA
474+
uses: actions/upload-artifact@v4
475+
with:
476+
name: ${{ env.HARNESS_IOS_HARNESS_XCTEST_RUNNER_IPA_ARTIFACT_NAME }}
477+
path: ${{ env.HARNESS_IOS_HARNESS_XCTEST_RUNNER_IPA_PATH }}
478+
if-no-files-found: error
479+
retention-days: 7
480+
426481
test-ios:
427482
name: Test iOS
428483
runs-on: ubuntu-latest
@@ -463,6 +518,17 @@ jobs:
463518
content-type: application/octet-stream
464519
upload-name: simple-camera-${{ github.run_id }}-${{ github.run_attempt }}.ipa
465520

521+
- name: Upload Harness XCTest UI runner IPA to AWS Device Farm
522+
id: upload-xctest-runner
523+
uses: ./.github/actions/upload-devicefarm-artifact
524+
with:
525+
project-arn: ${{ env.HARNESS_DEVICE_FARM_PROJECT_ARN }}
526+
aws-region: ${{ env.HARNESS_AWS_REGION }}
527+
file-path: ${{ env.HARNESS_IOS_HARNESS_XCTEST_RUNNER_IPA_PATH }}
528+
upload-type: IOS_APP
529+
content-type: application/octet-stream
530+
upload-name: ${{ env.HARNESS_IOS_HARNESS_XCTEST_RUNNER_IPA_ARTIFACT_NAME }}-${{ github.run_id }}-${{ github.run_attempt }}.ipa
531+
466532
- name: Schedule Device Farm iOS Automated Test
467533
id: run-test
468534
uses: aws-actions/aws-devicefarm-mobile-device-testing@v2.3
@@ -473,6 +539,11 @@ jobs:
473539
"projectArn": "${{ env.HARNESS_DEVICE_FARM_PROJECT_ARN }}",
474540
"appArn": "${{ steps.upload-ipa.outputs['upload-arn'] }}",
475541
"devicePoolArn": "${{ env.HARNESS_DEVICE_FARM_IOS_DEVICE_POOL_ARN }}",
542+
"configuration": {
543+
"auxiliaryApps": [
544+
"${{ steps.upload-xctest-runner.outputs['upload-arn'] }}"
545+
]
546+
},
476547
"test": {
477548
"type": "APPIUM_NODE",
478549
"testPackageArn": "${{ needs.prepare-devicefarm-assets.outputs.test_package_arn }}",

0 commit comments

Comments
 (0)