-
-
Notifications
You must be signed in to change notification settings - Fork 205
2777 lines (2468 loc) · 123 KB
/
Copy pathmain.yml
File metadata and controls
2777 lines (2468 loc) · 123 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
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
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This is a basic workflow to help you get started with Actions
name: CI
env:
DISPLAY: ':99'
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
# Controls when the action will run. Triggers the workflow on push, pull request,
# scheduled nightly, or manual workflow dispatch events.
on:
workflow_dispatch:
push:
branches: [ master, github-workflow-playground ]
pull_request:
schedule:
- cron: "0 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
window-build:
runs-on: windows-2022
strategy:
matrix:
config:
- {python: true}
- {python: false}
steps:
- uses: actions/checkout@v4
- name: Checkout submodule repo
uses: actions/checkout@v4
with:
repository: bluetiger9/SmtpClient-for-Qt
path: "src/smtpclient/"
ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
- name: Checkout googletest
uses: actions/checkout@v4
with:
repository: google/googletest
path: "tst/googletest/"
ref: "release-1.12.1"
- name: Checkout MSIX-Toolkit
uses: actions/checkout@v4
with:
repository: microsoft/MSIX-Toolkit
path: "src/MSIX-Toolkit/"
ref: b82af826d29e93e4c85d34fad8a405b6c49905e7
- name: Checkout qHttpServer
uses: actions/checkout@v4
with:
repository: qt-labs/qthttpserver
path: "src/qthttpserver"
- uses: actions/setup-python@v5
with:
python-version: '3.7'
cache: 'pip'
cache-dependency-path: .github/workflows/main.yml
- name: download python and paddleocr
run: |
python -VV
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install "protobuf<=3.20.2,>=3.1.0"
python -m pip install paddlepaddle==2.5.1
python -m pip install paddleocr
python -m pip install imutils
python -m pip install "Pillow<10.0.0"
python -m pip install opencv-python
python -m pip install numpy
python -m pip install pywin32
if: matrix.config.python
- uses: msys2/setup-msys2@v2
with:
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-qt5-webview
msystem: mingw64
release: false
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.20.x'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
host: 'windows'
modules: 'qtnetworkauth qtcharts'
target: "desktop"
arch: win64_mingw81
dir: "${{github.workspace}}/qt/"
install-deps: "true"
cache: 'true'
cache-key-prefix: 'install-qt-action-windows'
- name: Cache qthttpserver build
id: cache-qthttpserver-mingw
uses: actions/cache@v4
with:
path: src/qthttpserver
key: qthttpserver-mingw-${{ runner.os }}-qt5.15.2-v1
- name: download 3rd party files for qthttpserver
if: steps.cache-qthttpserver-mingw.outputs.cache-hit != 'true'
run: |
cp qHttpServerBin/5.15.2/headers/* src/qthttpserver/src/3rdparty/http-parser/
- name: Build qthttpserver
if: steps.cache-qthttpserver-mingw.outputs.cache-hit != 'true'
run: |
cd src\qthttpserver
qmake
make -j8
cd ../..
- name: Install qthttpserver
run: |
cd src\qthttpserver
make install
cd ../..
- name: Secrets
if: github.ref == 'refs/heads/master'
run: |
cd src
echo "#define STRAVA_SECRET_KEY ${{ secrets.strava_secret_key }}" > secret.h
echo "#define PELOTON_SECRET_KEY ${{ secrets.peloton_secret_key }}" >> secret.h
echo "#define SMTP_USERNAME ${{ secrets.smtp_username }}" >> secret.h
echo "#define SMTP_PASSWORD ${{ secrets.smtp_password }}" >> secret.h
echo "#define SMTP_SERVER ${{ secrets.smtp_server }}" >> secret.h
echo "#define INTERVALSICU_CLIENT_ID ${{ secrets.intervalsicu_client_id }}" >> secret.h
echo "#define INTERVALSICU_CLIENT_SECRET ${{ secrets.intervalsicu_client_secret }}" >> secret.h
echo "${{ secrets.cesiumkey }}" >> inner_templates/googlemaps/cesium-key.js
cd ..
- name: Build
run: |
lrelease src/qdomyos-zwift.pri
qmake
make -j8
cd src/debug
mkdir output
mkdir appx
cp qdomyos-zwift.* output/
cd output
windeployqt --qmldir ../../ qdomyos-zwift.exe
cp "C:/mingw64/bin/libwinpthread-1.dll" .
cp "C:/mingw64/bin/libgcc_s_seh-1.dll" .
cp "C:/mingw64/bin/libstdc++-6.dll" .
cp ../../../icons/iOS/iTunesArtwork@2x.png .
cp ../../AppxManifest.xml .
cp ../../windows/*.py .
cp ../../windows/*.bat .
cp ../../../windows_openssl/*.* .
mkdir adb
mkdir python
Copy-Item -Path C:\hostedtoolcache\windows\Python\3.7.9\x64 -Destination python -Recurse
cp ../../adb/* adb/
cd ..
cd appx
#../../MSIX-Toolkit/WindowsSDK/10/10.0.20348.0/x64/makeappx.exe pack /d ../output/ /p qz
if: matrix.config.python
- name: Build without python
run: |
lrelease src/qdomyos-zwift.pri
qmake
make -j8
cd src/debug
mkdir output
mkdir appx
cp qdomyos-zwift.* output/
cd output
windeployqt --qmldir ../../ qdomyos-zwift.exe
cp "C:/mingw64/bin/libwinpthread-1.dll" .
cp "C:/mingw64/bin/libgcc_s_seh-1.dll" .
cp "C:/mingw64/bin/libstdc++-6.dll" .
cp ../../../icons/iOS/iTunesArtwork@2x.png .
cp ../../AppxManifest.xml .
cp ../../../windows_openssl/*.* .
mkdir adb
cp ../../adb/* adb/
cd ..
cd appx
#../../MSIX-Toolkit/WindowsSDK/10/10.0.20348.0/x64/makeappx.exe pack /d ../output/ /p qz
if: matrix.config.python == false
- name: patching qt for bluetooth
run: cp qt-patches/windows/5.15.2/binary/mingw64/*.* ${{ github.workspace }}/src/debug/output/
- name: Zip artifact for deployment
run: Compress-Archive src/debug/output windows-binary.zip
if: matrix.config.python
- name: Zip artifact for deployment
run: Compress-Archive src/debug/output windows-binary-no-python.zip
if: ${{ ! matrix.config.python }}
- name: Archive windows binary
uses: actions/upload-artifact@v4
with:
name: windows-binary
path: windows-binary.zip
if: matrix.config.python
- name: Archive windows binary
uses: actions/upload-artifact@v4
with:
name: windows-binary-no-python
path: windows-binary-no-python.zip
if: ${{ ! matrix.config.python }}
# - name: Exit if not on master branch
# if: github.ref == 'refs/heads/master'
# run: exit 1
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
# - name: Get previous tag
# id: previoustag
# uses: 'WyriHaximus/github-action-get-previous-tag@v1'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Create Release
# if: ${{ ! matrix.config.python }}
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ steps.previoustag.outputs.tag }}
# release_name: Release ${{ steps.previoustag.outputs.tag }}
# draft: false
# prerelease: false
# - name: upload windows artifact
# uses: actions/upload-release-asset@v1
# if: ${{ ! matrix.config.python }}
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: release.zip
# asset_name: windows-binary-no-python.zip
# asset_content_type: application/zip
# - name: upload windows artifact
# uses: actions/upload-release-asset@v1
# if: ${{ matrix.config.python }}
# env:
# GITHUB_TOKEN: ${{ github.token }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: release.zip
# asset_name: windows-binary.zip
# asset_content_type: application/zip
# window-steam-build:
# runs-on: windows-2022
#
# steps:
# - uses: actions/checkout@v2
# - name: Checkout submodule repo
# uses: actions/checkout@v2
# with:
# repository: bluetiger9/SmtpClient-for-Qt
# path: "src/smtpclient/"
# ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
#
#
# - uses: msys2/setup-msys2@v2
# with:
# install: mingw-w64-x86_64-toolchain
# msystem: mingw64
# release: false
#
# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v1.9
# with:
# cmake-version: '3.20.x'
#
# - name: Install Qt
# uses: jurplel/install-qt-action@v2
# with:
# version: '5.15.2'
# host: 'windows'
# modules: 'qtnetworkauth qtcharts'
# target: "desktop"
# arch: win64_mingw81
# dir: "${{github.workspace}}/qt/"
# install-deps: "true"
#
# - name: Build
# run: |
# qmake
# cd src
# echo "#define STRAVA_SECRET_KEY ${{ secrets.strava_secret_key }}" > secret.h
# echo "#define PELOTON_SECRET_KEY ${{ secrets.peloton_secret_key }}" >> secret.h
# echo "#define SMTP_USERNAME ${{ secrets.smtp_username }}" >> secret.h
# echo "#define SMTP_PASSWORD ${{ secrets.smtp_password }}" >> secret.h
# echo "#define SMTP_SERVER ${{ secrets.smtp_server }}" >> secret.h
# echo "${{ secrets.cesiumkey }}" >> inner_templates/googlemaps/cesium-key.js
# echo "#define STEAM_STORE" >> secret.h
# cd ..
# make -j8
# cd src/debug
# mkdir output
# mkdir appx
# cp qdomyos-zwift.exe output/
# cd output
# windeployqt --qmldir ../../ qdomyos-zwift.exe
# cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libwinpthread-1.dll" .
# cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libgcc_s_seh-1.dll" .
# cp "${{github.workspace}}/qt/Qt/5.15.2/mingw81_64/bin/libstdc++-6.dll" .
#
# - uses: game-ci/steam-deploy@v1
# with:
# username: ${{ secrets.STEAM_USERNAME }}
# password: ${{ secrets.STEAM_PASSWORD }}
# configVdf: ${{ secrets.STEAM_CONFIG_VDF}}
# ssfnFileName: ${{ secrets.STEAM_SSFN_FILE_NAME }}
# ssfnFileContents: ${{ secrets.STEAM_SSFN_FILE_CONTENTS }}
# appId: 2267200
# buildDescription: 2.12
# rootPath: src/debug/output
# depot1Path: ./
# #depot2Path: StandaloneLinux64
# releaseBranch: prerelease
# This workflow contains a single job called "build"
linux-x86-build:
# The type of runner that the job will run on
runs-on: ubuntu-24.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: release
uses: actions/create-release@v1
if: startsWith(github.ref, 'refs/tags/')
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
# - name: Cache Qt Linux Desktop
# id: cache-qt-linux-desktop
# uses: actions/cache@v1
# with:
# path: '${{ github.workspace }}/output/linux-desktop/'
# key: ${{ runner.os }}-QtCache-Linux-Desktop
# - name: Cache Qt Linux Android
# id: cache-qt-android
# uses: actions/cache@v1
# with:
# path: '${{ github.workspace }}/output/android/'
# key: ${{ runner.os }}-QtCache-Android
- name: Xvfb install and run
run: |
sudo apt-get install -y xvfb
Xvfb -ac ${{ env.DISPLAY }} -screen 0 1280x780x24 &
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Checkout submodule repo
uses: actions/checkout@v4
with:
repository: bluetiger9/SmtpClient-for-Qt
path: "src/smtpclient/"
ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
- name: Checkout googletest
uses: actions/checkout@v4
with:
repository: google/googletest
path: "tst/googletest/"
ref: "release-1.12.1"
- name: Checkout qHttpServer
uses: actions/checkout@v4
with:
repository: qt-labs/qthttpserver
path: "src/qthttpserver"
- name: Install packages required to run QZ inside workflow
run: sudo apt update -y && sudo apt-get install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 libqt5networkauth5-dev libqt5websockets5* libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev qtbase5-dev libqt5sql5-sqlite libqt5sql5 libqt5sql5-mysql libqt5sql5-psql
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
host: 'linux'
modules: 'qtnetworkauth qtcharts'
cache: 'true'
cache-key-prefix: 'install-qt-action-linux'
- name: Cache qthttpserver build
id: cache-qthttpserver-linux
uses: actions/cache@v4
with:
path: src/qthttpserver
key: qthttpserver-linux-${{ runner.os }}-qt5.15.2-v1
- name: download 3rd party files for qthttpserver
if: steps.cache-qthttpserver-linux.outputs.cache-hit != 'true'
run: |
cp qHttpServerBin/5.15.2/headers/* src/qthttpserver/src/3rdparty/http-parser/
- name: Build qthttpserver
if: steps.cache-qthttpserver-linux.outputs.cache-hit != 'true'
run: |
cd src/qthttpserver
qmake
make -j8
cd ../..
- name: Install qthttpserver
run: |
cd src/qthttpserver
make install
cd ../..
- name: Compile Linux Desktop
run: qmake; make -j8
- name: Archive linux-desktop binary
uses: actions/upload-artifact@v4
with:
name: linux-desktop-binary
path: src/qdomyos-zwift
- name: Test
run: cd tst; GTEST_OUTPUT=xml:test-results/ GTEST_COLOR=1 ./qdomyos-zwift-tests; cd ..
- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test_results_xml
path: tst/test-results/**/*.xml
- name: Upload test FIT files and database
uses: actions/upload-artifact@v4
if: always()
with:
name: test_fit_files_and_db
path: |
tst/test-artifacts/*.fit
tst/test-artifacts/*.sqlite
# - name: Test Peloton API
# if: github.event_name == 'push' || github.event_name == 'schedule'
# run: cd /home/runner/work/qdomyos-zwift/qdomyos-zwift/src/; ./qdomyos-zwift -test-peloton -peloton-username ${{ secrets.peloton_username }} -peloton-password ${{ secrets.peloton_password }}
# timeout-minutes: 2
# - name: Test Home Fitness Buddy API
# run: cd /home/runner/work/qdomyos-zwift/qdomyos-zwift/src/; ./qdomyos-zwift -test-hfb
# timeout-minutes: 2
# - uses: actions/checkout@v2
# with:
# repository: nttld/setup-ndk
# path: setup-ndk
# The packages.json in nttld/setup-ndk has already been updated,
# https://github.com/nttld/setup-ndk/commit/831db5b02a0f0cab80614619efe461a3dcc140e6
# but `dist/*` has not been rebuilt yet. Build it.
# https://github.com/nttld/setup-ndk/tree/main/dist
# - name: Locally rebuilt setup-ndk
# run: |
# npm -prefix ./setup-ndk install
# npm -prefix ./setup-ndk run all
# Install using locally rebuilt setup-ndk
# - name: Setup Android NDK r21d
# uses: ./setup-ndk
#- uses: nttld/setup-ndk@v1
# with:
# ndk-version: r21d
# waiting github.com/jurplel/install-qt-action/issues/63
# - name: Install Qt Android
# uses: jurplel/install-qt-action@v2
# with:
# version: '5.12.9'
# host: 'linux'
# target: 'android'
# arch: 'android_armv7'
# modules: 'qtcharts debug_info'
# dir: '${{ github.workspace }}/output/android/'
# cached: ${{ steps.cache-qt-android.outputs.cache-hit }}
# - name: Compile Android
# run: cd src; qmake; make -j4
# - name: Install Qt MacOS
# uses: jurplel/install-qt-action@v2
# with:
# version: '5.12.9'
# host: 'mac'
# target: 'desktop'
# modules: 'qtcharts debug_info'
# dir: '${{ github.workspace }}/output/macos/'
# - name: Compile MacOS
# run: cd src; qmake; make -j4
# This workflow contains a single job called "build"
android-build:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# - name: Cache Qt Linux Desktop
# id: cache-qt-linux-desktop
# uses: actions/cache@v1
# with:
# path: '${{ github.workspace }}/output/linux-desktop/'
# key: ${{ runner.os }}-QtCache-Linux-Desktop
# - name: Cache Qt Linux Android
# id: cache-qt-android
# uses: actions/cache@v1
# with:
# path: '${{ github.workspace }}/output/android/'
# key: ${{ runner.os }}-QtCache-Android
- name: Xvfb install and run
run: |
sudo apt-get install -y xvfb
Xvfb -ac ${{ env.DISPLAY }} -screen 0 1280x780x24 &
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: 'false' # Prima disattiva il checkout automatico dei submodule
- name: Checkout submodules with specific branches
run: |
git submodule init
git submodule update --init --recursive
- name: Install packages required to run QZ inside workflow
run: sudo apt update -y && sudo apt-get install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qttools5-dev-tools qtquickcontrols2-5-dev libqt5bluetooth5 libqt5widgets5 libqt5positioning5 libqt5xml5 qtconnectivity5-dev qtpositioning5-dev libqt5charts5-dev libqt5charts5 libqt5networkauth5-dev libqt5websockets5* libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev
# - name: Test Peloton API
# if: github.event_name == 'push' || github.event_name == 'schedule'
# run: cd /home/runner/work/qdomyos-zwift/qdomyos-zwift/src/; ./qdomyos-zwift -test-peloton -peloton-username ${{ secrets.peloton_username }} -peloton-password ${{ secrets.peloton_password }}
# timeout-minutes: 2
# - name: Test Home Fitness Buddy API
# run: cd /home/runner/work/qdomyos-zwift/qdomyos-zwift/src/; ./qdomyos-zwift -test-hfb
# timeout-minutes: 2
# - uses: actions/checkout@v2
# with:
# repository: nttld/setup-ndk
# path: setup-ndk
# The packages.json in nttld/setup-ndk has already been updated,
# https://github.com/nttld/setup-ndk/commit/831db5b02a0f0cab80614619efe461a3dcc140e6
# but `dist/*` has not been rebuilt yet. Build it.
# https://github.com/nttld/setup-ndk/tree/main/dist
# - name: Locally rebuilt setup-ndk
# run: |
# npm -prefix ./setup-ndk install
# npm -prefix ./setup-ndk run all
# Install using locally rebuilt setup-ndk
# - name: Setup Android NDK r21d
# uses: ./setup-ndk
#- uses: nttld/setup-ndk@v1
# with:
# ndk-version: r21d
# waiting github.com/jurplel/install-qt-action/issues/63
- name: Install Qt Android
uses: jdpurcell/install-qt-action@v5
with:
version: '5.15.0'
host: 'linux'
target: 'android'
arch: 'android'
modules: 'qtcharts qtnetworkauth qtpurchasing'
dir: '${{ github.workspace }}/output/android/'
cache: 'false'
- name: Install custom 16K-page-size Qt (overlay onto stock Qt install)
run: |
QT_DIR="${{ github.workspace }}/output/android/Qt/5.15.0/android"
curl -fsSL -o /tmp/qt5.15.0-android-page16.zip https://github.com/cagnulein/qt-5.15.0-android-page16k/releases/download/1.0.0/qt5.15.0-android-page16.zip
unzip -q /tmp/qt5.15.0-android-page16.zip -d /tmp/qt-page16k
# Overlay the 16K-page-aligned target libs/plugins/qml/mkspecs/jar/include onto the
# stock Qt install; keep the stock Linux host tools (bin/) since the custom Qt's
# host tools were built on macOS (Mach-O, not usable on this Linux runner).
rsync -a --exclude='bin/' "/tmp/qt-page16k/qt5.15.0-android-page16/usr/local/Qt-5.15.0/" "$QT_DIR/"
# qdevice.pri comes from the overlay carrying the macOS origin's NDK host value;
# fix it back to linux so qmake resolves the NDK toolchain path correctly.
sed -i 's/darwin-x86_64/linux-x86_64/' "$QT_DIR/mkspecs/qdevice.pri"
rm -rf /tmp/qt5.15.0-android-page16.zip /tmp/qt-page16k
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: patching qt for bluetooth
run: cp qt-patches/android/5.15.0/jar/*.* ${{ github.workspace }}/output/android/Qt/5.15.0/android/jar/
- name: download 3rd party files for qthttpserver
run: cp qHttpServerBin/5.15.2/headers/* src/qthttpserver/src/3rdparty/http-parser/
- name: Cache Android NDK
id: cache-ndk
uses: actions/cache@v4
with:
path: /usr/local/lib/android/sdk/ndk/21.1.6352462
key: android-ndk-21.1.6352462-${{ runner.os }}
- name: Install Android SDK packages
run: |
SDKMANAGER="/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager"
echo "y" | $SDKMANAGER "ndk;21.1.6352462" "platforms;android-35" "build-tools;35.0.0"
- name: Setup ccache
run: |
sudo apt-get install -y ccache
echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV
ccache --set-config=max_size=2G
ccache --set-config=compression=true
ccache --set-config=compression_level=6
ccache --set-config=base_dir=${{ github.workspace }}
ccache --set-config=sloppiness=pch_defines,time_macros,include_file_mtime,file_macro
ccache --zero-stats
- name: Restore ccache
uses: actions/cache@v4
with:
path: .ccache
key: ccache-android-ndk21_1-${{ hashFiles('src/**/*.cpp', 'src/**/*.h', 'src/*.pro') }}
restore-keys: |
ccache-android-ndk21_1-
- name: Setup NDK environment with ccache
run: |
NDK_PATH=/usr/local/lib/android/sdk/ndk/21.1.6352462
NDK_BIN=$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/bin
ln -sfn $NDK_PATH /usr/local/lib/android/sdk/ndk-bundle
rm -rf /usr/local/lib/android/sdk/ndk/25.1.8937393
echo "ANDROID_NDK=/usr/local/lib/android/sdk/ndk-bundle" >> $GITHUB_ENV
echo "ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk-bundle" >> $GITHUB_ENV
# Wrap NDK compilers with ccache for build caching
if [ ! -f "$NDK_BIN/clang.real" ]; then
mv $NDK_BIN/clang $NDK_BIN/clang.real
mv $NDK_BIN/clang++ $NDK_BIN/clang++.real
fi
printf '#!/bin/bash\nexec /usr/bin/ccache %s/clang.real "$@"\n' "$NDK_BIN" > $NDK_BIN/clang
printf '#!/bin/bash\nexec /usr/bin/ccache %s/clang++.real "$@"\n' "$NDK_BIN" > $NDK_BIN/clang++
chmod +x $NDK_BIN/clang $NDK_BIN/clang++
- name: Generate secrets
run: |
cd src
echo "#define STRAVA_SECRET_KEY ${{ secrets.strava_secret_key }}" > secret.h
echo "#define PELOTON_SECRET_KEY ${{ secrets.peloton_secret_key }}" >> secret.h
echo "#define SMTP_USERNAME ${{ secrets.smtp_username }}" >> secret.h
echo "#define SMTP_PASSWORD ${{ secrets.smtp_password }}" >> secret.h
echo "#define SMTP_SERVER ${{ secrets.smtp_server }}" >> secret.h
echo "#define INTERVALSICU_CLIENT_ID ${{ secrets.intervalsicu_client_id }}" >> secret.h
echo "#define INTERVALSICU_CLIENT_SECRET ${{ secrets.intervalsicu_client_secret }}" >> secret.h
echo "${{ secrets.cesiumkey }}" >> inner_templates/googlemaps/cesium-key.js
echo "#define LICENSE" >> secret.h
- name: Prepare Android signing key
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
if [ -z "$SIGNING_KEY" ] || [ -z "$SIGNING_ALIAS" ] || [ -z "$KEY_STORE_PASSWORD" ] || [ -z "$KEY_PASSWORD" ]; then
echo "Android signing secrets are not available; APK re-signing will be skipped."
echo "CI_ANDROID_RESIGN_APK=false" >> "$GITHUB_ENV"
exit 0
fi
KEYSTORE="${{ github.workspace }}/src/android/ci-signing-key.jks"
if ! printf '%s' "$SIGNING_KEY" | base64 --decode > "$KEYSTORE"; then
echo "Failed to decode Android signing key."
rm -f "$KEYSTORE"
exit 1
fi
if [ ! -s "$KEYSTORE" ]; then
echo "Decoded Android signing key is empty."
rm -f "$KEYSTORE"
exit 1
fi
echo "CI_ANDROID_SIGNING_KEYSTORE=$KEYSTORE" >> "$GITHUB_ENV"
echo "CI_ANDROID_RESIGN_APK=true" >> "$GITHUB_ENV"
- name: Build qthttpserver for Android
run: |
cd src/qthttpserver
qmake
make -j8
make install
- name: Build QZ for Android (4 ABIs)
run: |
lrelease src/qdomyos-zwift.pri
# CONFIG+=debug matches the real reference build validated against the Mac-built
# APK: it keeps .so unstripped (matching the reference almost byte-for-byte) and,
# with this custom Qt, naturally leaves android-extra-libs unset - the bundled
# android_openssl libs are not 16K-page-aligned, so we must NOT inject them (see
# below); Qt's own QtNetwork already has openssl linked in.
qmake -spec android-clang 'ANDROID_ABIS=armeabi-v7a arm64-v8a x86 x86_64' 'ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/21.1.6352462' 'CONFIG+=debug' && make -j4 && make INSTALL_ROOT=${{ github.workspace }}/output/android/ install
cat src/android-qdomyos-zwift-deployment-settings.json
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.gradle-android/caches
${{ github.workspace }}/.gradle-android/wrapper
key: gradle-android-${{ runner.os }}-v2
restore-keys: |
gradle-android-${{ runner.os }}-
- name: Build Android package
run: |
cd src
mkdir -p ${{ github.workspace }}/output/android
rsync -a --exclude build --exclude .gradle android/ ${{ github.workspace }}/output/android/
androiddeployqt --input android-qdomyos-zwift-deployment-settings.json --output ${{ github.workspace }}/output/android/ --android-platform android-35 --gradle --aux-mode
export GRADLE_USER_HOME="${{ github.workspace }}/.gradle-android"
export GRADLE_OPTS="-Dgradle.user.home=$GRADLE_USER_HOME"
export GRADLE_DIST_DIR="${{ github.workspace }}/gradle-8.13"
export QT_ANDROID_DIR="${{ github.workspace }}/output/android/Qt/5.15.0/android"
mkdir -p "$GRADLE_USER_HOME"
rm -f "$GRADLE_USER_HOME/gradle.properties"
rm -f "$HOME/.gradle/gradle.properties"
find ${{ github.workspace }}/output/android \( -name '*.properties' -o -name '*.gradle' -o -name '*.gradle.kts' \) -exec sed -i '/android\.bundle\.enableUncompressedNativeLibs/d' {} +
printf '\nqt5AndroidDir=%s/src/android/java\n' "$QT_ANDROID_DIR" >> ${{ github.workspace }}/output/android/gradle.properties
echo "Residual enableUncompressedNativeLibs matches after sanitization:"
if grep -RInE "android\\.bundle\\.enableUncompressedNativeLibs|enableUncompressedNativeLibs" ${{ github.workspace }}/output/android "$GRADLE_USER_HOME" "$HOME/.gradle" ; then
echo "Unexpected residual matches found"
exit 1
fi
find ${{ github.workspace }}/output/android -name gradle.properties -print -exec cat {} \;
if [ ! -x "$GRADLE_DIST_DIR/bin/gradle" ]; then
curl -fsSL https://services.gradle.org/distributions/gradle-8.13-bin.zip -o /tmp/gradle-8.13-bin.zip
unzip -q /tmp/gradle-8.13-bin.zip -d ${{ github.workspace }}
fi
"$GRADLE_DIST_DIR/bin/gradle" -g "$GRADLE_USER_HOME" --no-daemon -p ${{ github.workspace }}/output/android assembleDebug bundleDebug
- name: Re-sign APK for stable App Links fingerprint
run: |
if [ "$CI_ANDROID_RESIGN_APK" != "true" ]; then
echo "Skipping APK re-signing because Android signing secrets are not available."
exit 0
fi
APK_PATH="${{ github.workspace }}/output/android/build/outputs/apk/debug/android-debug.apk"
SIGNED_APK_PATH="${{ github.workspace }}/output/android/build/outputs/apk/debug/android-debug-signed.apk"
trap 'rm -f "$CI_ANDROID_SIGNING_KEYSTORE" "$SIGNED_APK_PATH"' EXIT
APKSIGNER=$(find /usr/local/lib/android/sdk/build-tools -name apksigner | sort | tail -n 1)
if [ -z "$APKSIGNER" ]; then
echo "apksigner not found"
exit 1
fi
"$APKSIGNER" sign \
--ks "$CI_ANDROID_SIGNING_KEYSTORE" \
--ks-key-alias "${{ secrets.ALIAS }}" \
--ks-pass "pass:${{ secrets.KEY_STORE_PASSWORD }}" \
--key-pass "pass:${{ secrets.KEY_PASSWORD }}" \
--out "$SIGNED_APK_PATH" \
"$APK_PATH"
mv "$SIGNED_APK_PATH" "$APK_PATH"
- name: Show ccache stats
if: always()
run: ccache --show-stats
- name: Archive apk binary
uses: actions/upload-artifact@v4
with:
name: fdroid-android-trial
path: ${{ github.workspace }}/output/android/build/outputs/apk/debug/android-debug.apk
android-emulator-test:
runs-on: ubuntu-latest
needs: android-build
continue-on-error: ${{ matrix.flaky || false }}
strategy:
fail-fast: false
matrix:
api-level: [24, 26, 28, 29, 30, 31, 33, 35, 36]
include:
- api-level: 24
target: default
arch: x86
android-version: "Android 7.0"
- api-level: 26
target: default
arch: x86
android-version: "Android 8.0"
- api-level: 28
target: default
arch: x86
android-version: "Android 9.0"
- api-level: 29
target: default
arch: x86
android-version: "Android 10"
- api-level: 30
target: google_apis
arch: x86
android-version: "Android 11"
- api-level: 31
target: google_apis
arch: x86_64
android-version: "Android 12"
- api-level: 33
target: google_apis
arch: x86_64
android-version: "Android 13"
flaky: true
- api-level: 35
target: google_apis
arch: x86_64
android-version: "Android 15"
- api-level: 36
target: google_apis
arch: x86_64
android-version: "Android 16"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# Download the APK from the previous job
- name: Download APK Artifact
uses: actions/download-artifact@v4
with:
name: fdroid-android-trial
path: apk-debug
- name: Setup Java for Android Emulator
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run tests on emulator (${{ matrix.android-version }})
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
profile: Nexus 6
disable-animations: true
script: |
# Display available space
df -h
# List available files
echo "Files in apk-debug directory:"
ls -la apk-debug/
# Install the APK
adb install apk-debug/android-debug.apk
# Grant runtime (dangerous) permissions
echo "Granting runtime permissions..."
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.ACCESS_FINE_LOCATION || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.ACCESS_COARSE_LOCATION || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.BLUETOOTH_ADVERTISE || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.BLUETOOTH_CONNECT || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.BLUETOOTH_SCAN || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.READ_EXTERNAL_STORAGE || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.WRITE_EXTERNAL_STORAGE || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.CAMERA || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.RECORD_AUDIO || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.READ_PHONE_STATE || true
adb shell pm grant org.cagnulen.qdomyoszwift android.permission.POST_NOTIFICATIONS || true
# Enable special app ops permissions
adb shell appops set org.cagnulen.qdomyoszwift MANAGE_EXTERNAL_STORAGE allow || true
adb shell appops set org.cagnulen.qdomyoszwift SYSTEM_ALERT_WINDOW allow || true
adb shell appops set org.cagnulen.qdomyoszwift WRITE_SETTINGS allow || true
echo "All permissions granted successfully"
# Start the main activity
adb shell am start -n org.cagnulen.qdomyoszwift/org.cagnulen.qdomyoszwift.CustomQtActivity
# Wait for app to start
sleep 90
# Verify the app is running
echo "Checking if app is running..."
# Use different ps commands for different Android versions
adb shell "ps -A 2>/dev/null || ps" > process_list.txt
# Debug: show all processes to understand the format
echo "=== All running processes ==="
cat process_list.txt | head -20
echo "=== Looking for our app ==="
grep -q "qdomyos" process_list.txt || (echo "App process not found in process list" && echo "TEST FAILED: App process not running" && exit 1)
adb shell pm list packages | grep org.cagnulen.qdomyoszwift
echo "=== Checking app info ==="
adb shell dumpsys package org.cagnulen.qdomyoszwift | grep -A5 -B5 "state"
echo "=== Logcat output for debugging ==="
adb logcat -d | grep -i "qdomyos\|crash\|error\|exception\|fatal" | tail -n 50
echo "=== Full recent logcat ==="
adb logcat -d | tail -n 100
echo "App is running successfully"
# Take a screenshot for verification
adb shell screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png
# Test orientamento automatico con screenshot
echo "Starting orientation test with automatic screenshots..."
# Screenshot iniziale (orientamento corrente)
adb shell screencap -p /sdcard/screenshot_orientation_0.png
adb pull /sdcard/screenshot_orientation_0.png
# Loop per 3 rotazioni aggiuntive (90°, 180°, 270°)
for i in 1 2 3; do echo "Rotating to orientation $i (90° * $i)"; adb shell settings put system user_rotation $i; sleep 5; echo "Taking screenshot for orientation $i"; adb shell screencap -p /sdcard/screenshot_orientation_$i.png; adb pull /sdcard/screenshot_orientation_$i.png; done
echo "Orientation test completed - 4 screenshots captured"
# Check if the package is installed
adb shell pm list packages | grep org.cagnulen.qdomyoszwift
# Save logcat for debugging
echo "Saving logcat for analysis..."
adb logcat -d > full_logcat.txt
adb logcat -d | grep -i qdomyos > qdomyos_logcat.txt
- name: Upload test evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: android-emulator-test-evidence-api${{ matrix.api-level }}
path: |
screenshot.png
screenshot_orientation_*.png
process_list.txt
full_logcat.txt
qdomyos_logcat.txt
if-no-files-found: warn
ios-build:
# The type of runner that the job will run on
runs-on: macos-14
permissions:
contents: write
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Checkout submodule repo
uses: actions/checkout@v4
with:
repository: bluetiger9/SmtpClient-for-Qt
path: "src/smtpclient/"
ref: 3fa4a0fe5797070339422cf18b5e9ed8dcb91f9c
- name: Checkout googletest
uses: actions/checkout@v4
with:
repository: google/googletest
path: "tst/googletest/"
ref: "release-1.12.1"