-
Notifications
You must be signed in to change notification settings - Fork 5
740 lines (621 loc) · 21.6 KB
/
ui-automated-tests.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
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
name: UI Tests on Windows and MacOS 🧪
on:
schedule:
- cron: "0 0/6 * * 1-5"
pull_request:
types: [opened, synchronize, reopened, edited]
paths-ignore:
- ".github/workflows/**"
- "!.github/workflows/ui-automated-tests.yml"
- "docs/**"
- ".gitignore"
- ".prettierignore"
- ".prettierrc.json"
- "PULL_REQUEST_TEMPLATE.md"
- "README.md"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
jobs:
create-node:
runs-on: ubuntu-latest
steps:
- name: Checkout Warp directory 🔖
uses: actions/checkout@v4
with:
repository: Satellite-im/Warp
ref: 01beb3ceda05b97aeba7e4ba6059c8ec1a2bd16b
- name: Set up cargo cache 🛠️
uses: Swatinem/rust-cache@v2
- name: Install Rust 💿
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.75.0
components: rustfmt, clippy
- name: Run cargo build shuttle on Warp 🚀
run: cargo build --bin shuttle --release
- name: Launch CI instance of Warp 🚀
run: ./target/release/shuttle --keyfile key.bin --listen-addr /ip4/127.0.0.1/tcp/4444 > peerID.txt &
- name: Upload Artifact Peer ID data⬆️
uses: actions/upload-artifact@v4
with:
name: peerID
path: peerID.txt
- name: Upload Artifact Key File data⬆️
uses: actions/upload-artifact@v4
with:
name: keyfile
path: key.bin
build-mac:
needs: create-node
runs-on: macos-14
steps:
- name: Checkout Uplink directory 🔖
uses: actions/checkout@v4
with:
repository: Satellite-im/Uplink
- name: Checkout testing directory 🔖
uses: actions/checkout@v4
with:
path: "./appium-tests"
- name: Download Peer ID file 🗳️
uses: actions/download-artifact@v4
with:
name: peerID
path: ./warp
- name: Set up cargo cache 🛠️
uses: Swatinem/rust-cache@v2
- name: Install Rust 💿
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.75.0
components: rustfmt, clippy
- name: Add Targets for MacOS
env:
MACOSX_DEPLOYMENT_TARGET: "10.13"
run: |
rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Replace Warp Peer ID in Uplink 🚀
run: |
chmod +x ./appium-tests/scripts/replace_node.sh
./appium-tests/scripts/replace_node.sh
- name: Build executable 🖥️
run: make dmg
continue-on-error: true
- name: Create ZIP archive on MacOS 🗳️
run: |
ditto -c -k --sequesterRsrc --keepParent target/release/macos/Uplink.app Uplink-Mac-Universal.zip
- name: Calculate hashes 🧮
run: |
shasum -a 256 Uplink-Mac-Universal.zip > Uplink-Mac-Universal.zip.sha256.txt
- name: Upload Artifact ⬆️
uses: actions/upload-artifact@v4
env:
NODE_OPTIONS: "--max-old-space-size=8192"
with:
name: Uplink-macos-latest
path: |
Uplink-Mac-Universal.zip
Uplink-Mac-Universal.zip.sha256.txt
- name: Add label if any of build jobs failed
if: failure()
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: add
build-windows:
needs: create-node
runs-on:
labels: windows-latest
steps:
- name: Checkout Uplink directory 🔖
uses: actions/checkout@v4
with:
repository: Satellite-im/Uplink
- name: Checkout testing directory 🔖
uses: actions/checkout@v4
with:
path: "./appium-tests"
- name: Download Peer ID file 🗳️
uses: actions/download-artifact@v4
with:
name: peerID
path: ./warp
- name: Install Wix
uses: actions/checkout@v4
with:
repository: fbarresi/wix
path: wix
- name: Set up cargo cache 🛠️
uses: Swatinem/rust-cache@v2
- name: Install Rust 💿
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.75.0
components: rustfmt, clippy
- name: Install cargo wix
run: cargo install cargo-wix
- name: Install FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
- name: Get localPeerId and build app 🖥️
id: get_local_peer_id
run: |
./appium-tests/scripts/replace_node.ps1
cargo build --release -F production_mode
- name: Create ZIP archive on Windows 🗳️
run: Compress-Archive -Path target/release/uplink.exe -Destination uplinkWindows.zip
- name: Build Installer
run: cargo wix --package uplink --no-build --nocapture
- name: Upload Executable ⬆️
uses: actions/upload-artifact@v4
with:
name: Uplink-windows-latest
path: target/wix/*.msi
- name: Add label if any of build jobs failed
if: failure()
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: add
test-mac:
needs: build-mac
runs-on: macos-14
steps:
- name: Checkout testing directory 🔖
uses: actions/checkout@v4
- name: Checkout Warp directory 🔖
uses: actions/checkout@v4
with:
repository: Satellite-im/Warp
ref: 01beb3ceda05b97aeba7e4ba6059c8ec1a2bd16b
path: "./warp"
- name: Install Dependencies
continue-on-error: true
run: |
brew update
brew install cairo pango
- name: Download Key file 🗳️
uses: actions/download-artifact@v4
with:
name: keyfile
path: ./warp
- name: Install Rust 💿
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.75.0
components: rustfmt, clippy
- name: Download the MacOS app 🗳️
uses: actions/download-artifact@v4
with:
name: Uplink-macos-latest
path: ./apps
- name: Enable opening app not codesigned 🖥️
run: sudo spctl --master-disable
- name: Copy DMG to Appium Apps Directory 💿
working-directory: ./apps
run: |
unzip Uplink-Mac-Universal.zip
cp -r ./Uplink.app ./Uplink2.app
perl -i -pe 's/im.satellite.uplink/im.satellite.uplinkChatUserB/g' ./Uplink2.app/Contents/Info.plist
cp -r ./Uplink.app /Applications/
cp -r ./Uplink2.app /Applications/
sudo xattr -r -d com.apple.quarantine /Applications/Uplink.app
sudo xattr -r -d com.apple.quarantine /Applications/Uplink2.app
- name: Setup Node.js 🔨
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Cache NPM dependencies 🔨
uses: actions/cache@v4
id: cache-mac
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Install NPM dependencies 📦
if: steps.cache-mac.outputs.cache-hit != 'true'
run: npm ci
- name: Update MacOS runner to not autocorrect text
run: |
defaults write -g NSAutomaticCapitalizationEnabled -bool false
defaults write -g NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
- name: Delete Cache Folder and copy reusable data
run: |
rm -rf ~/.uplink/
mkdir ./tests/fixtures/users/mac2
cp -r ./tests/fixtures/users/FriendsTestUser/ ./tests/fixtures/users/mac2/FriendsTestUser
- name: Run cargo build shuttle on Warp 🚀
working-directory: ./warp
run: cargo build --bin shuttle --release
- name: Launch CI instance of Warp 🚀
working-directory: ./warp
run: ./target/release/shuttle --keyfile key.bin --listen-addr /ip4/127.0.0.1/tcp/4444 &
- name: Run Tests on MacOS 🧪
run: npm run mac.ci
- name: Upload Test Report - MacOS CI
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-macos-ci
path: ./test-report/*.xml
- name: Upload Allure Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-allure-mac-ci
path: ./allure-results/
- name: Upload Screenshots for MacOS 📷
uses: actions/upload-artifact@v4
if: failure()
with:
name: appium-screenshots-MacOS
path: ./test-results
- name: Upload Appium Log for MacOS 📷
uses: actions/upload-artifact@v4
if: failure()
with:
name: appium-log-macos
path: ./appium.log
- name: Add label if any of test jobs failed
if: failure()
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: add
test-mac-chats:
needs: build-mac
runs-on: macos-14
steps:
- name: Checkout testing directory 🔖
uses: actions/checkout@v4
- name: Checkout Warp directory 🔖
uses: actions/checkout@v4
with:
repository: Satellite-im/Warp
ref: 01beb3ceda05b97aeba7e4ba6059c8ec1a2bd16b
path: "./warp"
- name: Install Dependencies
continue-on-error: true
run: |
brew update
brew install cairo pango
- name: Download Key file 🗳️
uses: actions/download-artifact@v4
with:
name: keyfile
path: ./warp
- name: Install Rust 💿
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.75.0
components: rustfmt, clippy
- name: Download the MacOS app 🗳️
uses: actions/download-artifact@v4
with:
name: Uplink-macos-latest
path: ./apps
- name: Enable opening app not codesigned 🖥️
run: sudo spctl --master-disable
- name: Copy DMG to Appium Apps Directory 💿
working-directory: ./apps
run: |
unzip Uplink-Mac-Universal.zip
cp -r ./Uplink.app ./Uplink2.app
cp -r ./Uplink.app ./Uplink3.app
perl -i -pe 's/im.satellite.uplink/im.satellite.uplinkChatUserA/g' ./Uplink.app/Contents/Info.plist
perl -i -pe 's/im.satellite.uplink/im.satellite.uplinkChatUserB/g' ./Uplink2.app/Contents/Info.plist
perl -i -pe 's/im.satellite.uplink/im.satellite.uplinkChatUserC/g' ./Uplink3.app/Contents/Info.plist
cp -r ./Uplink.app /Applications/
cp -r ./Uplink2.app /Applications/
cp -r ./Uplink3.app /Applications/
sudo xattr -r -d com.apple.quarantine /Applications/Uplink.app
sudo xattr -r -d com.apple.quarantine /Applications/Uplink2.app
sudo xattr -r -d com.apple.quarantine /Applications/Uplink3.app
- name: Setup Node.js 🔨
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Cache NPM dependencies 🔨
uses: actions/cache@v4
id: cache-mac
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Install NPM dependencies 📦
if: steps.cache-mac.outputs.cache-hit != 'true'
run: npm ci
- name: Update MacOS runner to not autocorrect text
run: |
defaults write -g NSAutomaticCapitalizationEnabled -bool false
defaults write -g NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
- name: Run cargo build shuttle on Warp 🚀
working-directory: ./warp
run: cargo build --bin shuttle --release
- name: Launch CI instance of Warp 🚀
working-directory: ./warp
run: ./target/release/shuttle --keyfile key.bin --listen-addr /ip4/127.0.0.1/tcp/4444 &
- name: Run Tests on MacOS 🧪
run: npm run mac.multiremote
- name: Upload Test Report - MacOS CI
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-macos-chats
path: ./test-report/*.xml
- name: Upload Allure Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-allure-mac-chats
path: ./allure-results/
- name: Upload Screenshots for MacOS 📷
uses: actions/upload-artifact@v4
if: failure()
with:
name: appium-screenshots-MacOS-chats
path: ./test-results
- name: Upload Appium Log for MacOS 📷
uses: actions/upload-artifact@v4
if: failure()
with:
name: appium-log-macos-chats
path: ./appium.log
- name: Add label if any of test jobs failed
if: failure()
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: add
test-windows:
needs: build-windows
runs-on: windows-latest
steps:
- name: Checkout testing directory 🔖
uses: actions/checkout@v4
- name: Checkout Warp directory 🔖
uses: actions/checkout@v4
with:
repository: Satellite-im/Warp
ref: 01beb3ceda05b97aeba7e4ba6059c8ec1a2bd16b
path: "./warp"
- name: Download Key file 🗳️
uses: actions/download-artifact@v4
with:
name: keyfile
path: ./warp
- name: Install Rust 💿
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.75.0
components: rustfmt, clippy
- name: Change resolution on Windows Runner
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
shell: powershell
- name: Download the Windows app 🗳️
uses: actions/download-artifact@v4
with:
name: Uplink-windows-latest
path: ./apps
- name: Install MSI and copy assets
working-directory: ./apps
run: |
Get-ChildItem -Recurse -Include "*.msi" | Rename-Item -NewName "uplink.msi"
mkdir C:\uplink
mv ./uplink.msi C:\uplink
Start-Process msiexec.exe -Wait -ArgumentList '/i "C:\uplink\uplink.msi" /qb'
- name: Copy assets from Uplink
run: |
mkdir C:\Program` Files\extensions
mkdir $home/.uplink/themes
mkdir $home/.uplink/extensions
cp -r C:\Program` Files\uplink\bin\uplink.exe C:\Program` Files\uplink
cp -r C:\Program` Files\uplink\extensions\emoji_selector.dll C:\Program` Files\extensions
cp -r C:\Program` Files\uplink\extra\themes\ $home/.uplink/themes
cp -r C:\Program` Files\uplink\extensions\emoji_selector.dll $home/.uplink/extensions
- name: Setup Node.js 🔨
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Cache NPM dependencies 🔨
uses: actions/cache@v4
id: cache-windows
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Install NPM dependencies 📦
if: steps.cache-windows.outputs.cache-hit != 'true'
run: npm ci
- name: Delete Cache Folder of Appium if exists - Windows
run: If (Test-Path $home/.appium) {Remove-Item -Recurse -Force $home/.appium} Else { Break }
shell: powershell
- name: Setup FFMPEG to record screen
uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
- name: Run cargo build shuttle on Warp 🚀
working-directory: ./warp
run: cargo build --bin shuttle --release
- name: Launch CI instance of Warp 🚀
working-directory: ./warp
run: ./target/release/shuttle --keyfile key.bin --listen-addr /ip4/127.0.0.1/tcp/4444 &
- name: Delete Cache Folder if exists - Windows
run: If (Test-Path $home/.uplink/.user) {Remove-Item -Recurse -Force $home/.uplink/.user} Else { Break }
shell: powershell
- name: Run Tests on Windows 🧪
id: test-execution-windows
run: |
$env:DRIVER="windows"
npm run windows.ci
- name: Upload Test Report - Windows CI
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-windows-ci
path: ./test-report/*.xml
- name: Upload Allure Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-allure-windows-ci
path: ./allure-results/
- name: Upload Screenshots for Windows 📷
uses: actions/upload-artifact@v4
if: failure()
with:
name: appium-screenshots-windows
path: ./test-results
- name: Upload Appium Log for Windows 📷
uses: actions/upload-artifact@v4
if: failure()
with:
name: appium-log-windows
path: ./appium.log
- name: Add label if any of test jobs failed
if: failure()
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: add
publish-test-results:
if: always()
needs:
[
create-node,
build-mac,
build-windows,
test-mac,
test-mac-chats,
test-windows,
]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
issues: read
steps:
- name: Download Test Report for MacOS CI
uses: actions/download-artifact@v4
with:
name: test-report-macos-ci
path: artifacts
- name: Download Test Report for MacOS Chats
uses: actions/download-artifact@v4
with:
name: test-report-macos-chats
path: artifacts
- name: Download Test Report for Windows CI
uses: actions/download-artifact@v4
with:
name: test-report-windows-ci
path: artifacts
- name: Download Allure Results for MacOS CI
uses: actions/download-artifact@v4
with:
name: test-allure-mac-ci
path: testing-uplink/allure
- name: Download Allure Results for MacOS CHats
uses: actions/download-artifact@v4
with:
name: test-allure-mac-chats
path: testing-uplink/allure
- name: Download Allure Results for Windows CI
uses: actions/download-artifact@v4
with:
name: test-allure-windows-ci
path: testing-uplink/allure
- name: Publish Test Results for Tests
uses: EnricoMi/publish-unit-test-result-action@v2
if: success()
with:
files: "artifacts/**/*.xml"
ignore_runs: true
job_summary: false
compare_to_earlier_commit: false
check_name: "UI Automated Test Results Summary for MacOS/Windows"
- name: Get Allure history
uses: actions/checkout@v4
if: success()
continue-on-error: true
with:
repository: Satellite-im/test-reports
ref: gh-pages
path: gh-pages
- name: Allure Report action from marketplace
uses: simple-elf/allure-report-action@master
if: success()
id: allure-report
with:
gh_pages: gh-pages
allure_results: testing-uplink/allure
allure_report: allure-report
allure_history: allure-history
keep_reports: 100
- name: Deploy report to Github Pages
if: success()
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: Satellite-im/test-reports
publish_branch: gh-pages
publish_dir: allure-history
- name: Comment PR with the Test Results
if: success()
uses: mshick/add-pr-comment@v2
with:
message: |
UI Automated Tests execution is complete! You can find the test results report [here](https://satellite-im.github.io/test-reports/${{ github.run_number }})
remove-label:
needs:
[
create-node,
build-mac,
build-windows,
test-mac,
test-mac-chats,
test-windows,
publish-test-results,
]
runs-on: ubuntu-latest
steps:
- name: Checkout testing directory 🔖
uses: actions/checkout@v4
- name: Delete artifacts required on failed execution
uses: geekyeggo/delete-artifact@v2
with:
name: |
peerID
keyfile
Uplink-windows-latest
Uplink-macos-latest
test-report-macos-ci
test-report-macos-chats
test-report-windows-ci
test-allure-mac-ci
test-allure-mac-chats
test-allure-windows-ci
- name: Remove label if all test jobs succeeded
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: remove