Add pre-commit and fix whitespace #1879
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Linux | |
# yamllint disable-line rule:truthy | |
on: | |
- push | |
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 | |
gnupg2 | |
xvfb | |
openbox | |
qt6_packages: >- | |
libegl-dev | |
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 | |
qt5_packages: >- | |
qtbase5-dev | |
qtbase5-dev-tools | |
qtbase5-private-dev | |
qtdeclarative5-dev | |
qttools5-dev | |
qttools5-dev-tools | |
libqt5x11extras5-dev | |
libqt5svg5-dev | |
libqt5svg5 | |
libqt5waylandclient5-dev | |
qtwayland5 | |
qtwayland5-dev-tools | |
libkf5notifications-dev | |
extra-cmake-modules | |
jobs: | |
build: | |
name: ${{matrix.buildname}} | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
buildname: Qt 5 | |
compiler: g++ | |
compiler_package: g++ | |
with_qt6: false | |
with_native_notifications: true | |
cmake_preset: Debug | |
- os: ubuntu-latest | |
buildname: Qt 6 | |
compiler: g++ | |
compiler_package: g++ | |
with_qt6: true | |
with_native_notifications: false | |
test_wayland: true | |
coverage: true | |
cmake_preset: Debug | |
compiler_flags: >- | |
--coverage | |
-fprofile-arcs | |
-ftest-coverage | |
-fprofile-abs-path | |
- os: ubuntu-latest | |
buildname: Qt 6 Clang | |
compiler: clang++ | |
compiler_package: clang | |
with_qt6: true | |
with_native_notifications: false | |
cmake_preset: Debug | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
with: | |
submodules: false | |
fetch-depth: 1 | |
- name: Enable ccache | |
uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2 | |
with: | |
key: ${{ github.job }}-${{ matrix.os }} | |
- name: Set up ccache | |
run: | | |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | |
- name: Install dependencies | |
uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # v1 | |
with: | |
version: 1.0 | |
packages: >- | |
${{ matrix.compiler_package }} | |
${{ env.common_packages }} | |
${{ matrix.with_qt6 && env.qt6_packages || env.qt5_packages }} | |
${{ matrix.coverage && 'lcov' || '' }} | |
${{ matrix.coverage && 'kwin-wayland kwin-wayland-backend-virtual procps' || '' }} | |
- name: Build with CMake | |
uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10 | |
with: | |
configurePreset: '${{ matrix.cmake_preset }}' | |
buildPreset: '${{ matrix.cmake_preset }}' | |
configurePresetAdditionalArgs: >- | |
[ | |
'-DCMAKE_CXX_COMPILER=${{matrix.compiler}}', | |
'-DCMAKE_CXX_FLAGS=${{matrix.compiler_flags}}', | |
'-DCMAKE_C_FLAGS=${{matrix.compiler_flags}}', | |
'-DWITH_QT6=${{matrix.with_qt6}}', | |
'-DWITH_NATIVE_NOTIFICATIONS=${{matrix.with_native_notifications}}' | |
] | |
- name: Create gnupg directory for tests | |
run: mkdir -p ~/.gnupg && chmod go-rwx ~/.gnupg | |
- name: Test on Wayland | |
working-directory: '${{runner.workspace}}/install/copyq/${{ matrix.cmake_preset }}/bin' | |
if: matrix.test_wayland | |
run: '${{github.workspace}}/utils/github/test-linux-wayland.sh' | |
- name: Test on X11 | |
working-directory: '${{runner.workspace}}/install/copyq/${{ matrix.cmake_preset }}/bin' | |
run: '${{github.workspace}}/utils/github/test-linux.sh' | |
- name: Update coverage | |
if: matrix.coverage | |
working-directory: >- | |
${{runner.workspace}}/build/copyq/${{ matrix.cmake_preset }} | |
run: | | |
lcov --capture --directory . --output-file coverage-full.info | |
# Remove system and 3rd party files | |
lcov --remove coverage-full.info \ | |
'/usr/*' \ | |
'*/qxt/*' \ | |
'*/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@5a1091511ad55cbe89839c7260b706298ca349f7 # v5 | |
with: | |
files: ${{runner.workspace}}/build/copyq/${{ matrix.cmake_preset }}/coverage.info | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} |