Repository navigation
394 lines (345 loc) · 14.3 KB
/
Copy pathbuild-linux.yml
File metadata and controls
394 lines (345 loc) · 14.3 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
---
name: Linux
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
common_packages: >-
ninja-build
libxfixes-dev
libxtst-dev
extra-cmake-modules
libwayland-dev
libegl-dev
gnupg2
xvfb
openbox
xdotool
qt6_packages: >-
qt6-base-private-dev
qt6-base-dev
qt6-base-dev-tools
qt6-tools-dev
qt6-tools-dev-tools
qt6-l10n-tools
qt6-declarative-dev
libqt6svg6-dev
libqt6svg6
libqt6waylandclient6
qt6-wayland
qt6-wayland-dev
qt6-wayland-dev-tools
libqca-qt6-dev
libqca-qt6-2
libqca-qt6-plugins
qtkeychain-qt6-dev
test_wayland_packages: >-
kwin-wayland
kwin-wayland-backend-virtual
libwayland-server0
QCA_VERSION: '2.3.10'
QTKEYCHAIN_VERSION: '0.17.0'
LINUXDEPLOY_URL: 'https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage'
LINUXDEPLOY_SHA256: 'c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d'
LINUXDEPLOY_PLUGIN_QT_URL: 'https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-qt-x86_64.AppImage'
LINUXDEPLOY_PLUGIN_QT_SHA256: '15106be885c1c48a021198e7e1e9a48ce9d02a86dd0a1848f00bdbf3c1c92724'
LINUXDEPLOY_PLUGIN_APPIMAGE_URL: 'https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-x86_64.AppImage'
LINUXDEPLOY_PLUGIN_APPIMAGE_SHA256: '992d502a248e14ab185448ddf6f6e7d25558cb84d4623c354c3af350c25fccb3'
jobs:
build:
permissions:
id-token: write
contents: read
outputs:
version: ${{ steps.version.outputs.version }}
name: ${{matrix.buildname}}
runs-on: ${{matrix.os}}
strategy:
# Avoid canceling all jobs on transient failures.
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
buildname: Qt 6
compiler: g++
compiler_package: g++
custom_qt: '6.11.1'
with_native_notifications: false
with_kf6_wayland_clipboard: false
has_webp: false
coverage: true
cmake_preset: Debug
compiler_flags: >-
--coverage
-fprofile-arcs
-ftest-coverage
-fprofile-abs-path
-fprofile-update=atomic
test_wayland: true
test_gnome: true
test_x11: true
- os: ubuntu-24.04
buildname: Qt 6 Clang
compiler: clang++
compiler_package: clang
with_native_notifications: false
with_kf6_wayland_clipboard: false
has_webp: false
cmake_preset: Debug
test_x11: true
# Pinned to ubuntu-26.04: KDE Neon repo below uses 'resolute' (26.04 codename).
- os: ubuntu-26.04
buildname: AppImage
compiler: g++
compiler_package: g++
with_native_notifications: true
with_kf6_wayland_clipboard: true
has_webp: true
cmake_preset: AppImage-Release
appimage: true
test_wayland: false
test_x11: false
steps:
- name: Checkout source code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v5
with:
submodules: false
persist-credentials: false
# Full commit history needed for sortable version string (git describe in CMake).
# Blobless filter skips file content for historical commits to speed up clone.
fetch-depth: 0
filter: blob:none
- name: Enable ccache
uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24
with:
key: ${{ github.job }}-${{ matrix.os }}
- name: Set up ccache
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
- name: Set up KDE Neon repo for KF6 packages
if: matrix.with_native_notifications || matrix.with_kf6_wayland_clipboard
run: |
sudo gpg --dearmor -o /usr/share/keyrings/neon-archive-keyring.gpg \
utils/github/kde-neon-public.key
echo "deb [signed-by=/usr/share/keyrings/neon-archive-keyring.gpg] https://archive.neon.kde.org/stable resolute main" |
sudo tee /etc/apt/sources.list.d/neon.list
- name: Install dependencies
env:
PACKAGES: >-
${{ matrix.compiler_package }}
${{ env.common_packages }}
${{ !matrix.custom_qt && env.qt6_packages || '' }}
${{ matrix.coverage && 'lcov' || '' }}
${{ matrix.test_wayland && env.test_wayland_packages || '' }}
${{ matrix.custom_qt && 'libssl-dev libsecret-1-dev pkg-config' || '' }}
${{ matrix.coverage && 'procps' || '' }}
${{ matrix.test_gnome && 'gnome-shell gnome-shell-common glib2.0-bin gjs' || '' }}
${{ matrix.with_native_notifications && 'libkf6notifications-dev kf6-kstatusnotifieritem-dev' || '' }}
${{ matrix.with_kf6_wayland_clipboard && 'libkf6guiaddons-dev' || '' }}
${{ matrix.appimage && 'libfuse2t64' || '' }}
RETRY_COUNT: "4"
RETRY_INITIAL_DELAY_SECONDS: "10"
run: |
retry() {
local delay="$RETRY_INITIAL_DELAY_SECONDS"
local attempts=$((RETRY_COUNT + 1))
for attempt in $(seq 0 "$RETRY_COUNT"); do
if [ "$attempt" -gt 0 ]; then sleep "$delay"; delay=$((delay * 2)); fi
if "$@"; then return 0; fi
echo "::warning::Command failed (attempt $attempt/$attempts)"
done
echo "::error::Command failed after $attempts attempts"
return 1
}
retry sudo apt-get update -y
install_packages() {
echo "$PACKAGES" | xargs sudo apt-get install -y --no-install-recommends
}
retry install_packages
- name: Install Qt
if: matrix.custom_qt
uses: jurplel/install-qt-action@a9c63c7c123f3069cff414e7e482d95dfa9d8125 # v4
with:
version: ${{ matrix.custom_qt }}
modules: qt5compat
- name: Build QCA and QtKeychain
if: matrix.custom_qt
run: |
set -e
git clone --depth 1 --branch v${{ env.QCA_VERSION }} https://github.com/KDE/qca.git /tmp/qca
cmake -G Ninja -S /tmp/qca -B /tmp/qca-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_WITH_QT6=ON \
-DBUILD_TESTS=OFF \
-DBUILD_TOOLS=OFF \
-DBUILD_PLUGINS=ossl
cmake --build /tmp/qca-build --parallel
sudo cmake --install /tmp/qca-build
git clone --depth 1 --branch ${{ env.QTKEYCHAIN_VERSION }} https://github.com/frankosterfeld/qtkeychain.git /tmp/qtkeychain
cmake -G Ninja -S /tmp/qtkeychain -B /tmp/qtkeychain-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_TRANSLATIONS=OFF
cmake --build /tmp/qtkeychain-build --parallel
sudo cmake --install /tmp/qtkeychain-build
echo "LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV"
- name: Download miniaudio
uses: $/.github/actions/download-miniaudio
- name: Build with CMake
run: |
cmake --preset '${{ matrix.cmake_preset }}' \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCMAKE_CXX_FLAGS="${{matrix.compiler_flags}}" \
-DCMAKE_C_FLAGS="${{matrix.compiler_flags}}" \
-DWITH_NATIVE_NOTIFICATIONS=${{matrix.with_native_notifications}}
cmake --build --preset '${{ matrix.cmake_preset }}'
- name: Create gnupg directory for tests
run: mkdir -p ~/.gnupg && chmod go-rwx ~/.gnupg
- name: Set up test environment
run: |
echo "COPYQ_TESTS_EXECUTABLE=${{github.workspace}}/_install/copyq/${{ matrix.cmake_preset }}/bin/copyq" >> "$GITHUB_ENV"
echo "COPYQ_TESTS_SKIP_WEBP=${{ !matrix.has_webp && 1 || 0 }}" >> "$GITHUB_ENV"
- name: Set up AppImage tools
if: matrix.appimage
run: |
mkdir -p "$HOME/.local/bin"
dest="$HOME/.local/bin"
wget -q -O "$dest/linuxdeploy" "$LINUXDEPLOY_URL"
echo "$LINUXDEPLOY_SHA256 $dest/linuxdeploy" | sha256sum -c
wget -q -O "$dest/linuxdeploy-plugin-qt" "$LINUXDEPLOY_PLUGIN_QT_URL"
echo "$LINUXDEPLOY_PLUGIN_QT_SHA256 $dest/linuxdeploy-plugin-qt" | sha256sum -c
wget -q -O "$dest/linuxdeploy-plugin-appimage" "$LINUXDEPLOY_PLUGIN_APPIMAGE_URL"
echo "$LINUXDEPLOY_PLUGIN_APPIMAGE_SHA256 $dest/linuxdeploy-plugin-appimage" | sha256sum -c
chmod +x "$dest"/linuxdeploy*
echo "$dest" >> "$GITHUB_PATH"
- name: Get version string
if: matrix.appimage
id: version
uses: $/.github/actions/get-version
with:
build_dir: ${{ github.workspace }}/build/copyq/${{ matrix.cmake_preset }}
- name: Create AppImage
if: matrix.appimage
env:
DESTDIR: ${{github.workspace}}/AppDir
EXTRA_QT_MODULES: svg;tls
EXTRA_PLATFORM_PLUGINS: libqwayland.so
QMAKE: qmake6
VERSION: ${{ steps.version.outputs.version }}
run: |
DESTDIR="$DESTDIR" cmake --install build/copyq/${{ matrix.cmake_preset }}
# Bundle Qt/KF6 plugin directories that linuxdeploy-plugin-qt does
# not detect automatically.
qt_plugins="$(qmake6 -query QT_INSTALL_PLUGINS)"
deps_only_flags=()
for dir in \
kf6/kwindowsystem \
wayland-shell-integration \
wayland-decoration-client \
wayland-graphics-integration-client \
; do
src="$qt_plugins/$dir"
dst="$DESTDIR/usr/plugins/$dir"
if [ -d "$src" ]; then
mkdir -p "$dst"
cp -a "$src"/*.so "$dst/"
deps_only_flags+=(--deploy-deps-only "$dst")
fi
done
# Bundle QCA ossl plugin. Its location varies across distros
# (e.g. lib/qca-qt6/crypto, lib64/qt6/plugins/crypto).
mkdir -p "$DESTDIR/usr/plugins/crypto"
qca_ossl=$(find /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu \
-name 'libqca-ossl.so' -print -quit 2>/dev/null)
if [ -z "$qca_ossl" ]; then
echo "::error::QCA ossl plugin (libqca-ossl.so) not found"
exit 1
fi
echo "Found QCA ossl plugin: $qca_ossl"
cp -a "$qca_ossl" "$DESTDIR/usr/plugins/crypto/"
deps_only_flags+=(--deploy-deps-only "$DESTDIR/usr/plugins/crypto")
linuxdeploy --appdir "$DESTDIR" \
--desktop-file "$DESTDIR/usr/share/applications/com.github.hluk.copyq.desktop" \
--icon-file "$DESTDIR/usr/share/icons/hicolor/scalable/apps/copyq.svg" \
--executable "$DESTDIR/usr/bin/copyq" \
"${deps_only_flags[@]}" \
--plugin qt \
--output appimage
- name: Upload AppImage
if: matrix.appimage
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: CopyQ-*.AppImage
archive: false
- name: Smoke-test AppImage
if: matrix.appimage
run: '"$APPIMAGE" --version'
env:
APPIMAGE: ${{github.workspace}}/CopyQ-${{ steps.version.outputs.version }}-x86_64.AppImage
- name: Set up AppImage for tests
if: matrix.appimage
run: |
echo "COPYQ_TESTS_EXECUTABLE=$APPIMAGE" >> "$GITHUB_ENV"
env:
APPIMAGE: ${{github.workspace}}/CopyQ-${{ steps.version.outputs.version }}-x86_64.AppImage
- name: Test on GNOME
working-directory: >-
${{github.workspace}}/build/copyq/${{ matrix.cmake_preset }}
if: matrix.test_gnome
run: '${{github.workspace}}/utils/github/test-linux-gnome-extension.sh'
- name: Test on Wayland
working-directory: >-
${{github.workspace}}/build/copyq/${{ matrix.cmake_preset }}
if: matrix.test_wayland
run: '${{github.workspace}}/utils/github/test-linux-wayland.sh'
- name: Test on X11
working-directory: >-
${{github.workspace}}/build/copyq/${{ matrix.cmake_preset }}
if: matrix.test_x11 && !matrix.appimage
run: '${{github.workspace}}/utils/github/test-linux.sh'
- name: Test on X11 (AppImage)
working-directory: >-
${{github.workspace}}/build/copyq/${{ matrix.cmake_preset }}
if: matrix.test_x11 && matrix.appimage
run: |
${{github.workspace}}/utils/github/test-linux.sh \
testCore:clipboardToItem \
testCore:itemToClipboard \
testCore:commandClipboard \
testCore:commandHasClipboardFormat \
testCore:tabEncryption \
testCore:tabEncryptionPasswordNew \
testCore:tabEncryptionPasswordCurrent \
testCore:expireEncryptionPassword
${{github.workspace}}/utils/github/test-linux.sh testItemEncrypted
- name: Update coverage
if: matrix.coverage
working-directory: >-
${{github.workspace}}/build/copyq/${{ matrix.cmake_preset }}
run: |
lcov --capture --directory . \
--base-directory '${{github.workspace}}' \
--no-external \
--rc branch_coverage=1 \
--rc geninfo_no_exception_branch=1 \
--output-file coverage-full.info
# Remove 3rd party files in source tree
lcov --remove coverage-full.info \
'*/plugins/itemfakevim/fakevim/*' \
'*/src/gui/fix_icon_id.h' \
--output-file coverage.info
- name: Upload coverage to Codecov
if: matrix.coverage
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7
with:
files: ${{github.workspace}}/build/copyq/${{ matrix.cmake_preset }}/coverage.info
fail_ci_if_error: true
verbose: true
use_oidc: true