-
Notifications
You must be signed in to change notification settings - Fork 388
3028 lines (2650 loc) · 120 KB
/
Copy pathcheck-commit.yml
File metadata and controls
3028 lines (2650 loc) · 120 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
name: CI
on:
push:
pull_request:
jobs:
macos-26:
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- name: Select Xcode
run: sudo xcode-select -switch /Applications/Xcode_26.0.1.app
- name: Install dependencies
run: |
brew install automake autoconf pkg-config libtool \
berkeley-db@4 zeromq miniupnpc boost \
gperf qrencode librsvg \
openssl@4 libevent protobuf
- name: Link brew deps
run: brew link berkeley-db@4 boost
- name: Install Qt 6.10.2 for macOS
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/aqt-venv"
source "$RUNNER_TEMP/aqt-venv/bin/activate"
python -m pip install --upgrade pip aqtinstall
QT_ROOT="$RUNNER_TEMP/qt"
python -m aqt install-qt mac desktop 6.10.2 clang_64 \
--outputdir "$QT_ROOT" \
-m qtwebengine qtwebchannel qtpositioning qt5compat
QMAKE_PATH="$(find "$QT_ROOT" -type f \( -name qmake6 -o -name qmake \) -path "*/bin/*" | head -n1 || true)"
if [ -z "${QMAKE_PATH:-}" ]; then
echo "ERROR: Failed to resolve qmake under $QT_ROOT"
find "$QT_ROOT" -maxdepth 5 -type d | sed -n '1,200p'
exit 1
fi
QT_PREFIX="$(dirname "$(dirname "$QMAKE_PATH")")"
echo "QT_PREFIX=$QT_PREFIX" >> "$GITHUB_ENV"
echo "Installed Qt prefix: $QT_PREFIX"
- name: Add Qt tools to PATH
run: |
echo "$QT_PREFIX/bin" >> "$GITHUB_PATH"
echo "$QT_PREFIX/libexec" >> "$GITHUB_PATH"
- name: Resolve Qt host tools
run: |
set -euo pipefail
ALIAS_DIR="$PWD/.qt-tool-aliases"
mkdir -p "$ALIAS_DIR"
declare -a QT_TOOL_DIRS=(
"$QT_PREFIX/libexec"
"$QT_PREFIX/bin"
)
QMAKE_BIN="$(command -v qmake6 || command -v qmake || true)"
if [ -n "$QMAKE_BIN" ]; then
for qdir in \
"$("$QMAKE_BIN" -query QT_HOST_BINS 2>/dev/null || true)" \
"$("$QMAKE_BIN" -query QT_INSTALL_BINS 2>/dev/null || true)" \
"$("$QMAKE_BIN" -query QT_HOST_LIBEXECS 2>/dev/null || true)" \
"$("$QMAKE_BIN" -query QT_INSTALL_LIBEXECS 2>/dev/null || true)"
do
if [ -n "$qdir" ]; then
QT_TOOL_DIRS+=("$qdir")
fi
done
fi
find_qt_tool() {
local base="$1"
shift || true
local names=("$base" "${base}6" "${base}-qt6")
local d n cand
for d in "${QT_TOOL_DIRS[@]}"; do
[ -d "$d" ] || continue
for n in "${names[@]}"; do
cand="$d/$n"
if [ -x "$cand" ]; then
echo "$cand"
return 0
fi
done
done
return 1
}
MOC_REAL="$(find_qt_tool moc || true)"
UIC_REAL="$(find_qt_tool uic || true)"
RCC_REAL="$(find_qt_tool rcc || true)"
if [ -z "$MOC_REAL" ] || [ -z "$UIC_REAL" ] || [ -z "$RCC_REAL" ]; then
echo "ERROR: Could not resolve Qt host tools."
echo "QMAKE_BIN=${QMAKE_BIN:-<none>}"
echo "QT tool dirs searched:"
printf ' - %s\n' "${QT_TOOL_DIRS[@]}"
echo "Listing candidate dirs:"
for d in "${QT_TOOL_DIRS[@]}"; do
if [ -d "$d" ]; then
echo "-- $d"
ls -la "$d" | egrep 'moc|uic|rcc|qmake' || true
fi
done
exit 1
fi
ln -sf "$MOC_REAL" "$ALIAS_DIR/moc"
ln -sf "$MOC_REAL" "$ALIAS_DIR/moc-qt6"
ln -sf "$UIC_REAL" "$ALIAS_DIR/uic"
ln -sf "$UIC_REAL" "$ALIAS_DIR/uic-qt6"
ln -sf "$RCC_REAL" "$ALIAS_DIR/rcc"
ln -sf "$RCC_REAL" "$ALIAS_DIR/rcc-qt6"
echo "$ALIAS_DIR" >> "$GITHUB_PATH"
echo "MOC=$ALIAS_DIR/moc" >> "$GITHUB_ENV"
echo "UIC=$ALIAS_DIR/uic" >> "$GITHUB_ENV"
echo "RCC=$ALIAS_DIR/rcc" >> "$GITHUB_ENV"
- name: Verify Qt tools
run: |
set -euo pipefail
which moc || true
which moc6 || true
ls -l "$PWD/.qt-tool-aliases" || true
ls -l "$QT_PREFIX/bin" | egrep 'moc|moc6|uic|rcc|qmake' || true
ls -l "$QT_PREFIX/libexec" | egrep 'moc|moc6|uic|rcc|qmake' || true
moc -v
- name: Autogen
run: ./autogen.sh
- name: Configure
run: |
set -euo pipefail
BREW_PREFIX="$(brew --prefix)"
BOOST_PREFIX="$(brew --prefix boost)"
BDB_PREFIX="$(brew --prefix berkeley-db@4)"
OPENSSL_PREFIX="$(brew --prefix openssl@4)"
LIBEVENT_PREFIX="$(brew --prefix libevent)"
PROTOBUF_PREFIX="$(brew --prefix protobuf)"
QMAKE_BIN="$(command -v qmake6 || command -v qmake)"
QT_INCLUDE_DIR="$("$QMAKE_BIN" -query QT_INSTALL_HEADERS)"
QT_LIB_DIR="$("$QMAKE_BIN" -query QT_INSTALL_LIBS)"
QT_PLUGIN_DIR="$("$QMAKE_BIN" -query QT_INSTALL_PLUGINS)"
export CPPFLAGS="-I$PROTOBUF_PREFIX/include -I$BOOST_PREFIX/include -I$BDB_PREFIX/include -I$BREW_PREFIX/include ${CPPFLAGS:-}"
export LDFLAGS="-L$PROTOBUF_PREFIX/lib -L$BOOST_PREFIX/lib -L$BDB_PREFIX/lib -L$BREW_PREFIX/lib ${LDFLAGS:-}"
export PKG_CONFIG_PATH="$PROTOBUF_PREFIX/lib/pkgconfig:$QT_LIB_DIR/pkgconfig:$BOOST_PREFIX/lib/pkgconfig:$BDB_PREFIX/lib/pkgconfig:$BREW_PREFIX/lib/pkgconfig:$BREW_PREFIX/share/pkgconfig:${PKG_CONFIG_PATH:-}"
export CXXFLAGS="-std=c++17 -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -Wno-deprecated-builtins -Wno-deprecated-declarations"
export OBJCXXFLAGS="$CXXFLAGS"
export CFLAGS="-Wno-deprecated-builtins -Wno-deprecated-declarations"
./configure \
--disable-tests \
--disable-bench \
--disable-werror \
--with-gui=qt6 \
--with-qt-bindir="$PWD/.qt-tool-aliases" \
--with-qt-incdir="$QT_INCLUDE_DIR" \
--with-qt-libdir="$QT_LIB_DIR" \
--with-qt-plugindir="$QT_PLUGIN_DIR" \
--with-boost="$BOOST_PREFIX" \
--bindir="$(pwd)/release/bin" \
--libdir="$(pwd)/release/lib" \
--with-openssl-dir="$OPENSSL_PREFIX" \
--with-libevent-dir="$LIBEVENT_PREFIX"
- name: Build
run: make -j4
- name: Test verged daemon
run: |
VERGED_BIN="./src/verged"
CLI_BIN="./src/verge-cli"
if [ ! -f "$VERGED_BIN" ]; then
echo "::error::verged not found at $VERGED_BIN"
exit 1
fi
# Run daemon in background
"$VERGED_BIN" -daemon
# Give it a few seconds to start
sleep 5
# Verify it's running
if ! pgrep -f verged >/dev/null; then
echo "::error::verged failed to start"
exit 1
fi
# Query info with CLI
"$CLI_BIN" getinfo || true
# Stop the daemon
"$CLI_BIN" stop
- name: Test verge-qt directly
run: |
QT_BIN="./src/qt/verge-qt"
export DYLD_FRAMEWORK_PATH="$QT_PREFIX/lib:${DYLD_FRAMEWORK_PATH:-}"
export DYLD_LIBRARY_PATH="$QT_PREFIX/lib:${DYLD_LIBRARY_PATH:-}"
if [ ! -f "$QT_BIN" ]; then
echo "::error::verge-qt not found at $QT_BIN"
exit 1
fi
chmod +x "$QT_BIN"
echo "Launching verge-qt..."
"$QT_BIN" &
sleep 5
if ! pgrep -f verge-qt >/dev/null; then
echo "::error::verge-qt failed to start"
exit 1
fi
echo "verge-qt started successfully"
pkill verge-qt || true
- name: Upload verge-qt raw binary
uses: actions/upload-artifact@v4
with:
name: verge-qt-raw
path: src/qt/verge-qt
if-no-files-found: error
- name: Wrap binary into .app bundle
run: |
resolve_macho_binary() {
local candidate="$1"
if [ -f "$candidate" ] && file "$candidate" | grep -q 'Mach-O'; then
printf '%s\n' "$candidate"
return 0
fi
local libtool_candidate
libtool_candidate="$(find "$(dirname "$candidate")" -path "*/.libs/$(basename "$candidate")" -type f | head -n1)"
if [ -n "$libtool_candidate" ] && file "$libtool_candidate" | grep -q 'Mach-O'; then
printf '%s\n' "$libtool_candidate"
return 0
fi
return 1
}
BINARY="./src/qt/verge-qt"
if [ ! -f "$BINARY" ]; then
BINARY="$(find . -path '*/src/qt/verge-qt' -type f | head -n1)"
fi
if [ -z "$BINARY" ] || [ ! -f "$BINARY" ]; then
echo "::error::verge-qt binary not found after make"
exit 1
fi
MACHO_BINARY="$(resolve_macho_binary "$BINARY" || true)"
if [ -z "$MACHO_BINARY" ]; then
echo "::error::Unable to resolve a Mach-O verge-qt binary from $BINARY"
ls -la "$(dirname "$BINARY")" || true
file "$BINARY" || true
find "$(dirname "$BINARY")" -path '*/.libs/verge-qt' -type f -exec file {} \; || true
exit 1
fi
echo "Found verge-qt launcher at $BINARY"
echo "Using Mach-O binary at $MACHO_BINARY"
# Create .app bundle
APP_NAME="Verge-Qt.app"
mkdir -p "$APP_NAME/Contents/MacOS"
cp -fL "$MACHO_BINARY" "$APP_NAME/Contents/MacOS/verge-qt"
chmod +x "$APP_NAME/Contents/MacOS/verge-qt"
# Minimal Info.plist
echo '<?xml version="1.0" encoding="UTF-8"?>' > "$APP_NAME/Contents/Info.plist"
echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> "$APP_NAME/Contents/Info.plist"
echo '<plist version="1.0">' >> "$APP_NAME/Contents/Info.plist"
echo '<dict>' >> "$APP_NAME/Contents/Info.plist"
echo ' <key>CFBundleName</key>' >> "$APP_NAME/Contents/Info.plist"
echo ' <string>Verge</string>' >> "$APP_NAME/Contents/Info.plist"
echo ' <key>CFBundleIdentifier</key>' >> "$APP_NAME/Contents/Info.plist"
echo ' <string>org.vergefoundation.verge-qt</string>' >> "$APP_NAME/Contents/Info.plist"
echo ' <key>CFBundleVersion</key>' >> "$APP_NAME/Contents/Info.plist"
echo ' <string>1.0</string>' >> "$APP_NAME/Contents/Info.plist"
echo ' <key>CFBundleExecutable</key>' >> "$APP_NAME/Contents/Info.plist"
echo ' <string>verge-qt</string>' >> "$APP_NAME/Contents/Info.plist"
echo ' <key>CFBundlePackageType</key>' >> "$APP_NAME/Contents/Info.plist"
echo ' <string>APPL</string>' >> "$APP_NAME/Contents/Info.plist"
echo '</dict>' >> "$APP_NAME/Contents/Info.plist"
echo '</plist>' >> "$APP_NAME/Contents/Info.plist"
- name: Bundle with macdeployqt
run: |
APP_NAME="Verge-Qt.app"
macdeployqt "$APP_NAME" -verbose=2
- name: Bundle QtWebEngine helper frameworks
run: |
set -euo pipefail
APP_NAME="Verge-Qt.app"
APP_BIN="$APP_NAME/Contents/MacOS/verge-qt"
FRAMEWORKS_DIR="$APP_NAME/Contents/Frameworks"
HELPER_APP="$FRAMEWORKS_DIR/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app"
HELPER_BIN="$HELPER_APP/Contents/MacOS/QtWebEngineProcess"
if [ ! -x "$HELPER_BIN" ]; then
echo "::error::QtWebEngineProcess helper missing at $HELPER_BIN"
exit 1
fi
extract_framework_root() {
python3 -c 'import sys; path=sys.argv[1]; marker=".framework/"; idx=path.find(marker); print(path[:idx+len(".framework")] if idx >= 0 else "")' "$1"
}
framework_binary_name() {
python3 -c 'import os,sys; name=os.path.basename(sys.argv[1]); print(name[:-10] if name.endswith(".framework") else name)' "$1"
}
is_macho_binary() {
file "$1" 2>/dev/null | grep -Eq 'Mach-O'
}
is_homebrew_qt_framework_ref() {
case "$1" in
/opt/homebrew/*/Qt*.framework/*|/usr/local/*/Qt*.framework/*) return 0 ;;
*) return 1 ;;
esac
}
copy_qt_framework() {
local source_framework="$1"
local framework_name
framework_name="$(basename "$source_framework")"
local dest_framework="$FRAMEWORKS_DIR/$framework_name"
if [ -e "$dest_framework" ]; then
return 0
fi
if [ ! -d "$source_framework" ]; then
echo "::error::Missing Qt framework source: $source_framework"
exit 1
fi
cp -R "$source_framework" "$dest_framework"
chmod -R u+w "$dest_framework"
}
map_qt_refs() {
local binary="$1"
while read -r dep_path; do
[ -n "$dep_path" ] || continue
if ! is_homebrew_qt_framework_ref "$dep_path"; then
continue
fi
local framework_root
framework_root="$(extract_framework_root "$dep_path")"
if [ -z "$framework_root" ]; then
echo "::error::Could not determine framework root for $dep_path"
exit 1
fi
local framework_name
framework_name="$(basename "$framework_root")"
copy_qt_framework "$framework_root"
local framework_binary
framework_binary="$(framework_binary_name "$framework_name")"
local new_ref
new_ref="$(python3 -c 'import os,sys; binary=sys.argv[1]; target=sys.argv[2]; print("@loader_path/" + os.path.relpath(target, os.path.dirname(binary)).replace(os.sep, "/"))' "$binary" "$FRAMEWORKS_DIR/$framework_name/Versions/A/$framework_binary")"
install_name_tool -change "$dep_path" "$new_ref" "$binary"
done < <(otool -L "$binary" | awk 'NR > 1 { print $1 }')
}
map_bundle_framework_refs() {
local binary="$1"
while read -r dep_path; do
[ -n "$dep_path" ] || continue
case "$dep_path" in
@executable_path/../Frameworks/*)
local target_path=""
case "$dep_path" in
*@executable_path/../Frameworks/*.framework/*|@executable_path/../Frameworks/*.framework/*)
local framework_root
framework_root="$(extract_framework_root "$dep_path")"
[ -n "$framework_root" ] || continue
local framework_name
framework_name="$(basename "$framework_root")"
local framework_binary
framework_binary="$(framework_binary_name "$framework_name")"
target_path="$FRAMEWORKS_DIR/$framework_name/Versions/A/$framework_binary"
;;
*)
local dep_name
dep_name="$(basename "$dep_path")"
target_path="$FRAMEWORKS_DIR/$dep_name"
;;
esac
[ -e "$target_path" ] || continue
local new_ref
new_ref="$(python3 -c 'import os,sys; binary=sys.argv[1]; target=sys.argv[2]; print("@loader_path/" + os.path.relpath(target, os.path.dirname(binary)).replace(os.sep, "/"))' "$binary" "$target_path")"
install_name_tool -change "$dep_path" "$new_ref" "$binary"
;;
esac
done < <(otool -L "$binary" | awk 'NR > 1 { print $1 }')
}
map_qt_refs "$HELPER_BIN"
map_bundle_framework_refs "$HELPER_BIN"
while read -r bundled_bin; do
[ -n "$bundled_bin" ] || continue
is_macho_binary "$bundled_bin" || continue
map_qt_refs "$bundled_bin"
map_bundle_framework_refs "$bundled_bin"
done < <(find "$FRAMEWORKS_DIR" -type f)
add_rpath_if_missing() {
local binary="$1"
local rpath="$2"
if ! otool -l "$binary" | awk '
$1 == "cmd" && $2 == "LC_RPATH" { in_rpath=1; next }
in_rpath && $1 == "path" { print $2; in_rpath=0 }
' | grep -Fxq "$rpath"; then
install_name_tool -add_rpath "$rpath" "$binary"
fi
}
add_rpath_if_missing "$APP_BIN" "@executable_path/../Frameworks"
add_rpath_if_missing "$HELPER_BIN" "@executable_path/../../../../.."
if otool -L "$HELPER_BIN" | awk 'NR > 1 { print $1 }' | grep -Eq '^(/opt/homebrew|/usr/local)/.*Qt.*\.framework/'; then
echo "::error::QtWebEngineProcess still has Homebrew Qt framework references after bundling"
otool -L "$HELPER_BIN"
exit 1
fi
python3 - <<'PY'
import os
import re
import subprocess
import sys
frameworks_dir = os.path.join("Verge-Qt.app", "Contents", "Frameworks")
bad = []
pattern = re.compile(r'^@executable_path/\.\./Frameworks/')
for root, _, files in os.walk(frameworks_dir):
for name in files:
if "/Versions/A/" not in os.path.join(root, name).replace("\\", "/"):
continue
binary = os.path.join(root, name)
try:
file_output = subprocess.check_output(["file", binary], text=True)
except subprocess.CalledProcessError:
continue
if "Mach-O" not in file_output:
continue
try:
output = subprocess.check_output(["otool", "-L", binary], text=True)
except subprocess.CalledProcessError:
continue
lines = [line.strip() for line in output.splitlines()[1:]]
framework_name = None
if ".framework/Versions/A/" in binary:
framework_name = binary.split(".framework/Versions/A/")[0].split("/")[-1] + ".framework"
for line in lines:
dep = line.split(" ", 1)[0]
if not pattern.match(dep):
continue
if framework_name and dep == f"@executable_path/../Frameworks/{framework_name}/Versions/A/{name}":
continue
bad.append((binary, dep))
if bad:
print("::error::Bundled binaries still reference bundle deps via @executable_path")
for binary, dep in bad:
print(f"-- {binary}")
print(dep)
sys.exit(1)
PY
echo "QtWebEngine helper linkage:"
otool -L "$HELPER_BIN" | grep -E 'Qt(WebEngine|Qml|Quick|Core|Gui|Network|OpenGL)' || true
- name: Bundle transitive Boost dylibs
run: |
set -euo pipefail
APP_NAME="Verge-Qt.app"
APP_BIN="$APP_NAME/Contents/MacOS/verge-qt"
FRAMEWORKS_DIR="$APP_NAME/Contents/Frameworks"
BOOST_LIB_DIR="$(brew --prefix boost)/lib"
mkdir -p "$FRAMEWORKS_DIR"
shopt -s nullglob
rm -f "$FRAMEWORKS_DIR"/libboost_*.dylib
resolve_boost_source() {
local dep_name="$1"
local candidate
for candidate in \
"$BOOST_LIB_DIR/$dep_name" \
"$BOOST_LIB_DIR/$dep_name".*.dylib \
"$BOOST_LIB_DIR/$dep_name"-*.dylib
do
[ -e "$candidate" ] || continue
candidate="$(python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$candidate")"
[ -f "$candidate" ] || continue
if file "$candidate" | grep -q 'Mach-O'; then
printf '%s\n' "$candidate"
return 0
fi
done
{
echo "::error::Unable to locate Boost dependency $dep_name in $BOOST_LIB_DIR"
ls -la "$BOOST_LIB_DIR" | grep libboost || true
} >&2
exit 1
}
copy_boost_dep() {
local dep_name="$1"
local source target
source="$(resolve_boost_source "$dep_name")"
target="$FRAMEWORKS_DIR/$dep_name"
cp -fL "$source" "$target"
chmod u+w "$target"
if ! file "$target" | grep -q 'Mach-O'; then
echo "::error::Copied Boost library is not Mach-O: $target"
ls -l "$target" || true
file "$target" || true
exit 1
fi
install_name_tool -id "@loader_path/$dep_name" "$target"
}
collect_boost_names() {
local file="$1"
otool -L "$file" | awk 'NR > 1 && /libboost_[^[:space:]]+\.dylib/ { n=$1; sub(/^.*\//, "", n); sub(/:$/, "", n); print n }'
}
declare -a queue=()
SEEN_FILE="$RUNNER_TEMP/boost-seen-$$.txt"
: > "$SEEN_FILE"
while read -r dep_name; do
[ -n "$dep_name" ] || continue
if ! grep -Fxq "$dep_name" "$SEEN_FILE"; then
printf '%s\n' "$dep_name" >> "$SEEN_FILE"
queue+=("$dep_name")
fi
done < <(collect_boost_names "$APP_BIN")
if [ "${#queue[@]}" -eq 0 ]; then
echo "::error::No Boost dylibs referenced by $APP_BIN"
otool -L "$APP_BIN" || true
exit 1
fi
index=0
while [ "$index" -lt "${#queue[@]}" ]; do
dep_name="${queue[$index]}"
copy_boost_dep "$dep_name"
while read -r child_name; do
[ -n "$child_name" ] || continue
if ! grep -Fxq "$child_name" "$SEEN_FILE"; then
printf '%s\n' "$child_name" >> "$SEEN_FILE"
queue+=("$child_name")
fi
done < <(collect_boost_names "$FRAMEWORKS_DIR/$dep_name")
index=$((index + 1))
done
rm -f "$SEEN_FILE"
while read -r dep_path; do
[ -n "$dep_path" ] || continue
dep_name="$(basename "$dep_path")"
install_name_tool -change "$dep_path" "@executable_path/../Frameworks/$dep_name" "$APP_BIN" || true
done < <(otool -L "$APP_BIN" | awk '/libboost_[^[:space:]]+\.dylib/ { print $1 }')
for lib in "$FRAMEWORKS_DIR"/libboost_*.dylib; do
while read -r dep_path; do
[ -n "$dep_path" ] || continue
dep_name="$(basename "$dep_path")"
install_name_tool -change "$dep_path" "@loader_path/$dep_name" "$lib" || true
done < <(otool -L "$lib" | awk '/libboost_[^[:space:]]+\.dylib/ { print $1 }')
done
for file in "$APP_BIN" "$FRAMEWORKS_DIR"/libboost_*.dylib; do
echo "Boost linkage for $file"
otool -L "$file" | grep -E 'libboost_|verge-qt' || true
done
- name: Bundle locally built dylibs
run: |
set -euo pipefail
APP_NAME="Verge-Qt.app"
APP_BIN="$APP_NAME/Contents/MacOS/verge-qt"
FRAMEWORKS_DIR="$APP_NAME/Contents/Frameworks"
WORKSPACE_ROOT="$(pwd)"
mkdir -p "$FRAMEWORKS_DIR"
collect_local_dep_paths() {
local file="$1"
otool -L "$file" | awk 'NR > 1 { print $1 }' | while read -r dep_path; do
[ -n "$dep_path" ] || continue
case "$dep_path" in
"$WORKSPACE_ROOT"/*.dylib)
printf '%s\n' "$dep_path"
;;
esac
done
}
resolve_local_dep_source() {
local source="$1"
local resolved dep_name candidate
if [ -e "$source" ]; then
resolved="$(python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$source")"
if [ -f "$resolved" ] && file "$resolved" | grep -q 'Mach-O'; then
printf '%s\n' "$resolved"
return 0
fi
fi
dep_name="$(basename "$source")"
while read -r candidate; do
[ -n "$candidate" ] || continue
resolved="$(python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$candidate")"
if [ -f "$resolved" ] && file "$resolved" | grep -q 'Mach-O'; then
printf '%s\n' "$resolved"
return 0
fi
done < <(find "$WORKSPACE_ROOT" \( -path "*/.libs/$dep_name" -o -path "*/$dep_name" \) \( -type f -o -type l \) 2>/dev/null)
return 1
}
copy_local_dep() {
local source="$1"
local dep_name target
source="$(resolve_local_dep_source "$source" || true)"
if [ -z "$source" ] || [ ! -f "$source" ]; then
echo "::error::Missing local dylib dependency at $source"
exit 1
fi
dep_name="$(basename "$source")"
target="$FRAMEWORKS_DIR/$dep_name"
cp -fL "$source" "$target"
chmod u+w "$target"
if ! file "$target" | grep -q 'Mach-O'; then
echo "::error::Copied local dependency is not Mach-O: $target"
ls -l "$target" || true
file "$target" || true
exit 1
fi
install_name_tool -id "@loader_path/$dep_name" "$target"
}
declare -a queue=()
SEEN_FILE="$RUNNER_TEMP/local-dylib-seen-$$.txt"
: > "$SEEN_FILE"
while read -r dep_path; do
[ -n "$dep_path" ] || continue
dep_path="$(python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$dep_path")"
if ! grep -Fxq "$dep_path" "$SEEN_FILE"; then
printf '%s\n' "$dep_path" >> "$SEEN_FILE"
queue+=("$dep_path")
fi
done < <(collect_local_dep_paths "$APP_BIN")
index=0
while [ "$index" -lt "${#queue[@]}" ]; do
dep_path="${queue[$index]}"
dep_name="$(basename "$dep_path")"
copy_local_dep "$dep_path"
while read -r child_path; do
[ -n "$child_path" ] || continue
child_path="$(python3 -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$child_path")"
if ! grep -Fxq "$child_path" "$SEEN_FILE"; then
printf '%s\n' "$child_path" >> "$SEEN_FILE"
queue+=("$child_path")
fi
done < <(collect_local_dep_paths "$FRAMEWORKS_DIR/$dep_name")
index=$((index + 1))
done
rm -f "$SEEN_FILE"
while read -r dep_path; do
[ -n "$dep_path" ] || continue
dep_name="$(basename "$dep_path")"
install_name_tool -change "$dep_path" "@executable_path/../Frameworks/$dep_name" "$APP_BIN" || true
done < <(collect_local_dep_paths "$APP_BIN")
shopt -s nullglob
for lib in "$FRAMEWORKS_DIR"/*.dylib; do
while read -r dep_path; do
[ -n "$dep_path" ] || continue
dep_name="$(basename "$dep_path")"
install_name_tool -change "$dep_path" "@loader_path/$dep_name" "$lib" || true
done < <(collect_local_dep_paths "$lib")
done
for file in "$APP_BIN" "$FRAMEWORKS_DIR"/*.dylib; do
[ -e "$file" ] || continue
echo "Local dylib linkage for $file"
otool -L "$file" | grep -E 'libunivalue|verge-qt' || true
done
- name: Remove quarantine
run: find . -name "*.app" -type d -exec xattr -cr {} +
- name: Import Apple signing certificate
env:
MACOS_CERT_P12_BASE64: ${{ secrets.MACOS_CERT_P12_BASE64 }}
MACOS_CERT_P12_PASSWORD: ${{ secrets.MACOS_CERT_P12_PASSWORD }}
run: |
set -euo pipefail
CERT_PATH="$RUNNER_TEMP/macos-cert.p12"
KEYCHAIN_PATH="$RUNNER_TEMP/signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -base64 24)"
echo -n "$MACOS_CERT_P12_BASE64" | base64 --decode > "$CERT_PATH"
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security import "$CERT_PATH" -k "$KEYCHAIN_PATH" -P "$MACOS_CERT_P12_PASSWORD" -T /usr/bin/codesign -T /usr/bin/security
security list-keychains -d user -s "$KEYCHAIN_PATH" $(security list-keychains -d user | tr -d '"')
security default-keychain -d user -s "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
SIGNING_IDENTITY="$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | awk -F '\"' '/Developer ID Application:/ { print $2; exit }')"
if [ -z "$SIGNING_IDENTITY" ]; then
echo "::error::No Developer ID Application identity found in imported certificate."
security find-identity -v -p codesigning "$KEYCHAIN_PATH" || true
exit 1
fi
echo "MACOS_KEYCHAIN_PATH=$KEYCHAIN_PATH" >> "$GITHUB_ENV"
echo "MACOS_SIGNING_IDENTITY=$SIGNING_IDENTITY" >> "$GITHUB_ENV"
- name: Codesign app
env:
MACOS_SIGNING_IDENTITY: ${{ env.MACOS_SIGNING_IDENTITY }}
MACOS_KEYCHAIN_PATH: ${{ env.MACOS_KEYCHAIN_PATH }}
run: |
set -euo pipefail
ENTITLEMENTS="$GITHUB_WORKSPACE/contrib/macdeploy/qtwebengine.entitlements"
echo "Signing app with Developer ID identity: $MACOS_SIGNING_IDENTITY"
sign_file() {
local target="$1"
shift
echo "Signing file: $target"
codesign --force --options runtime --timestamp \
--keychain "$MACOS_KEYCHAIN_PATH" \
--sign "$MACOS_SIGNING_IDENTITY" "$@" "$target"
}
find "Verge-Qt.app" -type f \( \
-name "*.dylib" -o \
-path "*/Contents/MacOS/*" \
\) ! -path "*/_CodeSignature/*" | sort | while read -r TARGET; do
case "$TARGET" in
*/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess|*/Contents/MacOS/verge-qt)
sign_file "$TARGET" --entitlements "$ENTITLEMENTS"
;;
*)
sign_file "$TARGET"
;;
esac
done
find "Verge-Qt.app" -depth \( \
-type d -name "*.framework" -o \
-type d -name "*.app" \
\) | while read -r BUNDLE; do
case "$BUNDLE" in
"Verge-Qt.app")
;;
*)
echo "Signing bundle: $BUNDLE"
codesign --force --options runtime --timestamp \
--keychain "$MACOS_KEYCHAIN_PATH" \
--sign "$MACOS_SIGNING_IDENTITY" "$BUNDLE"
;;
esac
done
codesign --force --options runtime --timestamp \
--keychain "$MACOS_KEYCHAIN_PATH" \
--sign "$MACOS_SIGNING_IDENTITY" "Verge-Qt.app"
- name: Create DMG
run: hdiutil create Verge-Qt.dmg -srcfolder "Verge-Qt.app" -ov -format UDZO
- name: Sign DMG
env:
MACOS_SIGNING_IDENTITY: ${{ env.MACOS_SIGNING_IDENTITY }}
MACOS_KEYCHAIN_PATH: ${{ env.MACOS_KEYCHAIN_PATH }}
run: |
set -euo pipefail
codesign --force --timestamp \
--keychain "$MACOS_KEYCHAIN_PATH" \
--sign "$MACOS_SIGNING_IDENTITY" "Verge-Qt.dmg"
- name: Test app launch from DMG
run: |
set -euo pipefail
# Ensure previous UI tests don't leave verge-qt running.
pkill -f '/verge-qt' || true
MOUNT_OUTPUT="$(hdiutil attach "Verge-Qt.dmg" -nobrowse -readonly)"
MOUNT_DEVICE="$(echo "$MOUNT_OUTPUT" | awk '/^\/dev\// {print $1; exit}')"
MOUNT_POINT="$(echo "$MOUNT_OUTPUT" | awk '/\/Volumes\// {print substr($0, index($0, "/Volumes/")); exit}')"
if [ -z "${MOUNT_POINT:-}" ] || [ -z "${MOUNT_DEVICE:-}" ]; then
echo "::error::Failed to detect DMG mount point"
echo "$MOUNT_OUTPUT"
exit 1
fi
detach_with_timeout() {
local target="$1"
hdiutil detach "$target" -force >/dev/null 2>&1 &
local detach_pid=$!
local waited=0
while kill -0 "$detach_pid" 2>/dev/null; do
if [ "$waited" -ge 20 ]; then
echo "::warning::Timed out detaching $target; continuing"
kill -9 "$detach_pid" 2>/dev/null || true
return 0
fi
sleep 1
waited=$((waited + 1))
done
wait "$detach_pid" || true
}
cleanup() {
# Stop any app instance launched from the mounted DMG.
pkill -f "$MOUNT_POINT/Verge-Qt.app/Contents/MacOS/verge-qt" || true
pkill -f '/verge-qt' || true
pkill -9 -f '/verge-qt' || true
sleep 1
detach_with_timeout "$MOUNT_DEVICE"
}
trap cleanup EXIT
APP_BIN="$MOUNT_POINT/Verge-Qt.app/Contents/MacOS/verge-qt"
APP_FRAMEWORKS="$MOUNT_POINT/Verge-Qt.app/Contents/Frameworks"
if [ ! -x "$APP_BIN" ]; then
echo "::error::App binary not found in DMG at $APP_BIN"
ls -la "$MOUNT_POINT"
exit 1
fi
DYLD_FRAMEWORK_PATH="$APP_FRAMEWORKS:${DYLD_FRAMEWORK_PATH:-}" \
DYLD_LIBRARY_PATH="$APP_FRAMEWORKS:${DYLD_LIBRARY_PATH:-}" \
"$APP_BIN" &
APP_PID=$!
sleep 8
if ! kill -0 "$APP_PID" 2>/dev/null; then
echo "::error::verge-qt failed to stay running from mounted DMG"
wait "$APP_PID" || true
exit 1
fi
kill "$APP_PID" || true
sleep 2
kill -9 "$APP_PID" 2>/dev/null || true
pkill -f '/verge-qt' || true
wait "$APP_PID" || true
- name: Gatekeeper check (informational)
run: |
set +e
spctl --assess --type open --verbose Verge-Qt.dmg
status=$?
if [ "$status" -ne 0 ]; then
echo "::warning::Gatekeeper rejected Verge-Qt.dmg (expected in CI for ad-hoc/non-notarized artifacts)."
fi
exit 0
- uses: actions/upload-artifact@v4
with:
name: verge-macos26-raw
path: Verge-Qt.dmg
if-no-files-found: error
macos14:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: git config credential.helper
run: git config credential.helper
- name: Brew install base dependencies
run: |
# A workaround for "The `brew link` step did not complete successfully" error.
brew install --quiet python@3 || brew link --overwrite python@3
brew install --quiet automake autoconf berkeley-db@4 pkg-config miniupnpc zeromq libtool boost gperf qrencode librsvg openssl@4 libevent protobuf
- name: Brew link dependencies
run: brew link berkeley-db@4 boost
- name: Install Qt 6.10.2 for macOS
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/aqt-venv"
source "$RUNNER_TEMP/aqt-venv/bin/activate"
python -m pip install --upgrade pip aqtinstall
QT_ROOT="$RUNNER_TEMP/qt"
python -m aqt install-qt mac desktop 6.10.2 clang_64 \
--outputdir "$QT_ROOT" \
-m qtwebengine qtwebchannel qtpositioning qt5compat
QMAKE_PATH="$(find "$QT_ROOT" -type f \( -name qmake6 -o -name qmake \) -path "*/bin/*" | head -n1 || true)"
if [ -z "${QMAKE_PATH:-}" ]; then
echo "ERROR: Failed to resolve qmake under $QT_ROOT"
find "$QT_ROOT" -maxdepth 5 -type d | sed -n '1,200p'
exit 1
fi
QT_PREFIX="$(dirname "$(dirname "$QMAKE_PATH")")"
echo "QT_PREFIX=$QT_PREFIX" >> "$GITHUB_ENV"
echo "Installed Qt prefix: $QT_PREFIX"
- name: check cellar for openssl
run: cd /opt/homebrew/Cellar/openssl@4/ && ls
- name: which clang/xcode
run: clang --version
- name: Add Qt tools to PATH
run: |
echo "$QT_PREFIX/bin" >> "$GITHUB_PATH"
echo "$QT_PREFIX/libexec" >> "$GITHUB_PATH"
- name: Resolve Qt host tools
run: |
set -euo pipefail
ALIAS_DIR="$PWD/.qt-tool-aliases"
mkdir -p "$ALIAS_DIR"
declare -a QT_TOOL_DIRS=(
"$QT_PREFIX/libexec"
"$QT_PREFIX/bin"
)
QMAKE_BIN="$(command -v qmake6 || command -v qmake || true)"
if [ -n "$QMAKE_BIN" ]; then
for qdir in \
"$("$QMAKE_BIN" -query QT_HOST_BINS 2>/dev/null || true)" \
"$("$QMAKE_BIN" -query QT_INSTALL_BINS 2>/dev/null || true)" \
"$("$QMAKE_BIN" -query QT_HOST_LIBEXECS 2>/dev/null || true)" \
"$("$QMAKE_BIN" -query QT_INSTALL_LIBEXECS 2>/dev/null || true)"
do
if [ -n "$qdir" ]; then
QT_TOOL_DIRS+=("$qdir")
fi
done
fi
find_qt_tool() {
local base="$1"
shift || true
local names=("$base" "${base}6" "${base}-qt6")
local d n cand
for d in "${QT_TOOL_DIRS[@]}"; do
[ -d "$d" ] || continue
for n in "${names[@]}"; do
cand="$d/$n"
if [ -x "$cand" ]; then
echo "$cand"
return 0
fi
done
done
return 1
}
MOC_REAL="$(find_qt_tool moc || true)"
UIC_REAL="$(find_qt_tool uic || true)"
RCC_REAL="$(find_qt_tool rcc || true)"
if [ -z "$MOC_REAL" ] || [ -z "$UIC_REAL" ] || [ -z "$RCC_REAL" ]; then
echo "ERROR: Could not resolve Qt host tools."
echo "QMAKE_BIN=${QMAKE_BIN:-<none>}"
echo "QT tool dirs searched:"
printf ' - %s\n' "${QT_TOOL_DIRS[@]}"
echo "Listing candidate dirs:"