-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (117 loc) · 3.96 KB
/
ios.yml
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
name: iOS E2E Tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
timeout-minutes: 45
runs-on: macos-14
strategy:
fail-fast: false
matrix:
include:
- device: "iPhone-15"
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-17-0"
- device: "iPad-Pro-12-9-inch-6th-generation-8GB"
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-17-2"
- device: "iPhone-SE-3rd-generation"
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-17-4"
- device: "iPhone-16-Pro"
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-18-1"
- device: "iPad-Pro-11-inch-M4-8GB"
runtime: "com.apple.CoreSimulator.SimRuntime.iOS-18-1"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Log runner info
run: npx envinfo
- name: List available simulators
run: |
xcrun simctl list runtimes
xcrun simctl list devicetypes
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: |
npm install -g yarn
yarn install
- name: Run iOS Simulator
run: |
echo "Creating and booting simulator"
DEVICE_ID=$(xcrun simctl create "$XC_SIMULATOR_NAME" \
"com.apple.CoreSimulator.SimDeviceType.$XC_DEVICE_TYPE" \
"$XC_RUNTIME")
xcrun simctl boot "$DEVICE_ID"
env:
XC_SIMULATOR_NAME: "Test Device ${{ matrix.device }}"
XC_DEVICE_TYPE: ${{ matrix.device }}
XC_RUNTIME: ${{ matrix.runtime }}
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Build iOS App
run: |
yarn generate-test-data
yarn expo prebuild --platform ios
cd ios
pod install
xcodebuild -workspace pinpadclientmaplibre.xcworkspace \
-scheme pinpadclientmaplibre \
-sdk iphonesimulator \
-arch arm64 \
-configuration Debug \
-derivedDataPath build \
-quiet \
COMPILER_INDEX_STORE_ENABLE=NO
- name: Start Metro Bundler
run: |
yarn start &
echo "Waiting for Metro bundler to start..."
sleep 30
- name: Install .app
run: xcrun simctl install booted ios/build/Build/Products/Debug-iphonesimulator/pinpadclientmaplibre.app
- name: Run Maestro E2E tests
run: |
max_attempts=4
attempt=1
until maestro test .maestro/ || [ $attempt -ge $max_attempts ]; do
echo "Attempt $attempt failed. Retrying..."
attempt=$((attempt + 1))
echo "Current simulator state:"
maestro hierarchy
sleep 5
done
if [ $attempt -ge $max_attempts ]; then
echo "All $max_attempts attempts failed"
exit 1
fi
env:
MAESTRO_DRIVER_STARTUP_TIMEOUT: 200000
MAESTRO_THROTTLE_CPU: true
- name: Capture simulator screenshot on failure
if: failure()
run: |
maestro hierarchy
xcrun simctl io booted screenshot "failed-test-screenshot.png"
- name: Upload Maestro artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: maestro-artifacts-${{ matrix.device }}-ios${{ matrix.runtime }}
path: |
~/Library/Logs/maestro/
~/.maestro/tests/
~/.maestro/screenshots/
failed-test-screenshot.png