-
Notifications
You must be signed in to change notification settings - Fork 6
165 lines (142 loc) Β· 5.19 KB
/
Copy pathnoah-maestro-test-ios.yml
File metadata and controls
165 lines (142 loc) Β· 5.19 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
name: Maestro Test iOS
env:
# Self-hosted runners persist /nix/store; avoid stale Magic Nix Cache hooks/proxies.
NIX_CONFIG: |
post-build-hook =
extra-substituters =
substituters = https://cache.nixos.org/
on:
pull_request:
paths:
- "client/**"
- "scripts/**"
- "package.json"
- "bun.lock"
- ".github/workflows/**"
- "!**/*.md"
jobs:
build-release-ios:
name: Build iOS Release App
uses: ./.github/workflows/noah-build-release-ios.yml
secrets: inherit
maestro-test-ios:
name: Maestro Test iOS
needs: build-release-ios
runs-on: macOS
timeout-minutes: 15
permissions:
checks: read
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: π Checkout repository
uses: actions/checkout@v6
- name: π₯ Download iOS app artifact
uses: actions/download-artifact@v8
with:
name: ${{ needs.build-release-ios.outputs.artifact_name }}
path: ios-release-build
- name: ποΈ Decompress iOS app
run: |
cd ios-release-build
unzip ios-release.zip
rm ios-release.zip
- name: π§ Setup Regtest Environment
run: cd scripts && docker-compose pull && docker-compose build && ./ark-dev.sh setup-everything
- name: π± Boot iOS Simulator (iPhone 17 Pro)
run: |
DEVICE_ID=$(xcrun simctl list devices available | grep "iPhone 17 Pro" | head -n 1 | awk -F "[()]" '{print $2}')
if [ -z "$DEVICE_ID" ]; then
echo "No available simulator found for the criteria."
exit 1
fi
echo "Found simulator with DEVICE_ID=$DEVICE_ID"
# Check if simulator is already booted
STATUS=$(xcrun simctl list | grep "$DEVICE_ID" | grep "(Booted)" || echo "")
if [[ -n "$STATUS" ]]; then
echo "Simulator is already booted. Shutting down first..."
xcrun simctl shutdown "$DEVICE_ID" || true
sleep 2
fi
echo "Booting iPhone 17 Pro simulator with DEVICE_ID=$DEVICE_ID..."
xcrun simctl boot "$DEVICE_ID"
TIMEOUT=120
START_TIME=$(date +%s)
echo "Waiting for simulator to boot..."
while true; do
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
if [ $ELAPSED_TIME -ge $TIMEOUT ]; then
echo "Timeout: simulator failed to boot for $TIMEOUT seconds."
exit 1
fi
STATUS=$(xcrun simctl list | grep "$DEVICE_ID" | grep "(Booted)")
if [[ -n "$STATUS" ]]; then
echo "Simulator is booted!"
break
else
echo "Still waiting for the simulator to boot..."
sleep 5
fi
done
- name: π§ͺ Run Maestro tests
run: nix develop .# --command bash -c "xcrun simctl install booted ios-release-build/ios-release.app && bun client maestro:test"
env:
MAESTRO_DRIVER_STARTUP_TIMEOUT: 120000
- name: π§Ή Shutdown and erase simulator
if: always()
run: |
echo "Getting booted simulator UDID..."
DEVICE_UDID=$(xcrun simctl list devices | grep "(Booted)" | awk -F '[()]' '{print $2}' | head -n 1)
if [ -n "$DEVICE_UDID" ]; then
echo "Shutting down simulator: $DEVICE_UDID"
if xcrun simctl shutdown "$DEVICE_UDID" 2>&1; then
echo "β Shutdown command executed"
else
echo "β Warning: Shutdown command failed"
fi
# Verify shutdown
sleep 2
SHUTDOWN_STATUS=$(xcrun simctl list devices | grep "$DEVICE_UDID" | grep "(Shutdown)" || echo "")
if [[ -n "$SHUTDOWN_STATUS" ]]; then
echo "β Simulator is now in Shutdown state"
else
echo "β Warning: Simulator may not be in Shutdown state"
fi
echo "Erasing simulator to clear all app data: $DEVICE_UDID"
if xcrun simctl erase "$DEVICE_UDID" 2>&1; then
echo "β Erase command executed successfully"
else
echo "β Warning: Erase command failed"
fi
else
echo "No booted simulator found"
fi
- name: π§Ή Teardown Regtest Environment
if: always()
run: ./scripts/ark-dev.sh down
- name: π€ Store debug output if failed
if: failure()
uses: actions/upload-artifact@v7
with:
name: maestro-debug-output-ios
path: client/maestro-debug-output/**/*
include-hidden-files: true
overwrite: true
maestro_test_gate:
name: Maestro Test iOS Gate
runs-on: ubuntu-latest
needs: maestro-test-ios
if: always()
steps:
- name: β
Gate
run: |
if [[ "${{ needs.maestro-test-ios.result }}" == "success" || "${{ needs.maestro-test-ios.result }}" == "skipped" ]]; then
echo "Maestro tests passed or skipped"
exit 0
else
echo "Maestro tests failed"
exit 1
fi