-
Notifications
You must be signed in to change notification settings - Fork 4
327 lines (293 loc) · 10.1 KB
/
workflow-mobile.yml
File metadata and controls
327 lines (293 loc) · 10.1 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
name: Workflow - Tests on Mobile
on:
workflow_call:
inputs:
repository:
required: true
type: string
default: "bevyengine/bevy"
gitref:
required: true
type: string
default: "main"
branch:
required: true
type: string
workflow_dispatch:
inputs:
repository:
required: true
type: string
default: "bevyengine/bevy"
description: "Bevy repository to use"
gitref:
required: true
type: string
default: "main"
description: "Commit or branch name to run on"
branch:
required: true
type: string
description: "Branch name to use as a tag in Pixel Eagle"
jobs:
create-pixel-eagle-run:
runs-on: ubuntu-latest
outputs:
pixeleagle_run: ${{ steps.run.outputs.pixeleagle_run }}
steps:
- name: Install Pixel Eagle CLI
uses: vleue/PixelEagle-cli/install@1eeb51dcd4531350912a1d4542eb687589d212e2 # v0.2.1
- name: Create Run
id: run
run: |
run=`pixeleagle-cli new-run --metadata '{"os":"mobile", "gitref": "${{ inputs.gitref }}", "branch": "${{ inputs.branch }}"}'`
echo "pixeleagle_run=$run" >> $GITHUB_OUTPUT
env:
PIXEL_EAGLE_TOKEN: ${{ secrets.PIXELEAGLE }}
build-for-iOS:
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.gitref }}
- name: Checkout patches
uses: actions/checkout@v6
with:
path: "runner-patches"
- name: Apply patches
shell: pwsh
run: |
Get-ChildItem "runner-patches/patches" -Filter *.patch |
Foreach-Object {
Write-Output "Processing $($_.FullName)"
git apply --ignore-whitespace $($_.FullName)
}
- uses: dtolnay/rust-toolchain@stable
- name: Add iOS targets
run: rustup target add aarch64-apple-ios x86_64-apple-ios
- name: Build app for iOS
run: |
cd examples/mobile
make xcodebuild-iphone
mkdir Payload
mv build/Build/Products/Debug-iphoneos/bevy_mobile_example.app Payload
zip -r bevy_mobile_example.zip Payload
mv bevy_mobile_example.zip bevy_mobile_example.ipa
- name: Upload to Browser Stack
run: |
curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@examples/mobile/bevy_mobile_example.ipa" \
-F "custom_id=$GITHUB_RUN_ID"
- uses: actions/upload-artifact@v5
with:
name: app.ipa
path: examples/mobile/bevy_mobile_example.ipa
retention-days: 2
build-for-Android:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.gitref }}
- name: Checkout patches
uses: actions/checkout@v6
with:
path: "runner-patches"
- name: Apply patches
shell: pwsh
run: |
Get-ChildItem "runner-patches/patches" -Filter *.patch |
Foreach-Object {
Write-Output "Processing $($_.FullName)"
git apply --ignore-whitespace $($_.FullName)
}
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu,aarch64-linux-android,armv7-linux-androideabi
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: "17"
distribution: "temurin"
- name: Install Cargo NDK
run: cargo install --force cargo-ndk
- name: Build .so file
run: cargo ndk -t arm64-v8a -P 26 -o examples/mobile/android_example/app/src/main/jniLibs build --package bevy_mobile_example --release
- name: Build app for Android
run: cd examples/mobile/android_example && chmod +x gradlew && ./gradlew build
- name: Upload to Browser Stack
run: |
curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@examples/mobile/android_example/app/build/outputs/apk/debug/app-debug.apk" \
-F "custom_id=$GITHUB_RUN_ID"
- uses: actions/upload-artifact@v5
with:
name: app.apk
path: examples/mobile/android_example/app/build/outputs/apk/debug/app-debug.apk
retention-days: 2
take-screenshots:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [build-for-iOS, build-for-Android, create-pixel-eagle-run]
strategy:
fail-fast: false
max-parallel: 7
matrix:
include:
- os: "iOS"
device: "iPhone 13"
os_version: "15"
adapter: ""
- os: "iOS"
device: "iPhone 14"
os_version: "16"
adapter: ""
- os: "iOS"
device: "iPhone 15"
os_version: "17"
adapter: ""
- os: "iOS"
device: "iPhone 16"
os_version: "18"
adapter: ""
- os: "iOS"
device: "iPhone 17"
os_version: "26"
adapter: ""
- os: "iOS"
device: "iPhone 14"
os_version: "18"
adapter: ""
- os: "Android"
device: "Google Pixel 6"
os_version: "12.0"
adapter: "Mali-G78"
- os: "Android"
device: "Google Pixel 7"
os_version: "13.0"
adapter: "Mali-G710"
- os: "Android"
device: "Google Pixel 8"
os_version: "14.0"
adapter: "Mali-G715"
- os: "Android"
device: "Google Pixel 9"
os_version: "15.0"
adapter: "Mali-G715"
- os: "Android"
device: "Google Pixel 10"
os_version: "16.0"
adapter: "DXT-48-1536"
- os: "Android"
device: "Samsung Galaxy S23"
os_version: "13.0"
adapter: "Adreno (TM) 740"
- os: "Android"
device: "Samsung Galaxy S24"
os_version: "14.0"
adapter: "Samsung Xclipse 940"
- os: "Android"
device: "Samsung Galaxy S25"
os_version: "15.0"
adapter: "Adreno (TM) 830"
- os: "Android"
device: "Samsung Galaxy S26"
os_version: "16.0"
adapter: "tbd"
- os: "Android"
device: "OnePlus 11R"
os_version: "13.0"
adapter: "Adreno (TM) 730"
- os: "Android"
device: "OnePlus 12R"
os_version: "14.0"
adapter: "Adreno (TM) 740"
- os: "Android"
device: "OnePlus 13R"
os_version: "15.0"
adapter: "Adreno (TM) 830"
steps:
- uses: actions/checkout@v6
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.gitref }}
- name: Checkout patches
uses: actions/checkout@v6
with:
path: "runner-patches"
- name: Apply patches
shell: pwsh
run: |
Get-ChildItem "runner-patches/patches" -Filter *.patch |
Foreach-Object {
Write-Output "Processing $($_.FullName)"
git apply --ignore-whitespace $($_.FullName)
}
- name: Install deps
run: |
cd .github/start-mobile-example
npm install
npm install -g @percy/cli@latest
- name: Run Example
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 20
max_attempts: 3
retry_wait_seconds: 30
command: |
cd .github/start-mobile-example
npx percy app:exec --parallel -- npm run mobile
env:
BROWSERSTACK_APP_ID: ${{ github.run_id }}
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
DEVICE: ${{ matrix.device }}
OS_VERSION: ${{ matrix.os_version }}
- name: Save screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v5
with:
name: screenshots-${{ matrix.device }}-${{ matrix.os_version }}
path: .github/start-mobile-example/*.png
- name: Install Pixel Eagle CLI
uses: vleue/PixelEagle-cli/install@1eeb51dcd4531350912a1d4542eb687589d212e2 # v0.2.1
- name: Send to Pixel Eagle
run: |
cd .github/start-mobile-example
for screenshot in $(find . -type f -maxdepth 1 -name "*.png");
do
file=${screenshot:2}
name="${{ matrix.os }}-${{ matrix.device }}-${{ matrix.os_version }}-$file"
mv "$file" "$name"
done
pixeleagle-cli upload-screenshots ${{ needs.create-pixel-eagle-run.outputs.pixeleagle_run }} *.png
env:
PIXEL_EAGLE_TOKEN: ${{ secrets.PIXELEAGLE }}
mobile-check-result-pixel-eagle:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [take-screenshots, create-pixel-eagle-run]
if: always()
steps:
- name: Install Pixel Eagle CLI
uses: vleue/PixelEagle-cli/install@1eeb51dcd4531350912a1d4542eb687589d212e2 # v0.2.1
- name: Trigger screenshots comparison
run: |
pixeleagle-cli --format json compare-run ${{ needs.create-pixel-eagle-run.outputs.pixeleagle_run }} --same os --filter branch:main --print-details | jq '{project_id: .project_id, from: .from, to: .to}' > pixeleagle-mobile.json
cat pixeleagle-mobile.json
env:
PIXEL_EAGLE_TOKEN: ${{ secrets.PIXELEAGLE }}
- name: Upload Pixel Eagle status
uses: actions/upload-artifact@v5
with:
name: pixeleagle-mobile
path: pixeleagle-mobile.json
- name: Wait a bit
run: |
sleep 30