Skip to content

Commit 35e2302

Browse files
authored
Add a workflow to validate and upload iOS demo app test spec
Differential Revision: D61882788 Pull Request resolved: #4937
1 parent ff46dd5 commit 35e2302

File tree

4 files changed

+135
-4
lines changed

4 files changed

+135
-4
lines changed

.github/workflows/apple.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ on:
1919
- extension/apple/**
2020
- extension/module/**
2121
workflow_dispatch:
22+
# TODO (huydhn): This is used to validate the test spec. Eventually, we need a proper
23+
# perf benchmark workflow like android-perf. This can be cleaned up once that workflow
24+
# is ready
25+
workflow_call:
26+
inputs:
27+
test_spec:
28+
description: The test spec to drive the test on AWS devices
29+
required: false
30+
type: string
2231

2332
concurrency:
2433
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
@@ -107,7 +116,7 @@ jobs:
107116
# Uploaded to S3 from the previous job
108117
ios-ipa-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/ExecuTorchDemo.ipa
109118
ios-xctestrun-zip: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/ExecuTorchDemo.xctestrun.zip
110-
test-spec: https://ossci-ios.s3.amazonaws.com/executorch/default-ios-device-farm-appium-test-spec.yml
119+
test-spec: ${{ inputs.test_spec || 'https://ossci-ios.s3.amazonaws.com/executorch/default-ios-device-farm-appium-test-spec.yml' }}
111120

112121
build-frameworks-ios:
113122
name: build-frameworks-ios

.github/workflows/upload-test-specs.yml renamed to .github/workflows/upload-android-test-specs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: Upload AWS Device Farm test specs
1+
name: Upload AWS Device Farm Android test specs
22

33
on:
44
pull_request:
55
paths:
6-
- .github/workflows/upload-test-specs.yml
6+
- .github/workflows/upload-android-test-specs.yml
77
- examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
88
push:
99
branches:
1010
- main
1111
paths:
12-
- .github/workflows/upload-test-specs.yml
12+
- .github/workflows/upload-android-test-specs.yml
1313
- examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml
1414

1515
concurrency:
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Upload AWS Device Farm Apple iOS test specs
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/upload-apple-test-specs.yml
7+
- examples/demo-apps/apple_ios/default-ios-device-farm-appium-test-spec.yml
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- .github/workflows/upload-apple-test-specs.yml
13+
- examples/demo-apps/apple_ios/default-ios-device-farm-appium-test-spec.yml
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
upload-apple-test-spec-for-validation:
21+
runs-on: linux.2xlarge
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Upload the spec as a GitHub artifact for validation
26+
uses: seemethere/upload-artifact-s3@v5
27+
with:
28+
s3-bucket: gha-artifacts
29+
s3-prefix: |
30+
${{ github.repository }}/${{ github.run_id }}/artifact
31+
retention-days: 1
32+
if-no-files-found: error
33+
path: examples/demo-apps/apple_ios/default-ios-device-farm-appium-test-spec.yml
34+
35+
# TODO (huydhn): An example on how to validate the test spec using the iOS demo app, but we need a proper
36+
# perf benchmark workflow like android-perf
37+
validate-apple-test-spec:
38+
needs: upload-apple-test-spec-for-validation
39+
uses: ./.github/workflows/apple.yml
40+
secrets: inherit
41+
permissions:
42+
id-token: write
43+
contents: read
44+
with:
45+
test_spec: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/default-ios-device-farm-appium-test-spec.yml
46+
47+
upload-apple-test-spec:
48+
needs: validate-apple-test-spec
49+
runs-on: ubuntu-22.04
50+
timeout-minutes: 15
51+
permissions:
52+
id-token: write
53+
contents: read
54+
steps:
55+
- uses: actions/checkout@v3
56+
57+
- uses: actions/setup-python@v4
58+
with:
59+
python-version: '3.11'
60+
cache: pip
61+
62+
- name: configure aws credentials
63+
uses: aws-actions/[email protected]
64+
with:
65+
role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-ios
66+
aws-region: us-east-1
67+
68+
- name: Only push to S3 when running the workflow manually from main branch
69+
if: ${{ github.ref == 'refs/heads/main' }}
70+
shell: bash
71+
run: |
72+
set -eux
73+
echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
74+
75+
- name: Upload the spec to S3 ossci-ios bucket
76+
shell: bash
77+
working-directory: examples/demo-apps/apple_ios
78+
env:
79+
SPEC_FILE: default-ios-device-farm-appium-test-spec.yml
80+
run: |
81+
set -eux
82+
83+
pip install awscli==1.32.18
84+
85+
AWS_CMD="aws s3 cp --dryrun"
86+
if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
87+
AWS_CMD="aws s3 cp"
88+
fi
89+
90+
shasum -a 256 "${SPEC_FILE}"
91+
${AWS_CMD} "${SPEC_FILE}" s3://ossci-ios/executorch/ --acl public-read
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 0.1
2+
3+
# Phases are collection of commands that get executed on Device Farm.
4+
phases:
5+
# The install phase includes commands that install dependencies that your tests use.
6+
# Default dependencies for testing frameworks supported on Device Farm are already installed.
7+
install:
8+
commands:
9+
10+
# The pre-test phase includes commands that setup your test environment.
11+
pre_test:
12+
commands:
13+
- mkdir $DEVICEFARM_TEST_PACKAGE_PATH/Debug-iphoneos
14+
- unzip $DEVICEFARM_APP_PATH -d /tmp
15+
- mv /tmp/Payload/*.app $DEVICEFARM_TEST_PACKAGE_PATH/Debug-iphoneos/
16+
17+
# The test phase includes commands that run your test suite execution.
18+
test:
19+
commands:
20+
- xcodebuild test-without-building -destination id=$DEVICEFARM_DEVICE_UDID -xctestrun $DEVICEFARM_TEST_PACKAGE_PATH/*.xctestrun -derivedDataPath $DEVICEFARM_LOG_DIR
21+
22+
# The post test phase includes are commands that are run after your tests are executed.
23+
post_test:
24+
commands:
25+
26+
# The artifacts phase lets you specify the location where your tests logs, device logs will be stored.
27+
# And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm.
28+
# These logs and artifacts will be available through ListArtifacts API in Device Farm.
29+
artifacts:
30+
# By default, Device Farm will collect your artifacts from following directories
31+
- $DEVICEFARM_LOG_DIR

0 commit comments

Comments
 (0)