Repository navigation
847 lines (733 loc) · 32.2 KB
/
Copy pathcmake.yml
File metadata and controls
847 lines (733 loc) · 32.2 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
name: Build CANgaroo
on:
workflow_dispatch: # enables manual trigger
push:
branches: [ "main", "master" ]
# A version tag (V0.7.2, as the existing tags, or v0.7.2) also publishes a
# draft release with the DEB, RPM, AppImage, Windows zip and manual PDF, see "release" below.
tags: [ "V*", "v*" ]
pull_request:
branches: [ "main", "master" ]
jobs:
unit-tests:
name: Unit tests (Qt Test)
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt update
# The tests link individual source files rather than the whole app, so
# QtCore, QtXml (CanDb) and Qt Test are enough -- no charts/serialbus.
# python3-dev + pybind11-dev: python_engine embeds the interpreter.
sudo apt install -y build-essential qt6-base-dev pkg-config python3-dev pybind11-dev
- name: Build and run tests
run: |
cd tests
qmake6
make -j$(nproc)
# "check" is provided by qmake's testcase config and runs every binary.
make check
format-compat:
name: Trace format compatibility (python-can, scapy, asammdf)
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y build-essential qt6-base-dev python3-venv
- name: Install reference readers
run: |
python3 -m venv .venv
.venv/bin/pip install -r tests/format_compat/requirements.txt
- name: Build sample writer
run: |
cd tests/format_compat
qmake6
make -j$(nproc)
- name: Write samples and read them back
run: |
# Every export format and split recorder output, checked by readers that
# share no code with cangaroo. See tests/format_compat/validate.py.
build/tests/trace_format_samples build/format_compat
.venv/bin/python tests/format_compat/validate.py build/format_compat
build-ubuntu:
name: Build CANgaroo DEB (Ubuntu ${{ matrix.ubuntu }} / Qt6)
runs-on: ubuntu-24.04
# The program links the libpython of the system it is built on (Ubuntu's
# Python is another version on each release), so there is one .deb per
# Ubuntu release, each built on that release.
container: ubuntu:${{ matrix.ubuntu }}
# The steps are written for bash; a container's default shell is sh (dash on Ubuntu)
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ubuntu: ["24.04", "26.04"]
env:
# Kvaser linuxcan version — update here when a newer SDK is released.
KVASER_VERSION: "5.51.461"
steps:
# A bare container: no sudo (the steps below use it), git, wget or certificates
- name: Install base tools
run: |
apt-get update
apt-get install -y sudo ca-certificates git wget
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake pkg-config python3-dev \
qt6-base-dev qt6-base-private-dev qt6-tools-dev \
qt6-serialport-dev qt6-serialbus-dev qt6-charts-dev qt6-svg-dev \
pybind11-dev libnl-3-dev libnl-route-3-dev libusb-1.0-0-dev libgl1-mesa-dev
- name: Verify Qt6
run: |
qmake6 --version
pkg-config --modversion python3-embed
- name: Install Kvaser CANlib (Linux)
run: |
VER_US="${{ env.KVASER_VERSION }}"
VER_US="${VER_US//./_}"
wget -q "https://pim.kvaser.com/var/assets/Product_Resources/7330130980754/${{ env.KVASER_VERSION }}/linuxcan_${VER_US}.tar.gz" \
-O /tmp/linuxcan.tar.gz
mkdir -p /tmp/linuxcan
tar -xf /tmp/linuxcan.tar.gz -C /tmp/linuxcan --strip-components=1
# Build only the userspace canlib — no kernel modules required
make -C /tmp/linuxcan/canlib
sudo make -C /tmp/linuxcan/canlib install
sudo ldconfig
- name: Run qmake6 and make
run: |
qmake6 CONFIG+=kvaser
make -j$(nproc)
- name: Build DEB package
run: |
PKG_NAME=cangaroo
PKG_VERSION=$(grep '^VERSION' src/src.pro | sed 's/VERSION\s*=\s*//')
PKG_ARCH=amd64
UBUNTU="${{ matrix.ubuntu }}"
DEB_DIR="${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH}"
DEB_FILE="${PKG_NAME}_${PKG_VERSION}_ubuntu${UBUNTU}_${PKG_ARCH}.deb"
mkdir -p "${DEB_DIR}/DEBIAN"
mkdir -p "${DEB_DIR}/usr/bin"
mkdir -p "${DEB_DIR}/usr/share/applications"
mkdir -p "${DEB_DIR}/usr/share/icons/hicolor/256x256/apps"
mkdir -p "${DEB_DIR}/usr/share/polkit-1/rules.d"
cp bin/cangaroo "${DEB_DIR}/usr/bin/"
chmod 755 "${DEB_DIR}/usr/bin/cangaroo"
cp cangaroo.desktop "${DEB_DIR}/usr/share/applications/"
cp src/assets/cangaroo.png "${DEB_DIR}/usr/share/icons/hicolor/256x256/apps/"
cp packaging/10-cangaroo-socketcan.rules "${DEB_DIR}/usr/share/polkit-1/rules.d/"
# Bundle libcanlib (built from Kvaser linuxcan source above)
mkdir -p "${DEB_DIR}/usr/lib/x86_64-linux-gnu"
find /usr/lib /usr/local/lib -maxdepth 2 -name "libcanlib*.so*" 2>/dev/null | while IFS= read -r f; do
cp -Pv "$f" "${DEB_DIR}/usr/lib/x86_64-linux-gnu/"
done
# preinst: enable universe so apt can resolve libqt6serialbus6 / libqt6charts6
{
printf '#!/bin/sh\nset -e\n'
printf 'if command -v add-apt-repository >/dev/null 2>&1; then\n'
printf ' add-apt-repository -y universe 2>/dev/null || true\n'
printf ' apt-get update -qq 2>/dev/null || true\n'
printf 'fi\n'
} > "${DEB_DIR}/DEBIAN/preinst"
chmod 755 "${DEB_DIR}/DEBIAN/preinst"
printf '#!/bin/sh\nset -e\nldconfig\n' > "${DEB_DIR}/DEBIAN/postinst"
chmod 755 "${DEB_DIR}/DEBIAN/postinst"
# Library dependencies from the binary itself (dpkg-shlibdeps, from
# dpkg-dev), so they follow what the build links. It reads a
# debian/control in the current folder; only a stub is needed.
# libcanlib is built above and bundled, no package provides it.
mkdir debian
printf 'Source: cangaroo\n\nPackage: cangaroo\nArchitecture: any\n' > debian/control
SHLIBS=$(dpkg-shlibdeps -O --ignore-missing-info \
-l"${DEB_DIR}/usr/lib/x86_64-linux-gnu" \
"${DEB_DIR}/usr/bin/cangaroo" | sed -n 's/^shlibs:Depends=//p')
rm -rf debian
echo "Detected dependencies: ${SHLIBS}"
[ -n "${SHLIBS}" ] || { echo "::error::dpkg-shlibdeps found no dependencies"; exit 1; }
cat > "${DEB_DIR}/DEBIAN/control" << EOF
Package: ${PKG_NAME}
Version: ${PKG_VERSION}
Section: utils
Priority: optional
Architecture: ${PKG_ARCH}
Depends: ${SHLIBS}, polkitd | policykit-1, pkexec | policykit-1, iproute2
Maintainer: Schildkroet <https://github.com/Schildkroet>
Description: CAN bus analyzer and visualization tool
CANgaroo is an open-source CAN bus analyzer with support for
SocketCAN interfaces, DBC file parsing, trace recording,
and Python scripting.
EOF
# Remove leading whitespace from control file (heredoc indentation)
sed -i 's/^ //' "${DEB_DIR}/DEBIAN/control"
dpkg-deb --build --root-owner-group "${DEB_DIR}" "${DEB_FILE}"
# A single file, uploaded as it is (archive: false), so the release can
# attach it directly. The artifact is named after the file, which carries
# the Ubuntu release: the release job finds the .debs by that name.
- name: Upload DEB package
uses: actions/upload-artifact@v7
with:
path: "cangaroo_*_ubuntu${{ matrix.ubuntu }}_amd64.deb"
archive: false
if-no-files-found: error
# The RPM for Fedora, built on each supported release for the same reason as
# the .deb: the program links that release's libpython and Qt. Requires: come
# from rpm's own scan of the binary (packaging/cangaroo.spec).
build-fedora:
name: Build CANgaroo RPM (Fedora ${{ matrix.fedora }} / Qt6)
runs-on: ubuntu-24.04
container: fedora:${{ matrix.fedora }}
# The steps are written for bash; a container's default shell is sh (dash on Ubuntu)
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
fedora: ["44", "45"]
env:
# Kvaser linuxcan version, keep in sync with the DEB job above.
KVASER_VERSION: "5.51.461"
steps:
- name: Install base tools
run: dnf install -y git wget tar gzip sudo
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies
run: |
dnf install -y gcc-c++ make pkgconf-pkg-config rpm-build \
qt6-qtbase-devel qt6-qtbase-private-devel qt6-qttools-devel \
qt6-qtserialport-devel qt6-qtserialbus-devel qt6-qtcharts-devel qt6-qtsvg-devel \
python3-devel pybind11-devel libnl3-devel libusb1-devel mesa-libGL-devel libbsd-devel
- name: Verify Qt6
run: |
qmake6 --version
pkg-config --modversion python3-embed
- name: Install Kvaser CANlib (Linux)
run: |
VER_US="${{ env.KVASER_VERSION }}"
VER_US="${VER_US//./_}"
wget -q "https://pim.kvaser.com/var/assets/Product_Resources/7330130980754/${{ env.KVASER_VERSION }}/linuxcan_${VER_US}.tar.gz" \
-O /tmp/linuxcan.tar.gz
mkdir -p /tmp/linuxcan
tar -xf /tmp/linuxcan.tar.gz -C /tmp/linuxcan --strip-components=1
# Build only the userspace canlib, no kernel modules required
make -C /tmp/linuxcan/canlib
make -C /tmp/linuxcan/canlib install
- name: Run qmake6 and make
run: |
# canlib lands in /usr/lib, which is not on a Fedora linker's default path
export LIBRARY_PATH=/usr/lib:/usr/local/lib
qmake6 CONFIG+=kvaser
make -j$(nproc)
- name: Build RPM package
run: |
VERSION=$(grep '^VERSION' src/src.pro | sed 's/VERSION\s*=\s*//')
rpmbuild -bb packaging/cangaroo.spec \
--define "_topdir ${PWD}/rpmbuild" \
--define "cg_version ${VERSION}" \
--define "cg_srcroot ${PWD}"
cp rpmbuild/RPMS/*/cangaroo-*.rpm .
ls -l cangaroo-*.rpm
echo "Requires:"; rpm -qp --requires cangaroo-*.rpm
# Uploaded as it is (archive: false), named after the file, which carries
# the Fedora release: the release job finds the .rpms by that name.
- name: Upload RPM package
uses: actions/upload-artifact@v7
with:
path: "cangaroo-*.fc${{ matrix.fedora }}.x86_64.rpm"
archive: false
if-no-files-found: error
# The user manual (docs/manual.tex) as a PDF for the release
build-manual:
name: Build manual (PDF)
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install LaTeX
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
texlive-latex-base texlive-latex-recommended texlive-latex-extra \
texlive-fonts-recommended texlive-pictures lmodern
# Twice: the table of contents and the references need a second pass
- name: Build manual.pdf
run: |
mkdir -p docs/build
cd docs
for pass in 1 2; do
pdflatex -interaction=nonstopmode -halt-on-error -output-directory=build manual.tex
done
# Named after VERSION in src/src.pro, like the other release files; uploaded
# as it is (archive: false)
- name: Name the PDF after the version
run: |
VERSION=$(grep '^VERSION' src/src.pro | sed 's/VERSION\s*=\s*//')
cp docs/build/manual.pdf "cangaroo-${VERSION}-manual.pdf"
- name: Upload manual
uses: actions/upload-artifact@v7
with:
path: "cangaroo-*-manual.pdf"
archive: false
if-no-files-found: error
build-appimage:
name: Build CANgaroo AppImage (Qt 6.8 + Adwaita decorations)
runs-on: ubuntu-24.04
outputs:
artifact_id: ${{ steps.upload.outputs.artifact-id }}
env:
# Kvaser linuxcan version — keep in sync with the DEB job above.
KVASER_VERSION: "5.51.461"
# Qt version used for the AppImage. Must be >= 6.5 (QAdwaitaDecorations
# requirement). Newer than the distro Qt so we can bundle a native
# Adwaita Wayland decoration that matches the bundled Qt's private API.
QT_VERSION: "6.8.2"
# QAdwaitaDecorations release to build from source.
QADWAITA_VERSION: "0.1.7"
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install system build dependencies
run: |
sudo apt update
# Qt itself comes from aqt (see next step). These are the non-Qt build
# deps plus the Adwaita QStyle (forward-compatible: a 6.4 style plugin
# loads under the bundled 6.8) and Wayland dev libs for the decoration.
sudo apt install -y build-essential git cmake ninja-build pkg-config \
libnl-3-dev libnl-route-3-dev libusb-1.0-0-dev libgl1-mesa-dev pybind11-dev \
libwayland-dev wayland-protocols libxkbcommon-dev \
adwaita-qt6 libadwaitaqt6-1 \
fuse libfuse2 wget patchelf
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
host: linux
target: desktop
arch: linux_gcc_64
# qtwayland is NOT a separate aqt module — it ships in the base install
# for linux_gcc_64 (incl. the QtWaylandClient private headers the
# decoration plugin needs and the wayland platform plugin), so only the
# genuine add-on modules are listed here.
modules: 'qtcharts qtserialport qtserialbus'
cache: true
- name: Show Qt environment
run: |
qmake -query QT_VERSION
qmake -query QT_INSTALL_PREFIX
qmake -query QT_INSTALL_PLUGINS
- name: Install Kvaser CANlib (Linux)
run: |
VER_US="${{ env.KVASER_VERSION }}"
VER_US="${VER_US//./_}"
wget -q "https://pim.kvaser.com/var/assets/Product_Resources/7330130980754/${{ env.KVASER_VERSION }}/linuxcan_${VER_US}.tar.gz" \
-O /tmp/linuxcan.tar.gz
mkdir -p /tmp/linuxcan
tar -xf /tmp/linuxcan.tar.gz -C /tmp/linuxcan --strip-components=1
make -C /tmp/linuxcan/canlib
sudo make -C /tmp/linuxcan/canlib install
sudo ldconfig
- name: Build CANgaroo (Qt ${{ env.QT_VERSION }})
run: |
qmake CONFIG+=kvaser
make -j$(nproc)
- name: Build QAdwaitaDecorations (Wayland decoration plugin)
run: |
git clone --depth 1 --branch "${QADWAITA_VERSION}" \
https://github.com/FedoraQt/QAdwaitaDecorations.git /tmp/qadwaita
cmake -S /tmp/qadwaita -B /tmp/qadwaita/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DUSE_QT6=ON
cmake --build /tmp/qadwaita/build
echo "=== built decoration plugin(s) ==="
find /tmp/qadwaita/build -name '*.so'
- name: Prepare AppDir
run: |
mkdir -p AppDir/usr/bin \
AppDir/usr/share/applications \
AppDir/usr/share/icons/hicolor/256x256/apps \
AppDir/usr/plugins/styles \
AppDir/usr/plugins/wayland-decoration-client \
AppDir/usr/lib
sed -i 's|Exec=/usr/bin/cangaroo %f|Exec=cangaroo %f|' cangaroo.desktop
cp bin/cangaroo AppDir/usr/bin/
cp cangaroo.desktop AppDir/usr/share/applications/
cp src/assets/cangaroo.png AppDir/usr/share/icons/hicolor/256x256/apps/
- name: Bundle Python runtime
run: |
# The libpython we linked against gets bundled by linuxdeploy, but its
# compiled-in prefix points at this runner's Python installation. Ship
# the matching stdlib under AppDir/usr/lib/pythonX.Y so PythonEngine
# can point PYTHONHOME at the AppDir instead of relying on the host
# happening to have the very same Python version installed.
PY_PREFIX=$(pkg-config --variable=prefix python3-embed)
PYVER=$(pkg-config --modversion python3-embed | cut -d. -f1,2)
echo "linked against Python ${PYVER} in ${PY_PREFIX}"
SRC="${PY_PREFIX}/lib/python${PYVER}"
test -f "${SRC}/os.py" || { echo "ERROR: stdlib not found at ${SRC}"; exit 1; }
DST="AppDir/usr/lib/python${PYVER}"
mkdir -p "${DST}"
cp -r "${SRC}"/. "${DST}"/
# Trim what the embedded interpreter never needs.
rm -rf "${DST}/test" "${DST}/idlelib" "${DST}/tkinter" "${DST}/turtledemo"
find "${DST}" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find "${DST}" -type d -name tests -exec rm -rf {} + 2>/dev/null || true
# pybind11 needs the encodings codec at startup; lib-dynload carries the
# C extension modules (_socket, zlib, ...) and must come along.
test -f "${DST}/encodings/__init__.py"
ls "${DST}/lib-dynload" >/dev/null
- name: Bundle Adwaita style and decoration plugin
run: |
DISTRO_PLUGINS=/usr/lib/x86_64-linux-gnu/qt6/plugins
echo "=== Adwaita QStyle (from distro adwaita-qt6) ==="
if [ -f "$DISTRO_PLUGINS/styles/adwaita.so" ]; then
cp -v "$DISTRO_PLUGINS/styles/adwaita.so" AppDir/usr/plugins/styles/
else
echo "ERROR: Adwaita style not found"; exit 1
fi
for lib in /usr/lib/x86_64-linux-gnu/libadwaitaqt6*.so*; do
[ -f "$lib" ] && cp -Pv "$lib" AppDir/usr/lib/
done
# The distro plugin has no RUNPATH and AppRun is a plain symlink to the
# binary (no LD_LIBRARY_PATH), so without this the loader looks for
# libadwaitaqt6*.so.1 in the system paths only: the style silently fails
# to load on any host that does not happen to have adwaita-qt6
# installed, and "adwaita"/"adwaita-dark" disappear from the theme list.
# linuxdeploy only rewrites usr/lib and usr/bin, not usr/plugins.
patchelf --set-rpath '$ORIGIN/../../lib' AppDir/usr/plugins/styles/adwaita.so
readelf -d AppDir/usr/plugins/styles/adwaita.so | grep -E 'RPATH|RUNPATH'
echo "=== Adwaita Wayland decoration (built against bundled Qt) ==="
DECO_SO=$(find /tmp/qadwaita/build -name '*adwaita*.so' | head -n1)
if [ -z "$DECO_SO" ]; then
DECO_SO=$(find /tmp/qadwaita/build -name '*.so' | head -n1)
fi
if [ -n "$DECO_SO" ]; then
cp -v "$DECO_SO" AppDir/usr/plugins/wayland-decoration-client/
else
echo "ERROR: decoration plugin .so not found"; exit 1
fi
- name: Download linuxdeploy
run: |
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
- name: Build AppImage
env:
QMAKE: qmake
# Force the Wayland platform plugin into the bundle (linuxdeploy-plugin-qt
# bundles xcb by default); the decoration plugin is already in AppDir and
# linuxdeploy resolves its library dependencies.
EXTRA_PLATFORM_PLUGINS: "libqwayland-generic.so;libqwayland-egl.so"
run: |
./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
--plugin qt \
--output appimage
- name: Verify Adwaita style resolves inside the AppImage
run: |
# Regression guard: the style must resolve its libraries from the bundle,
# not from the build host (which has adwaita-qt6 installed and would
# therefore hide a broken bundle until someone runs it on a clean system).
rm -rf verify && mkdir verify
APPIMAGE=$(ls CAN*.AppImage | head -n1)
(cd verify && "../${APPIMAGE}" --appimage-extract >/dev/null)
ROOT="$PWD/verify/squashfs-root"
PLUGIN="$ROOT/usr/plugins/styles/adwaita.so"
test -f "$PLUGIN" || { echo "ERROR: adwaita.so missing from AppImage"; exit 1; }
readelf -d "$PLUGIN" | grep -qE 'RPATH|RUNPATH' \
|| { echo "ERROR: adwaita.so has no RUNPATH — libraries would be looked up on the host"; exit 1; }
ldd "$PLUGIN"
for lib in libadwaitaqt6.so.1 libadwaitaqt6priv.so.1; do
resolved=$(ldd "$PLUGIN" | awk -v l="$lib" '$1 == l { print $3 }')
case "$resolved" in
"$ROOT"/*) echo "OK: $lib -> $resolved" ;;
*) echo "ERROR: $lib resolves to '$resolved', expected a path inside the AppImage"; exit 1 ;;
esac
done
- name: Name AppImage after the version
run: |
VERSION=$(grep '^VERSION' src/src.pro | sed 's/VERSION\s*=\s*//')
mv "$(ls CAN*.AppImage | head -n1)" "CANgaroo-${VERSION}-x86_64.AppImage"
- name: Upload AppImage
id: upload
uses: actions/upload-artifact@v7
with:
path: "CANgaroo-*-x86_64.AppImage"
archive: false
if-no-files-found: error
build-windows:
name: Build CANgaroo (Windows / MinGW / Qt6)
runs-on: windows-2022
outputs:
artifact_id: ${{ steps.upload.outputs.artifact-id }}
env:
# Kvaser CANlib Windows SDK version — update here when a newer SDK is released.
KVASER_VERSION: "5.51.461"
# Default install path used by the Kvaser SDK installer
CANLIB_DIR_HEADER: "C:/Program Files (x86)/Kvaser/Canlib/INC"
CANLIB_DIR_BIN: "C:/Program Files (x86)/Kvaser/Canlib/bin_x64"
CANLIB_DIR_LIB: "C:/Program Files (x86)/Kvaser/Canlib/Lib/x64"
CANLIB_DIR: "C:/Program Files (x86)/Kvaser/Canlib/"
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup MSYS2 with MinGW + Qt6
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
cache: true
# pkgconf: qmake's PKGCONFIG (python3-embed) needs it; it used to come
# in only as a dependency of another package. No comments inside the
# folded list below: they would become package names.
install: >-
mingw-w64-ucrt-x86_64-toolchain
mingw-w64-ucrt-x86_64-qt6
mingw-w64-ucrt-x86_64-qt6-tools
mingw-w64-ucrt-x86_64-make
mingw-w64-ucrt-x86_64-pkgconf
mingw-w64-ucrt-x86_64-ntldd
mingw-w64-ucrt-x86_64-python
mingw-w64-ucrt-x86_64-pybind11
git
- name: Download PCAN-Basic SDK
shell: pwsh
run: |
Invoke-WebRequest `
-Uri "https://www.peak-system.com/fileadmin/media/files/PCAN-Basic.zip" `
-OutFile "$env:TEMP\PCAN-Basic.zip"
Expand-Archive -Path "$env:TEMP\PCAN-Basic.zip" `
-DestinationPath "src/driver/PeakCanDriver/pcan-basic-api" `
-Force
- name: Download and install Kvaser CANlib SDK (Windows)
shell: pwsh
run: |
$installer = "$env:TEMP\kvaser_canlib_sdk.exe"
$verUs = $env:KVASER_VERSION -replace '\.', '_'
Invoke-WebRequest `
-Uri "https://pim.kvaser.com/var/assets/Product_Resources/7330130980150/$env:KVASER_VERSION/canlib_${verUs}.exe" `
-OutFile $installer
# Run the NSIS installer silently; default target is C:\Program Files\Kvaser\Drivers
Start-Process -FilePath $installer -ArgumentList "/S" -Wait
# Copy SDK into source tree so KvaserDriver.pri finds it automatically
$SDK_DEST = "src\driver\KvaserDriver\canlib-sdk"
New-Item -ItemType Directory -Force -Path "$SDK_DEST\INC"
New-Item -ItemType Directory -Force -Path "$SDK_DEST\Bin"
New-Item -ItemType Directory -Force -Path "$SDK_DEST\Lib"
try {
Write-Host "=== Copy headers ==="
Copy-Item "$env:CANLIB_DIR_HEADER\*.h" "$SDK_DEST\INC\" -ErrorAction Stop
} catch {
Write-Warning "Failed to copy headers: $_"
}
try {
Write-Host "=== Copy canlib32.dll ==="
Copy-Item "$env:CANLIB_DIR_BIN\canlib32.dll" "$SDK_DEST\Bin\" -ErrorAction Stop
} catch {
Write-Warning "Failed to copy canlib32.dll: $_"
}
try {
Write-Host "=== Copy $env:CANLIB_DIR_LIB ==="
Copy-Item "$env:CANLIB_DIR_LIB\canlib32.lib" "$SDK_DEST\Lib\" -ErrorAction Stop
} catch {
Write-Warning "Failed to copy canlib32.lib: $_"
}
- name: Verify Qt6 installation
run: |
qmake6 --version
which qmake6
- name: Configure build (Qt6 qmake)
run: |
qmake6 CONFIG+=release CONFIG+=kvaser CONFIG+=peakcan CONFIG+=zscanfd
- name: Build
run: |
mingw32-make -j$(nproc)
- name: List build output
run: |
echo "==== Project root ===="
ls -lah
echo "==== Executables ===="
find . -maxdepth 2 -name "*.exe" -type f -print
- name: Prepare distribution directory
run: |
mkdir -p dist
cp ./bin/*.exe dist/
- name: Deploy Qt6 runtime (windeployqt)
run: |
EXE=$(ls dist/*.exe | head -n 1)
windeployqt6 \
--release \
--no-system-d3d-compiler \
"$EXE"
- name: Add MinGW runtime DLLs
run: |
cp /ucrt64/bin/libgcc_s_seh-1.dll dist/
cp /ucrt64/bin/libstdc++-6.dll dist/
cp /ucrt64/bin/libwinpthread-1.dll dist/
cp /ucrt64/bin/libmd4c.dll dist/
cp /ucrt64/bin/libharfbuzz-0.dll dist/
cp /ucrt64/bin/libfreetype-6.dll dist/
cp /ucrt64/bin/libpng16-16.dll dist/
cp /ucrt64/bin/zlib1.dll dist/
cp /ucrt64/bin/libdouble-conversion.dll dist/
cp /ucrt64/bin/libb2-1.dll dist/
cp /ucrt64/bin/libicuin78.dll dist/
cp /ucrt64/bin/libbrotlidec.dll dist/
cp /ucrt64/bin/libzstd.dll dist/
cp /ucrt64/bin/libicuuc78.dll dist/
cp /ucrt64/bin/libpcre2-16-0.dll dist/
- name: Add Python runtime
run: |
PYVER=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('VERSION'))")
cp /ucrt64/bin/libpython${PYVER}.dll dist/
# Bundle the stdlib under lib/pythonX.Y/ — Python finds it when PYTHONHOME=<appdir>
mkdir -p dist/lib/python${PYVER}
cp -r /ucrt64/lib/python${PYVER}/* dist/lib/python${PYVER}/ 2>/dev/null || true
# Remove test and __pycache__ dirs to save space
find dist/lib/python${PYVER} -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find dist/lib/python${PYVER} -type d -name test -exec rm -rf {} + 2>/dev/null || true
- name: Deploy MinGW runtime dependencies
run: |
EXE=$(ls dist/*.exe | head -n 1)
echo "Resolving UCRT64 runtime dependencies for $EXE"
# Keep ntldd's whole output in the log. windeployqt (and the steps
# before) already put most of the runtime in dist/, which ntldd then
# resolves there: nothing under ucrt64 may be left, so grep finding
# no match is fine (the shell stops on a failed pipeline otherwise).
ntldd -R "$EXE" 2>&1 | tee ntldd.txt
{ grep -i ucrt64 ntldd.txt || true; } \
| awk '{print $3}' \
| sort -u \
| while IFS= read -r file; do
# Convert Windows path to Linux path
linux_path=$(echo "$file" | sed -E 's|([A-Za-z]):\\|/\L\1/|; s|\\|/|g')
echo "Copying $linux_path"
cp "$linux_path" dist/ || echo "Skipped $linux_path"
done
- name: Bundle runtime DLLs
run: |
cp src/driver/KvaserDriver/canlib-sdk/Bin/canlib32.dll dist/
cp src/driver/PeakCanDriver/pcan-basic-api/x64/PCANBasic.dll dist/
- name: Bundle example scripts
run: |
mkdir -p dist/examples
cp examples/*.py dist/examples/ || true
- name: Verify missing DLLs
run: |
EXE=$(ls dist/*.exe | head -n 1)
ntldd "$EXE" || true
- name: Zip
shell: pwsh
run: |
# named after the program version (VERSION in src/src.pro)
$version = (Select-String -Path src/src.pro -Pattern '^VERSION\s*=\s*(\S+)').Matches[0].Groups[1].Value
$name = "CANgaroo-$version-windows-x64"
Move-Item dist $name
Compress-Archive -Path $name -DestinationPath "$name.zip"
# upload the zip as it is: zipped again by upload-artifact, the download
# would be a zip inside a zip
- name: Upload Windows Qt6 binaries
id: upload
uses: actions/upload-artifact@v7
with:
path: "CANgaroo-*-windows-x64.zip"
archive: false
if-no-files-found: error
# Installs each .deb in a Docker container of the Ubuntu release it was built
# for (see the script for the checks). The release waits for it.
test-deb:
name: Test .deb install (Ubuntu ${{ matrix.ubuntu }})
needs: build-ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ubuntu: ["24.04", "26.04"]
steps:
- name: Checkout the test script
uses: actions/checkout@v6
with:
sparse-checkout: scripts
- name: Download the .deb
uses: actions/download-artifact@v8
with:
pattern: cangaroo_*_ubuntu${{ matrix.ubuntu }}_amd64.deb
path: deb
merge-multiple: true
skip-decompress: true
- name: Install, start and remove the .deb
run: bash scripts/test-deb-docker.sh -v -i ubuntu:${{ matrix.ubuntu }} deb/*.deb
test-rpm:
name: Test .rpm install (Fedora ${{ matrix.fedora }})
needs: build-fedora
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
fedora: ["44", "45"]
steps:
- name: Checkout the test script
uses: actions/checkout@v6
with:
sparse-checkout: scripts
- name: Download the .rpm
uses: actions/download-artifact@v8
with:
pattern: cangaroo-*.fc${{ matrix.fedora }}.x86_64.rpm
path: rpm
merge-multiple: true
skip-decompress: true
- name: Install, start and remove the .rpm
run: bash scripts/test-rpm-docker.sh -v -i fedora:${{ matrix.fedora }} rpm/*.rpm
release:
name: Release (tags only)
needs: [unit-tests, format-compat, build-ubuntu, test-deb, build-fedora, test-rpm, build-manual, build-appimage, build-windows]
if: startsWith(github.ref, 'refs/tags/V') || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
# The packages are named after VERSION in src/src.pro: a tag that does not
# match it would publish files with another version than the release
- name: Check tag against src/src.pro
run: |
VERSION=$(grep '^VERSION' src/src.pro | sed 's/VERSION\s*=\s*//')
TAG="${GITHUB_REF_NAME#[Vv]}"
if [ "$TAG" != "$VERSION" ]; then
echo "::error::tag ${GITHUB_REF_NAME} does not match VERSION = ${VERSION} in src/src.pro"
exit 1
fi
# One .deb per Ubuntu and one .rpm per Fedora release, and the manual, found by name (a build matrix has no
# single artifact id)
- uses: actions/download-artifact@v8
with:
pattern: cangaroo*
path: artifacts
merge-multiple: true
skip-decompress: true
- uses: actions/download-artifact@v8
with:
artifact-ids: ${{ needs.build-appimage.outputs.artifact_id }}, ${{ needs.build-windows.outputs.artifact_id }}
path: artifacts
merge-multiple: true
skip-decompress: true # the Windows zip stays a zip (it would be unpacked into a folder, which the upload skips)
- name: Show files
run: ls -alR artifacts
- uses: softprops/action-gh-release@v3
with:
name: CANgaroo ${{ github.ref_name }}
draft: true
files: artifacts/*