Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Nova workflow to run iOS test on AWS Device Farm (#4973)
This adds a new Nova workflow called `mobile_job` that can be used to run app tests on AWS Device Farm 1. In the initial version, the workflow will support running xctest suite for iOS app. It requires the iOS IPA app archive and xctest suite as inputs per https://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-ios-xctest.html. For example, ``` jobs: test-mobile-job: permissions: id-token: write contents: read uses: ./.github/workflows/mobile_job.yml with: device-type: ios runner: ubuntu-latest # This is PyTorch project on Device Farm project-arn: arn:aws:devicefarm:us-west-2:308535385114:project:b531574a-fb82-40ae-b687-8f0b81341ae0 # The caller workflow will need to provide these artifacts. GHA support could be added later together with S3 ios-ipa-archive: https://ossci-assets.s3.amazonaws.com/TestApp.ipa ios-xctest-zip: https://ossci-assets.s3.amazonaws.com/TestAppTests.xctest.zip ``` 2. The main logic is in the script `tools/device-farm-runner/run_on_aws_devicefarm.py` where it uploads the IPA app archive and xctest suite to Device Farm, pools for the results, and reports back. For example, ``` python run_on_aws_devicefarm.py --project-arn arn:aws:devicefarm:us-west-2:308535385114:project:b531574a-fb82-40ae-b687-8f0b81341ae0 --app-file ~/TestApp.ipa --xctest-file ~/TestAppTests.xctest.zip --name-prefix debug ``` 3. The permission to Device Farm is granted by the role `gha_workflow_mobile_job` from pytorch-labs/pytorch-gha-infra#348 ### Testing On CI, I setup a test workflow to run PyTorch iOS app tests https://github.com/pytorch/test-infra/actions/runs/8074168433/job/22059038480?pr=4973 Locally, * If the run on Device Farm passes: ``` Run debug-invalid-workflow-id-0-2024-02-27-qVMFnLAf is scheduled as arn:aws:devicefarm:us-west-2:308535385114:run:b531574a-fb82-40ae-b687-8f0b81341ae0/295735c2-2a07-46f8-be67-ef9604a62d17 mobile-job-ios-8060493871-2-2024-02-27-IdKPJMzZ PASSED with stats {'total': 195, 'passed': 195, 'failed': 0, 'warned': 0, 'errored': 0, 'stopped': 0, 'skipped': 0} ``` * If the run on Device Farm fails, the failed tests will be print together with the link to their artifacts on S3 for manual debugging: ``` Run debug-invalid-workflow-id-0-2024-02-27-XNivrOMS is scheduled as arn:aws:devicefarm:us-west-2:308535385114:run:b531574a-fb82-40ae-b687-8f0b81341ae0/fea59a70-c1ef-41ac-81c3-b8225b4aecf1 PyTorch-2023-09-29-OeFtuHCz FAILED Apple iPad Pro 12.9" (2022) PASSED Apple iPhone 11 PASSED Apple iPhone 13 FAILED Setup Suite PASSED with stats {'total': 1, 'passed': 1, 'failed': 0, 'warned': 0, 'errored': 0, 'stopped': 0, 'skipped': 0} TestAppTests FAILED with stats {'total': 37, 'passed': 36, 'failed': 1, 'warned': 0, 'errored': 0, 'stopped': 0, 'skipped': 0} testTorchScriptCollectionQuantOps PASSED testTorchScriptBuiltinQuantOps PASSED testFusedQuantOps PASSED testStaticQuantOps PASSED testDynamicQuantOps PASSED testQuantOps PASSED testNNUtilsOps PASSED testShuffleOps PASSED testVisionFunctionOps PASSED testLossFunctionOps PASSED testDistanceFunctionOps PASSED testSparseOps PASSED testDropoutOps PASSED testLinearOps PASSED testTransformerOps PASSED testRecurrentOps PASSED testNormalizationOps PASSED testActivationOps PASSED testPaddingOps PASSED testPoolingOps PASSED testConvolutionOps PASSED testTensorViewOps PASSED testTensorTypingOps PASSED testTensorIndexingOps PASSED testTensorCreationOps PASSED testTensorOps PASSED testSamplingOps PASSED testBlasLapackOps PASSED testSpectralOps PASSED testOtherMathOps PASSED testComparisonOps PASSED testReductionOps PASSED testPointwiseOps PASSED testMobileNetV2 PASSED testLiteInterpreter PASSED testModel PASSED testCoreML FAILED Saving FILE Automation_Output.txt (AUTOMATION_OUTPUT) at https://gha-artifacts.s3.amazonaws.com/device_farm/invalid-workflow-id/0/arn_aws_devicefarm_us-west-2_308535385114_artifact_b531574a-fb82-40ae-b687-8f0b81341ae0_fea59a70-c1ef-41ac-81c3-b8225b4aecf1_00003_00001_00036_00000_Automation_Output.txt Saving FILE Application_Output.txt (UNKNOWN) at https://gha-artifacts.s3.amazonaws.com/device_farm/invalid-workflow-id/0/arn_aws_devicefarm_us-west-2_308535385114_artifact_b531574a-fb82-40ae-b687-8f0b81341ae0_fea59a70-c1ef-41ac-81c3-b8225b4aecf1_00003_00001_00036_00001_Application_Output.txt Saving FILE Application_Crash_Report.ips (APPLICATION_CRASH_REPORT) at https://gha-artifacts.s3.amazonaws.com/device_farm/invalid-workflow-id/0/arn_aws_devicefarm_us-west-2_308535385114_artifact_b531574a-fb82-40ae-b687-8f0b81341ae0_fea59a70-c1ef-41ac-81c3-b8225b4aecf1_00003_00001_00036_00002_Application_Crash_Report.ips Saving FILE Video.mp4 (VIDEO) at https://gha-artifacts.s3.amazonaws.com/device_farm/invalid-workflow-id/0/arn_aws_devicefarm_us-west-2_308535385114_artifact_b531574a-fb82-40ae-b687-8f0b81341ae0_fea59a70-c1ef-41ac-81c3-b8225b4aecf1_00003_00001_00036_00003_Video.mp4 Saving FILE Syslog.syslog (DEVICE_LOG) at https://gha-artifacts.s3.amazonaws.com/device_farm/invalid-workflow-id/0/arn_aws_devicefarm_us-west-2_308535385114_artifact_b531574a-fb82-40ae-b687-8f0b81341ae0_fea59a70-c1ef-41ac-81c3-b8225b4aecf1_00003_00001_00036_00004_Syslog.syslog Saving FILE TCP_dump_log.txt (RAW_FILE) at https://gha-artifacts.s3.amazonaws.com/device_farm/invalid-workflow-id/0/arn_aws_devicefarm_us-west-2_308535385114_artifact_b531574a-fb82-40ae-b687-8f0b81341ae0_fea59a70-c1ef-41ac-81c3-b8225b4aecf1_00003_00001_00036_00005_TCP_dump_log.txt Saving LOG ListArtifactType.log.json (MESSAGE_LOG) at https://gha-artifacts.s3.amazonaws.com/device_farm/invalid-workflow-id/0/arn_aws_devicefarm_us-west-2_308535385114_artifact_b531574a-fb82-40ae-b687-8f0b81341ae0_fea59a70-c1ef-41ac-81c3-b8225b4aecf1_00003_00001_00036_LOG_ListArtifactType.log.json Teardown Suite PASSED with stats {'total': 1, 'passed': 1, 'failed': 0, 'warned': 0, 'errored': 0, 'stopped': 0, 'skipped': 0} Apple iPhone 14 Pro PASSED Apple iPhone SE (2022) PASSED ```
- Loading branch information