Repository navigation
204 lines (176 loc) · 7.8 KB
/
Copy pathe2e-ios.yml
File metadata and controls
204 lines (176 loc) · 7.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: E2E Tests on iOS
on:
workflow_call:
inputs:
shard:
required: true
type: string
device-profile:
required: true
type: string
secrets:
E2E_ACCOUNT:
required: true
CLAUDE_CODE_OAUTH_TOKEN:
required: true
permissions: {}
jobs:
ios-test:
runs-on: macos-26
permissions:
contents: read
timeout-minutes: 125
env:
E2E_TELEMETRY_DISABLED: '1'
E2E_STEP_TIMEOUT_MINUTES: '100'
RUN_TIMEOUT_SECONDS: '4800'
steps:
- name: Checkout Repo
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Xcode (same version e2e-build-ios.yml builds with)
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
with:
xcode-version: '26.6'
- name: Configure Simulator
run: |
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false
defaults write com.apple.iphonesimulator SlowAnimations -bool false
defaults write com.apple.iphonesimulator ShowDeviceBezels -bool false
defaults write com.apple.iphonesimulator DisableShadows -bool true
defaults write com.apple.iphonesimulator AllowFullscreenMode -bool false
defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false
defaults write com.apple.iphonesimulator ShowChrome -bool false
defaults write com.apple.iphonesimulator DeviceFramebufferOnly -bool true
- name: Resolve Simulator
env:
DEVICE_PROFILE: ${{ inputs.device-profile }}
run: |
DEVICES_JSON=$(xcrun simctl list devices available --json)
if [[ "$DEVICE_PROFILE" == "small" ]]; then
SIM_NAME=$(jq -r '[.devices | to_entries[] | .value[] | select(.name | test("^iPhone SE"))] | first | .name' <<< "$DEVICES_JSON")
if [[ -z "$SIM_NAME" || "$SIM_NAME" == "null" ]]; then
SIM_NAME=$(jq -r '[.devices | to_entries[] | .value[] | select(.name | test("^iPhone [0-9]+( mini)?$"))] | sort_by(.name | capture("(?<n>[0-9]+)").n | tonumber) | first | .name' <<< "$DEVICES_JSON")
fi
SIM_CRITERION="smallest iPhone (small-screen shard)"
elif [[ "$DEVICE_PROFILE" == "large" ]]; then
SIM_NAME=$(jq -r '[.devices | to_entries[] | .value[] | select(.name | test("^iPhone [0-9]+ Pro$"))] | sort_by(.name | capture("(?<n>[0-9]+)").n | tonumber) | last | .name' <<< "$DEVICES_JSON")
SIM_CRITERION="largest iPhone N Pro"
else
echo "::error::Unknown device profile: $DEVICE_PROFILE"
exit 1
fi
if [[ -z "$SIM_NAME" || "$SIM_NAME" == "null" ]]; then
echo "::error::No simulator matched criterion: ${SIM_CRITERION}"
xcrun simctl list devices available
exit 1
fi
SIM_UDID=$(jq -r --arg name "$SIM_NAME" '[.devices | to_entries[] | .value[] | select(.name == $name)] | first | .udid' <<< "$DEVICES_JSON")
echo "Resolved simulator: $SIM_NAME ($SIM_UDID)"
echo "SIM_UDID=$SIM_UDID" >> "$GITHUB_ENV"
echo "E2E_IOS_DEVICE=$SIM_UDID" >> "$GITHUB_ENV"
- name: Boot Simulator
id: simulator-boot
background: true
timeout-minutes: 15
run: |
echo "Booting simulator: $SIM_UDID"
xcrun simctl boot "$SIM_UDID" || true
xcrun simctl bootstatus "$SIM_UDID" -b
echo "Disabling animations"
xcrun simctl spawn "$SIM_UDID" defaults write -g UIAnimationDragCoefficient -float 0.0001
echo "Booted devices:"
xcrun simctl list devices | grep Booted
- parallel:
- name: Setup Node
uses: ./.github/actions/setup-node
with:
node-version: '22'
- name: Download App
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ios-simulator-app
path: ios-simulator-app/Rocket.Chat.app
- name: Setup E2E Account
uses: ./.github/actions/e2e-account
with:
E2E_ACCOUNT: ${{ secrets.E2E_ACCOUNT }}
- name: Restore agent-device runner (rebuilt on a mismatch)
id: agent-device-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.agent-device/apple-runner
~/.agent-device/ios-runner
key: agent-device-runner-${{ runner.os }}-xcode-26.6-${{ hashFiles('node_modules/agent-device/package.json', 'patches/agent-device+*.patch') }}
restore-keys: |
agent-device-runner-${{ runner.os }}-xcode-26.6-
- name: Wait for Simulator Boot
wait: simulator-boot
- name: Warm Up Simulator
timeout-minutes: 10
env:
E2E_IOS_APP_PATH: ${{ github.workspace }}/ios-simulator-app/Rocket.Chat.app
run: bash .github/scripts/warm-up-ios-simulator.sh "$SIM_UDID" "$E2E_IOS_APP_PATH"
- name: Set E2E deadline before the test step timeout
run: echo "E2E_DEADLINE=$(( $(date +%s) + (E2E_STEP_TIMEOUT_MINUTES - 7) * 60 ))" >> "$GITHUB_ENV"
- name: Run E2E Tests
timeout-minutes: ${{ fromJSON(env.E2E_STEP_TIMEOUT_MINUTES) }}
env:
E2E_IOS_APP_PATH: ${{ github.workspace }}/ios-simulator-app/Rocket.Chat.app
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
SHARD: ${{ inputs.shard }}
run: bash .github/scripts/run-e2e.sh ios "$SHARD"
- name: Save agent-device runner
if: ${{ always() && steps.agent-device-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.agent-device/apple-runner
~/.agent-device/ios-runner
key: agent-device-runner-${{ runner.os }}-xcode-26.6-${{ hashFiles('node_modules/agent-device/package.json', 'patches/agent-device+*.patch') }}
- name: Redact E2E Report
id: redact
if: always()
env:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
run: bash .github/scripts/redact-e2e-output.sh
- name: Collect Recorded Agent Replays
id: replays
if: always()
env:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
run: bash .github/scripts/collect-e2e-replays.sh .e2e/replays
- name: Upload Recorded Agent Replays
if: always() && steps.replays.outputs.count != '' && steps.replays.outputs.count != '0'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: e2e-replays-ios-${{ inputs.shard }}
path: .e2e/replays
retention-days: 14
overwrite: true
- name: Upload E2E Report
id: upload-report
if: always() && steps.redact.outcome == 'success'
continue-on-error: true
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: iOS E2E Report - Shard ${{ inputs.shard }}
path: |
.e2e/report.json
.e2e/junit.xml
.e2e/artifacts
retention-days: 7
- name: Wait Before Retrying the E2E Report Upload
if: always() && steps.upload-report.outcome == 'failure'
run: sleep 30
- name: Retry Upload E2E Report
if: always() && steps.upload-report.outcome == 'failure'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: iOS E2E Report - Shard ${{ inputs.shard }}
path: |
.e2e/report.json
.e2e/junit.xml
.e2e/artifacts
retention-days: 7
overwrite: true