-
Notifications
You must be signed in to change notification settings - Fork 6
162 lines (136 loc) · 5.11 KB
/
e2e-mobile-ios.yml
File metadata and controls
162 lines (136 loc) · 5.11 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
name: E2E Mobile (iOS)
on:
schedule:
- cron: '30 6 * * *' # 06:30 UTC nightly (staggered after the Android run)
workflow_dispatch:
permissions:
contents: read
concurrency:
group: e2e-mobile-ios-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '22'
jobs:
ios-e2e:
runs-on: macos-15
name: iOS E2E (simulator)
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain (iOS simulator)
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-ios-sim
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
shared-key: e2e-ios
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
# No `version:` — action-setup reads packageManager from package.json.
uses: pnpm/action-setup@v4
- name: Install root dependencies
run: pnpm install --frozen-lockfile
- name: Install e2e-mobile dependencies
working-directory: e2e-mobile
run: pnpm install --frozen-lockfile
- name: Select latest Xcode
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- name: Install CocoaPods
run: |
if ! command -v pod &>/dev/null; then
brew install cocoapods
fi
pod --version
- name: Install Appium 2 + XCUITest driver
# Pin xcuitest to 9.10.5 — the last release whose appium peerDep
# accepts Appium 2.x (^2.5.4). Versions >=10.0.0 require Appium
# ^3.0.0-rc.2, which is still RC, so `appium driver install xcuitest`
# (latest) aborts with "server version it requires (^3.0.0-rc.2) does
# not meet the currently installed one". Bump both together when
# Appium 3 ships stable. Mirrors the uiautomator2@4.2.9 pin in
# e2e-mobile-android.yml.
run: |
npm install -g appium@^2
appium driver install xcuitest@9.10.5
- name: Initialize iOS project
env:
# CI=true disables interactive prompts; simulator builds need no team.
CI: 'true'
run: pnpm tauri ios init
- name: Build iOS app (debug, simulator)
run: pnpm tauri ios build --debug --target aarch64-sim
- name: Boot an iOS simulator
id: sim
run: |
set -eu
# Pick the newest available iPhone simulator on the runner.
UDID="$(xcrun simctl list devices available --json | python3 -c "import json,sys; ds=json.load(sys.stdin)['devices']; print(next((d['udid'] for rt in ds for d in ds[rt] if 'iPhone' in d['name']), ''))")"
if [ -z "$UDID" ]; then
echo "::error::No iPhone simulator available on this runner"; exit 1
fi
echo "Booting simulator $UDID"
xcrun simctl boot "$UDID" || true
xcrun simctl bootstatus "$UDID" -b
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
- name: Run E2E against the simulator
id: ios-test
continue-on-error: true
env:
E2E_PLATFORM: ios
IOS_UDID: ${{ steps.sim.outputs.udid }}
run: |
# dash-safe (sh): NO `set -o pipefail`.
set -eu
APP_PATH="$(find src-tauri/gen/apple/build -name '*.app' -type d | head -n1)"
if [ -z "$APP_PATH" ]; then
echo "::error::No .app found under src-tauri/gen/apple/build"; exit 1
fi
export IOS_APP_PATH="$(cd "$APP_PATH" && pwd)"
echo "Using app: $IOS_APP_PATH"
appium --port 4723 > appium.log 2>&1 &
APPIUM_PID=$!
trap 'kill $APPIUM_PID 2>/dev/null || true' EXIT
# Wait for Appium to be ready (max 30s).
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:4723/status > /dev/null; then break; fi
sleep 1
done
cd e2e-mobile
pnpm test
- name: Upload Appium log
if: always()
uses: actions/upload-artifact@v4
with:
name: ios-appium-log
path: appium.log
if-no-files-found: ignore
retention-days: 7
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: ios-e2e-reports
path: e2e-mobile/reports/
if-no-files-found: warn
retention-days: 7
- name: Upload failure screenshots
if: ${{ steps.ios-test.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: ios-e2e-screenshots
path: e2e-mobile/screenshots/
if-no-files-found: ignore
retention-days: 7
# The test step uses continue-on-error so the artifact-upload steps above
# always run on failure. This gate restores a red job when the run fails.
- name: Fail job if E2E failed
if: ${{ steps.ios-test.outcome == 'failure' }}
run: |
echo "::error::iOS E2E failed — see the Appium log, reports, and screenshot artifacts."
exit 1