--- 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.15.0' LINUXDEPLOY_URL: 'https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20250213-2/linuxdeploy-x86_64.AppImage' LINUXDEPLOY_SHA256: '4648f278ab3ef31f819e67c30d50f462640e5365a77637d7e6f2ad9fd0b4522a' 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: contents: read name: ${{matrix.buildname}} runs-on: ${{matrix.os}} strategy: # Avoid canceling all jobs on transient failures. fail-fast: false matrix: include: - os: ubuntu-latest buildname: Qt 6 compiler: g++ compiler_package: g++ custom_qt: '6.10.2' 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-latest 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-24.04: KDE Neon repo below uses 'noble' (24.04 codename). - os: ubuntu-24.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: true test_x11: true steps: - name: Checkout source code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 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@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23 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 noble 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' || '' }} ${{ 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@48d3ad6db93f3627c8ee7a0454bc6f3744f7e730 # 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_WITH_QT6=ON \ -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@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v5 with: files: ${{github.workspace}}/build/copyq/${{ matrix.cmake_preset }}/coverage.info fail_ci_if_error: true verbose: true token: ${{ secrets.CODECOV_TOKEN }} release: if: startsWith(github.ref, 'refs/tags/v') needs: build runs-on: ubuntu-latest permissions: contents: write steps: - name: Download artifacts uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: 'CopyQ-*.AppImage' - name: Upload to release run: | gh release create "$GITHUB_REF_NAME" --draft --notes "" 2>/dev/null || true gh release upload "$GITHUB_REF_NAME" CopyQ-*/*.AppImage --clobber env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }}