-
Notifications
You must be signed in to change notification settings - Fork 119
260 lines (228 loc) · 8.69 KB
/
e2e-ios-test.yml
File metadata and controls
260 lines (228 loc) · 8.69 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: End-to-End Tests for iOS
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '.github/workflows/e2e-ios-test.yml'
- 'example/**'
- 'packages/react-native-quick-crypto/cpp/**'
- 'packages/react-native-quick-crypto/deps/**'
- 'packages/react-native-quick-crypto/nitrogen/**'
- 'packages/react-native-quick-crypto/src/**'
- 'packages/react-native-quick-crypto/ios/**'
push:
branches: [main]
paths:
- 'example/**'
- 'packages/react-native-quick-crypto/cpp/**'
- 'packages/react-native-quick-crypto/deps/**'
- 'packages/react-native-quick-crypto/nitrogen/**'
- 'packages/react-native-quick-crypto/src/**'
- 'packages/react-native-quick-crypto/ios/**'
env:
# Opt actions still on Node 20 (upload-artifact, McCzarny/upload-image, peter-evans/*, etc.)
# into the runner's Node 24 instead. Silences deprecation warnings until each action ships a v5.
# https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
# Minimum scopes — post-maestro-screenshot composite action posts a PR comment with
# the upload-image artifact link.
permissions:
contents: read
pull-requests: write
jobs:
e2e-tests-ios:
runs-on: macOS-26
env:
OUTPUT_DIR: ~/output
USE_CCACHE: '1'
DEVICE_NAME: 'iPhone 17 Pro'
DERIVED_DATA_PATH: example/ios/build
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Select Xcode 26.2
run: |
sudo xcode-select -s "/Applications/Xcode_26.2.app/Contents/Developer"
xcodebuild -version
- name: Install xcbeautify
run: brew install xcbeautify
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
max-size: 1.5G
key: ${{ runner.os }}-ccache-ios-e2e
create-symlink: true
- name: Configure ccache
run: |
echo "CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros" >> $GITHUB_ENV
echo "CCACHE_FILECLONE=true" >> $GITHUB_ENV
echo "CCACHE_DEPEND=true" >> $GITHUB_ENV
echo "CCACHE_INODECACHE=true" >> $GITHUB_ENV
- name: Install Bun
uses: ./.github/actions/setup-bun
- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.4
bundler-cache: true
working-directory: example
- name: Create Directories
run: |
mkdir -p $HOME/output
mkdir -p $HOME/.maestro/tests/
- name: Install Dependencies
run: bun install
- name: Restore CocoaPods cache
id: pods-cache
uses: actions/cache@v5
with:
path: |
example/ios/Pods
~/.cocoapods/repos
~/Library/Caches/CocoaPods
packages/react-native-quick-crypto/ios/libsodium-stable
packages/react-native-quick-crypto/deps
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock', 'example/Gemfile.lock') }}
- name: Restore DerivedData cache
id: dd-cache
uses: actions/cache@v5
with:
path: ${{ env.DERIVED_DATA_PATH }}
key: ${{ runner.os }}-dd-${{ hashFiles('example/ios/Podfile.lock', 'example/Gemfile.lock', 'bun.lock') }}-xcode26.2
restore-keys: |
${{ runner.os }}-dd-
- name: Boot iOS Simulator (background)
run: |
xcrun simctl boot "${{ env.DEVICE_NAME }}" &
- name: Install CocoaPods
working-directory: ./example
run: RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install --project-directory=ios
- name: Build iOS App
working-directory: ./example
run: |
set -o pipefail
xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath ios/build \
-UseModernBuildSystem=YES \
-workspace ios/QuickCryptoExample.xcworkspace \
-scheme QuickCryptoExample \
-sdk iphonesimulator \
-configuration Debug \
-destination "platform=iOS Simulator,name=${{ env.DEVICE_NAME }}" \
-showBuildTimingSummary \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_ALLOWED=NO \
build 2>&1 | tee $HOME/output/ios-build.log | xcbeautify --renderer github-actions
- name: Show Build Timing Summary
if: always()
run: |
if [ -f "$HOME/output/ios-build.log" ]; then
sed -n '/Build Timing Summary/,/^\*\* BUILD/p' "$HOME/output/ios-build.log"
fi
- name: Show ccache stats
if: always()
run: ccache --show-stats
- name: Wait for Simulator
run: xcrun simctl bootstatus "${{ env.DEVICE_NAME }}" -b
- name: Install App to Simulator
working-directory: ./example
run: |
APP_PATH="ios/build/Build/Products/Debug-iphonesimulator/QuickCryptoExample.app"
if [ ! -d "$APP_PATH" ]; then
echo "Error: App not found at $APP_PATH"
exit 1
fi
echo "Installing app from $APP_PATH..."
xcrun simctl install booted "$APP_PATH"
- name: Install Maestro CLI
run: |
export MAESTRO_VERSION=2.0.10
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Start Metro Bundler
working-directory: ./example
run: |
echo "Starting Metro Bundler..."
bun start > $HOME/output/metro.log 2>&1 &
echo "Waiting for Metro to be ready..."
for i in {1..60}; do
if curl -sf http://localhost:8081/status > /dev/null 2>&1; then
echo "Metro server is ready!"
break
fi
if [ $i -eq 60 ]; then
echo "Metro failed to start after 60 seconds"
cat $HOME/output/metro.log
exit 1
fi
sleep 1
done
echo "Waiting for bundle to be ready..."
for i in {1..120}; do
if curl -sf "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false" > /dev/null 2>&1; then
echo "Bundle is ready!"
break
fi
if [ $i -eq 120 ]; then
echo "Warning: Bundle may not be ready, continuing anyway..."
fi
sleep 1
done
- name: Launch App
run: |
echo "Launching app..."
xcrun simctl launch booted "com.margelo.quickcrypto.example"
echo "Waiting for app to initialize..."
sleep 5
- name: Run Maestro E2E Tests
id: test_ios
working-directory: ./example
run: |
export PATH="$PATH:$HOME/.maestro/bin"
export MAESTRO_DRIVER_STARTUP_TIMEOUT=300000
export MAESTRO_CLI_NO_ANALYTICS=1
export MAESTRO_CLI_ANALYSIS_NOTIFICATION_DISABLED=true
echo "Running End-to-End tests on iOS..."
maestro test \
test/e2e/test-suites-flow.yml \
--config .maestro/config.yml \
--env PLATFORM=ios \
--test-output-dir $HOME/output
- name: Collect Screenshots
if: always()
run: |
mkdir -p $HOME/output/screenshots
LATEST_SCREENSHOT=$(find $HOME/output -name "screenshot-*.png" -type f 2>/dev/null | sort -r | head -1)
if [ -n "$LATEST_SCREENSHOT" ]; then
echo "Copying screenshot from $LATEST_SCREENSHOT to screenshots/ios-test-result.png"
cp "$LATEST_SCREENSHOT" $HOME/output/screenshots/ios-test-result.png
else
echo "No screenshot found to copy"
fi
- name: Post Maestro Screenshot to PR
if: always()
uses: ./.github/actions/post-maestro-screenshot
with:
platform: ios
github-token: ${{ secrets.GITHUB_TOKEN }}
test-outcome: ${{ steps.test_ios.outcome }}
imgbb-api-key: ${{ secrets.IMGBB_API_KEY }}
- name: Upload Test Output
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-ios-test-output
path: |
${{ env.OUTPUT_DIR }}/*.log
${{ env.OUTPUT_DIR }}/screenshots/*.png
retention-days: 5
- name: Exit with Test Result
if: always()
run: |
if [ "${{ steps.test_ios.outcome }}" != "success" ]; then
exit 1
fi