Skip to content

Commit 7aeee64

Browse files
authored
Multi-arch runners for iOS (mobile-dev-inc#2939)
* Multi-arch runners for iOS * Pick sensible defaults for ARCHS, and don't leave it in user control. * Add an intel-specific iOS e2e workflow for testing changes
1 parent 6eef287 commit 7aeee64

File tree

4 files changed

+143
-1
lines changed

4 files changed

+143
-1
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Test E2E on iOS (Intel)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
name: Build on Java ${{ matrix.java-version }}
9+
runs-on: macos-latest
10+
timeout-minutes: 20
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
java-version: [17]
16+
17+
steps:
18+
- name: Clone repository
19+
uses: actions/checkout@v6
20+
21+
- name: Set up Java
22+
uses: actions/setup-java@v5
23+
with:
24+
distribution: zulu
25+
java-version: ${{ matrix.java-version }}
26+
cache: gradle
27+
28+
# Do not rebuild this - let's test the one that is in the repo
29+
#- name: Build xctest-runner
30+
# run: ./maestro-ios-xctest-runner/build-maestro-ios-runner.sh | xcbeautify
31+
32+
- name: Build Maestro CLI
33+
run: ./gradlew :maestro-cli:distZip
34+
35+
- name: Upload zipped Maestro CLI artifact
36+
uses: actions/upload-artifact@v6
37+
with:
38+
name: maestro-cli-jdk${{ matrix.java-version }}-run_id${{ github.run_id }}
39+
path: maestro-cli/build/distributions/maestro.zip
40+
retention-days: 1
41+
42+
- name: Upload build/Products to artifacts
43+
uses: actions/upload-artifact@v6
44+
with:
45+
name: build__Products-jdk${{ matrix.java-version }}
46+
path: build/Products
47+
retention-days: 1
48+
49+
test-ios:
50+
name: Test on iOS
51+
runs-on: macos-15-intel
52+
needs: build
53+
timeout-minutes: 120
54+
55+
env:
56+
MAESTRO_DRIVER_STARTUP_TIMEOUT: 240000 # 240s
57+
MAESTRO_CLI_LOG_PATTERN_CONSOLE: '%d{HH:mm:ss.SSS} [%5level] %logger.%method: %msg%n'
58+
59+
steps:
60+
- name: Clone repository (only needed for the e2e directory)
61+
uses: actions/checkout@v6
62+
63+
- name: Set up JDK
64+
uses: actions/setup-java@v5
65+
with:
66+
distribution: zulu
67+
java-version: 17
68+
69+
- name: Download artifacts
70+
uses: actions/download-artifact@v7
71+
with:
72+
name: maestro-cli-jdk17-run_id${{ github.run_id }}
73+
74+
- name: Add Maestro CLI executable to PATH
75+
run: |
76+
unzip maestro.zip -d maestro_extracted
77+
echo "$PWD/maestro_extracted/maestro/bin" >> $GITHUB_PATH
78+
79+
- name: Check if Maestro CLI executable starts up
80+
run: |
81+
maestro --help
82+
maestro --version
83+
84+
- name: Boot Simulator
85+
run: |
86+
xcrun simctl list runtimes
87+
export RUNTIME="iOS18.5"
88+
export DEVICE_TYPE="iPhone 17 Pro"
89+
./.github/scripts/boot_simulator.sh
90+
91+
- name: Download apps
92+
working-directory: ${{ github.workspace }}/e2e
93+
run: ./download_apps ios
94+
95+
- name: Install apps
96+
working-directory: ${{ github.workspace }}/e2e
97+
run: ./install_apps ios
98+
99+
- name: Start screen recording
100+
run: |
101+
xcrun simctl io booted recordVideo --codec h264 ~/screenrecord.mp4 &
102+
echo $! > ~/screenrecord.pid
103+
104+
- name: Run tests
105+
working-directory: ${{ github.workspace }}/e2e
106+
timeout-minutes: 120
107+
run: ./run_tests ios
108+
109+
- name: Stop screen recording
110+
if: success() || failure()
111+
run: kill -SIGINT "$(cat ~/screenrecord.pid)"
112+
113+
- name: Upload ~/.maestro artifacts
114+
uses: actions/upload-artifact@v6
115+
if: success() || failure()
116+
with:
117+
name: maestro-root-dir-ios
118+
path: ~/.maestro
119+
retention-days: 7
120+
include-hidden-files: true
121+
122+
- name: Upload xctest runner logs
123+
uses: actions/upload-artifact@v6
124+
if: success() || failure()
125+
with:
126+
name: xctest_runner_logs
127+
path: ~/Library/Logs/maestro/xctest_runner_logs
128+
retention-days: 7
129+
include-hidden-files: true
130+
131+
- name: Upload screen recording of Simulator
132+
uses: actions/upload-artifact@v6
133+
if: success() || failure()
134+
with:
135+
name: maestro-screenrecord-ios.mp4
136+
path: ~/screenrecord.mp4
137+
retention-days: 7

maestro-ios-xctest-runner/build-maestro-ios-runner.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ fi
88

99
DERIVED_DATA_PATH="${DERIVED_DATA_DIR:-driver-iPhoneSimulator}"
1010
DESTINATION="${DESTINATION:-generic/platform=iOS Simulator}"
11-
ARCHS="${ARCHS:-arm64}"
1211

1312
# Determine build output directory
1413
if [[ "$DESTINATION" == *"iOS Simulator"* ]]; then
@@ -24,6 +23,12 @@ else
2423
DEVELOPMENT_TEAM_OPT="DEVELOPMENT_TEAM=${DEVELOPMENT_TEAM}"
2524
fi
2625

26+
if [[ "$DESTINATION" == *"iOS Simulator"* ]]; then
27+
ARCHS="$(ARCHS_STANDARD)" # Build for all current standard simulator architectures
28+
else
29+
ARCHS="arm64" # Build only for arm64 on device builds
30+
fi
31+
2732
rm -rf "$PWD/$DERIVED_DATA_PATH"
2833
rm -rf "./maestro-ios-driver/src/main/resources/$DERIVED_DATA_PATH"
2934

0 commit comments

Comments
 (0)