forked from JetBrains/compose-multiplatform-core
-
Notifications
You must be signed in to change notification settings - Fork 0
376 lines (320 loc) · 12.4 KB
/
compose-tests.yml
File metadata and controls
376 lines (320 loc) · 12.4 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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
name: Compose Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- jb-main
env:
# TODO: https://youtrack.jetbrains.com/issue/CMP-9497/Investgate-CfW-tests-flakiness-with-enabled-gradle-configuration-cache-on-CI
# Web Tests require running additional processes: karma in node, browser;
# To reduce the memory pressure, we change some defaults:
GRADLE_WEB_TESTS_FLAGS: >-
--no-daemon --stacktrace --no-parallel --no-configuration-cache
-Dorg.gradle.jvmargs="-Xmx6g -XX:+UseParallelGC"
-Porg.gradle.workers.max=1
jobs:
compose-desktop-tests:
runs-on: ubuntu-24.04
name: Compose Desktop Tests
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Prerequisites
uses: ./.github/actions/setup-prerequisites
- name: Start X Server
run: |
sudo Xvfb :1 -screen 0 1920x1080x24 -extension RANDR +extension GLX &
echo "DISPLAY=:1.0" >> $GITHUB_ENV
- name: Run Desktop Tests
run: |
./gradlew testDesktop \
--no-daemon --stacktrace
- name: Upload Screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshot-tests
path: |
golden/**/*_actual.png
golden/**/*_diff.png
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "out/**/build/test-results/**/TEST-*.xml"
if: always()
compose-ios-tests:
runs-on: macos-15-xlarge
name: Compose iOS Tests
env:
GRADLE_OPTS: -Xmx12g -Dorg.gradle.daemon=false
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Prerequisites
uses: ./.github/actions/setup-prerequisites
- name: Setup Xcode
uses: ./.github/actions/setup-xcode
- name: Run iOS Tests
timeout-minutes: 15
run: |
./gradlew testIos \
--no-daemon --stacktrace
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "out/**/build/test-results/**/TEST-*.xml"
if: always()
compose-ios-utils-tests:
runs-on: macos-15-xlarge
name: Compose iOS Utils Tests
env:
GRADLE_OPTS: -Xmx12g -Dorg.gradle.daemon=false
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Prerequisites
uses: ./.github/actions/setup-prerequisites
- name: Setup Xcode
uses: ./.github/actions/setup-xcode
- name: Run iOS Utils Tests
timeout-minutes: 15
shell: bash
working-directory: compose/ui/ui-uikit/src/iosMain/objc/CMPUIKitUtils
run: |
xcodebuild test \
-resultBundlePath TestResults.xcresult \
-scheme CMPUIKitUtilsTests \
-project CMPUIKitUtils.xcodeproj \
-destination 'platform=iOS Simulator,name=iPhone 16'
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: TestResults-${{ github.run_number }}.xcresult
path: compose/ui/ui-uikit/src/iosMain/objc/CMPUIKitUtils/TestResults.xcresult
compose-ios-instrumented-tests:
runs-on: macos-15-xlarge
strategy:
fail-fast: false
matrix:
device: [ 'iPhone 16', 'iPad Pro 11-inch (M4)' ]
name: Compose iOS Instrumented Tests ${{ matrix.device }}
env:
GRADLE_OPTS: -Xmx12g -Dorg.gradle.daemon=false
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Prerequisites
uses: ./.github/actions/setup-prerequisites
- name: Setup Xcode
uses: ./.github/actions/setup-xcode
- name: Get iOS Simulator UDID
id: get-simulator-udid
shell: bash
run: |
DEVICE_NAME="${{ matrix.device }}"
DEVICE_VERSION="18.6"
DEVICE_DASH="${DEVICE_VERSION//./-}" # 16.0 -> 16-0
echo "Looking for device: '$DEVICE_NAME' ($DEVICE_VERSION)"
SIMULATOR_ID=$(xcrun simctl list devices available -j \
| jq -r --arg device "$DEVICE_NAME" --arg vdot "$DEVICE_VERSION" --arg vdash "$DEVICE_DASH" '
.devices
| to_entries[]
| select(.key | (contains($vdot) or contains($vdash)))
| .value[]
| select(.name == $device)
| .udid
' | head -n 1)
if [ -z "$SIMULATOR_ID" ]; then
echo "Simulator not found for $DEVICE_NAME ($DEVICE_VERSION)"
echo "Available runtimes and matching devices:"
xcrun simctl list devices available -j | jq -r '
.devices | to_entries[] | "\(.key):\n " + ( [.value[] | "\(.name) \(.udid) \(.state)"] | join("\n ") )
'
exit 1
fi
echo "Found simulator ID: $SIMULATOR_ID"
# make available to later steps
echo "simulator-id=$SIMULATOR_ID" >> "$GITHUB_OUTPUT"
- name: Configure Simulator
run: |
xcrun simctl boot "${{ steps.get-simulator-udid.outputs.simulator-id }}"
# Write the accessibility flags inside the Simulator:
xcrun simctl spawn booted defaults write com.apple.Accessibility AccessibilityEnabled -bool true
xcrun simctl spawn booted defaults write com.apple.Accessibility ApplicationAccessibilityEnabled -bool true
xcrun simctl spawn booted defaults write com.apple.Accessibility AutomationEnabled -bool true
# Restart SpringBoard (so system services pick up the change)
xcrun simctl spawn booted launchctl stop com.apple.SpringBoard
xcrun simctl shutdown all
- name: Run iOS Instrumented Tests
timeout-minutes: 30
shell: bash
working-directory: compose/ui/ui/src/uikitInstrumentedTest/launcher
run: |
xcodebuild test \
-resultBundlePath TestResults.xcresult \
-scheme Launcher \
-project Launcher.xcodeproj \
-destination 'platform=iOS Simulator,id=${{ steps.get-simulator-udid.outputs.simulator-id }}'
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: TestResults-${{ github.run_number }}.xcresult
path: compose/ui/ui/src/uikitInstrumentedTest/launcher/TestResults.xcresult
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "**/reports/junit.xml"
if: always()
compose-web-chrome-tests:
runs-on: ubuntu-24.04
name: Compose Web Chrome Tests
strategy:
fail-fast: false
matrix:
chrome: [ '134', 'stable' ]
task: [ 'Js', 'Wasm' ]
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Prerequisites
uses: ./.github/actions/setup-prerequisites
- name: Setup Google Chrome
uses: browser-actions/setup-chrome@v2
id: setup-chrome
with:
chrome-version: ${{ matrix.chrome }}
install-chromedriver: true
install-dependencies: true
# Compile tests as a separate step to reduce memory usage and potential OOM during running tests.
# We want to compile only the tests to be run later, so we extract the test tasks from --dry-run output.
- name: Compile web test executables
run: |
set -euo pipefail
TASKS=$(
./gradlew :mpp:testWeb${{ matrix.task }} -m --console=plain --no-configuration-cache \
--no-daemon -Pkotlin.compiler.execution.strategy=in-process \
| awk '/^:.*compileTestDevelopmentExecutable/ {print $1}' \
| tr '\n' ' '
)
if [ -n "$TASKS" ]; then
./gradlew $TASKS \
--no-daemon --stacktrace --no-parallel --no-configuration-cache \
-Dorg.gradle.jvmargs="-Xmx12g -XX:+UseParallelGC" \
-Porg.gradle.workers.max=1 -Pkotlin.compiler.execution.strategy=in-process
fi
- name: Start X Server
run: |
sudo Xvfb :1 -screen 0 1920x1080x24 -extension RANDR +extension GLX &
echo "DISPLAY=:1.0" >> $GITHUB_ENV
- name: Memory snapshot
run: |
echo "=== free -h ==="
free -h
echo "=== meminfo ==="
head -n 5 /proc/meminfo
- name: Top memory consumers
run: |
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 15
- name: Run Web Chrome Tests
run: |
set -euo pipefail
(while true; do
echo "=== meminfo $(date -u +%H:%M:%S) ==="
head -n 5 /proc/meminfo
sleep 10
done) &
MEM_SAMPLER_PID=$!
trap "kill ${MEM_SAMPLER_PID} || true" EXIT
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns && \
CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }} /usr/bin/time -v ./gradlew :mpp:testWeb${{ matrix.task }} ${{ env.GRADLE_WEB_TESTS_FLAGS }} \
-Pjetbrains.androidx.web.tests.enableFirefox=false \
-Pjetbrains.androidx.web.tests.enableChrome=true
- name: Post-test memory snapshot
if: always()
run: |
echo "=== free -h ==="
free -h
echo "=== meminfo ==="
head -n 5 /proc/meminfo
- name: Post-test top memory consumers
if: always()
run: |
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 15
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "out/**/build/test-results/**/TEST-*.xml"
if: always()
compose-web-firefox-tests:
runs-on: ubuntu-24.04
name: Compose Web Firefox Tests
strategy:
fail-fast: false
matrix:
# FIXME: Even after installation of '119.0', tests still use latest one. Fix and restore.
firefox: [ 'latest' ]
task: [ 'Wasm' ] # excluded Js for Firefox due to high flakiness
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Prerequisites
uses: ./.github/actions/setup-prerequisites
# Compile tests as a separate step to reduce memory usage and potential OOM during running tests.
# We want to compile only the tests to be run later, so we extract the test tasks from --dry-run output.
- name: Compile web test executables
run: |
set -euo pipefail
TASKS=$(
./gradlew :mpp:testWeb${{ matrix.task }} -m --console=plain --no-configuration-cache \
--no-daemon -Pkotlin.compiler.execution.strategy=in-process \
| awk '/^:.*compileTestDevelopmentExecutable/ {print $1}' \
| tr '\n' ' '
)
if [ -n "$TASKS" ]; then
./gradlew $TASKS \
--no-daemon --stacktrace --no-parallel --no-configuration-cache \
-Dorg.gradle.jvmargs="-Xmx12g -XX:+UseParallelGC" \
-Porg.gradle.workers.max=1 -Pkotlin.compiler.execution.strategy=in-process
fi
- name: Setup Missing Packages
run: |
sudo apt-get update -y
sudo apt-get install libdbus-glib-1-2 -y
- name: Setup Firefox
uses: browser-actions/setup-firefox@v1
with:
firefox-version: ${{ matrix.firefox }}
- name: Start X Server
run: |
sudo Xvfb :1 -screen 0 1920x1080x24 -extension RANDR +extension GLX &
echo "DISPLAY=:1.0" >> $GITHUB_ENV
- name: Memory snapshot
run: |
echo "=== free -h ==="
free -h
echo "=== meminfo ==="
head -n 5 /proc/meminfo
- name: Top memory consumers
run: |
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 15
- name: Run Web Firefox Tests
run: |
set -euo pipefail
(while true; do
echo "=== meminfo $(date -u +%H:%M:%S) ==="
head -n 5 /proc/meminfo
sleep 10
done) &
MEM_SAMPLER_PID=$!
trap "kill ${MEM_SAMPLER_PID} || true" EXIT
./gradlew :mpp:testWeb${{ matrix.task }} ${{ env.GRADLE_WEB_TESTS_FLAGS }} \
-Pjetbrains.androidx.web.tests.enableFirefox=true \
-Pjetbrains.androidx.web.tests.enableChrome=false
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "out/**/build/test-results/**/TEST-*.xml"
if: always()