Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2024 Roman Gilg <[email protected]>

WarningsAsErrors: "*,
-clang-diagnostic-unused-lambda-capture,
-clang-diagnostic-deprecated-declarations
"

Checks: "-*,
clang-analyzer-cplusplus.NewDelete,
clang-analyzer-unix.Malloc
"
16 changes: 12 additions & 4 deletions .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,39 @@
# SPDX-License-Identifier: MIT
name: Report Coverage
description: Uses gcovr to report coverage
inputs:
gcov-exe:
description: Set custom gcov executable, e.g. 'llvm-cov gcov' for clang.
required: false
default: "gcov"
runs:
using: "composite"
steps:
- run: python -m venv venv && source venv/bin/activate
shell: sh
- run: source venv/bin/activate && pip install --upgrade Jinja2==3.0.3 gcovr==5.0
- run: source venv/bin/activate && pip install --upgrade gcovr==7.2
shell: sh
- run: mkdir coverage-html
shell: sh
# TODO(romangg): --gcov-ignore-errors=no_working_dir_found is set because
# gcov executable is failing to find Catch2 from FetchContent. Needs to be
# reported as an issue in respective projects and tested again later on.
- run:
"source venv/bin/activate && gcovr -s \
--xml-pretty --xml coverage.xml \
--html-details coverage-html/coverage.html \
--gcov-executable '/usr/bin/llvm-cov gcov' \
--gcov-executable '${{ inputs.gcov-exe }}' \
--gcov-ignore-errors=no_working_dir_found \
--exclude-throw-branches \
-e build -r . build"
shell: sh
- name: Upload xml
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.xml
retention-days: 8
- name: Upload html
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: coverage-html
retention-days: 8
28 changes: 18 additions & 10 deletions .github/workflows/change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,37 @@ jobs:
clang-format:
uses: ./.github/workflows/clang-format.yml

clang-build:
coverage-build:
uses: ./.github/workflows/build.yml
with:
image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master
artifact-name: clang-build
cmake-preset: coverage
artifact-name: coverage-build
cmake-preset: gcc-cov

secondary-builds:
builds:
strategy:
matrix:
preset: [gcc, release]
preset: [clang, release]
uses: ./.github/workflows/build.yml
with:
image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master
artifact-name: '${{ matrix.preset }}-build'
cmake-preset: ${{ matrix.preset }}

install:
uses: ./.github/workflows/install.yml
needs: clang-build
needs: builds
with:
image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master
artifact-name: clang-build
artifact-name: release-build

test:
uses: ./.github/workflows/test.yml
needs: clang-build
needs: coverage-build
secrets: inherit
with:
image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master
artifact-name: clang-build
artifact-name: coverage-build
# Following tests are currently disabled on CI:
# * lockscreen, modifier-only-shortcut: flaky on CI because the lockscreen greeter process likes to
# freeze off. Also see: https://bugreports.qt.io/browse/QTBUG-82911
Expand All @@ -61,9 +62,16 @@ jobs:
|no crash aurorae destroy deco|slidingpopups|scripted effects|window open close animation\
|subspace switching animation|minimize animation'"

clang-tidy:
uses: ./.github/workflows/clang-tidy.yml
needs: builds
with:
image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master
artifact-name: clang-build

package:
uses: ./.github/workflows/package.yml
needs: clang-build
needs: builds
with:
image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master
artifact-name: clang-build
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-FileCopyrightText: 2024 Roman Gilg <[email protected]>
# SPDX-License-Identifier: MIT
name: Clang-Tidy
on:
workflow_call:
inputs:
image:
description: Image to run tests on
required: true
type: string
artifact-name:
description: Artifact name of build dir
required: true
type: string

jobs:
clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
container:
image: ${{ inputs.image }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Dependencies
uses: ./.github/actions/dep-artifacts
with:
secret: ${{ secrets.GITHUB_TOKEN }}
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
- name: Untar artifact
run: tar -xzf build-dir.tar
- name: Run Clang-Tidy
# TODO(romangg): For now we skip the actual clang-tidy operation on CI because
# the process consumes too much resources and the runner terminates.
if: false
run: tooling/analysis/clang-tidy.py -p build
shell: bash
43 changes: 26 additions & 17 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
}
},
"environment": {
"DEBUG_COMMON_FLAGS": "-Wall -Wextra -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef",
Expand All @@ -20,7 +24,8 @@
"DEBUG_SHARED_LINKER_FLAGS": "-Wl,--fatal-warnings",
"DEBUG_MODULE_LINKER_FLAGS": "-Wl,--fatal-warnings",
"NOUNDEF_LINKER_FLAGS": "-Wl,--no-undefined",
"DEBUG_CXX_FLAGS_CLANG": "$env{DEBUG_CXX_FLAGS} -fno-operator-names -Wno-gnu-zero-variadic-macro-arguments -Wno-cast-align -Werror -Wno-error=deprecated-declarations -Wno-error=unused-lambda-capture"
"DEBUG_CXX_FLAGS_CLANG": "$env{DEBUG_CXX_FLAGS} -fno-operator-names -Wno-gnu-zero-variadic-macro-arguments -Wno-cast-align -Werror -Wno-error=deprecated-declarations -Wno-error=unused-lambda-capture",
"DEBUG_CXX_FLAGS_GCC": "$env{DEBUG_CXX_FLAGS} -Wsuggest-override -Wlogical-op -Wmissing-include-dirs -Wno-missing-field-initializers -Werror -Wno-error=unknown-pragmas -Wno-error=deprecated-declarations -Wno-error=missing-include-dirs"
}
},
{
Expand All @@ -46,7 +51,7 @@
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++",
"CMAKE_C_FLAGS": "$env{DEBUG_C_FLAGS}",
"CMAKE_CXX_FLAGS": "$env{DEBUG_CXX_FLAGS} -Wsuggest-override -Wlogical-op -Wmissing-include-dirs -Wno-missing-field-initializers -Werror -Wno-error=unknown-pragmas -Wno-error=deprecated-declarations -Wno-error=missing-include-dirs",
"CMAKE_CXX_FLAGS": "$env{DEBUG_CXX_FLAGS_GCC}",
"CMAKE_SHARED_LINKER_FLAGS": "$env{DEBUG_SHARED_LINKER_FLAGS} $env{NOUNDEF_LINKER_FLAGS}",
"CMAKE_MODULE_LINKER_FLAGS": "$env{DEBUG_MODULE_LINKER_FLAGS} $env{NOUNDEF_LINKER_FLAGS}"
}
Expand All @@ -67,22 +72,26 @@
}
},
{
"name": "coverage",
"inherits": "debug-base",
"displayName": "Tests with Coverage",
"description": "Build with tests and coverage reporting enabled",
"name": "clang-cov",
"inherits": "clang",
"displayName": "Clang Tests Coverage",
"description": "Clang Build with tests and coverage reporting enabled",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_FLAGS": "$env{DEBUG_C_FLAGS}",
"CMAKE_CXX_FLAGS": "$env{DEBUG_CXX_FLAGS_CLANG} --coverage",
"CMAKE_SHARED_LINKER_FLAGS": "$env{DEBUG_SHARED_LINKER_FLAGS} $env{NOUNDEF_LINKER_FLAGS}",
"CMAKE_MODULE_LINKER_FLAGS": "$env{DEBUG_MODULE_LINKER_FLAGS} $env{NOUNDEF_LINKER_FLAGS}",
"CMAKE_EXE_LINKER_FLAGS": "--coverage",
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
}
"CMAKE_EXE_LINKER_FLAGS": "--coverage"
}
},
{
"name": "gcc-cov",
"inherits": "gcc",
"displayName": "GCC Tests Coverage",
"description": "GCC Build with tests and coverage reporting enabled",
"cacheVariables": {
"CMAKE_C_FLAGS": "$env{DEBUG_C_FLAGS} --coverage -fprofile-abs-path",
"CMAKE_CXX_FLAGS": "$env{DEBUG_CXX_FLAGS_GCC} --coverage -fprofile-abs-path",
"CMAKE_SHARED_LINKER_FLAGS": "$env{DEBUG_SHARED_LINKER_FLAGS} $env{NOUNDEF_LINKER_FLAGS} --coverage -fprofile-abs-path",
"CMAKE_MODULE_LINKER_FLAGS": "$env{DEBUG_MODULE_LINKER_FLAGS} $env{NOUNDEF_LINKER_FLAGS} --coverage -fprofile-abs-path",
"CMAKE_EXE_LINKER_FLAGS": "--coverage -fprofile-abs-path"
}
},
{
Expand Down
2 changes: 0 additions & 2 deletions como/base/x11/event_filter_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class event_filter;

class COMO_EXPORT event_filter_container : public QObject
{
Q_OBJECT

public:
explicit event_filter_container(event_filter* filter);

Expand Down
2 changes: 1 addition & 1 deletion como/base/x11/event_filter_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void event_filter_manager::register_filter(event_filter* filter)
}

static event_filter_container* take_filter(event_filter* filter,
std::vector<QPointer<event_filter_container>>& filters)
std::vector<event_filter_container*>& filters)
{
auto it = std::find_if(filters.cbegin(), filters.cend(), [filter](auto container) {
return container->filter() == filter;
Expand Down
7 changes: 3 additions & 4 deletions como/base/x11/event_filter_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#pragma once

#include <como_export.h>

#include <QPointer>
#include <vector>

namespace como::base::x11
{
Expand All @@ -17,8 +16,8 @@ class event_filter_container;
class COMO_EXPORT event_filter_manager
{
public:
std::vector<QPointer<event_filter_container>> filters;
std::vector<QPointer<event_filter_container>> generic_filters;
std::vector<event_filter_container*> filters;
std::vector<event_filter_container*> generic_filters;

void register_filter(event_filter* filter);
void unregister_filter(event_filter* filter);
Expand Down
4 changes: 2 additions & 2 deletions como/render/effect/interface/anidata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ AniData::AniData(AnimationEffect::Attribute a,
int delay,
const FPx2& from_,
bool waitAtSource_,
FullScreenEffectLockPtr fullScreenEffectLock_,
std::shared_ptr<FullScreenEffectLock> const& fullScreenEffectLock,
bool keepAlive,
PreviousWindowPixmapLockPtr previousWindowPixmapLock_,
GLShader* shader)
Expand All @@ -69,7 +69,7 @@ AniData::AniData(AnimationEffect::Attribute a,
, meta(meta_)
, startTime(AnimationEffect::clock() + delay)
, frozenTime(-1)
, fullScreenEffectLock(std::move(fullScreenEffectLock_))
, fullScreenEffectLock{fullScreenEffectLock}
, waitAtSource(waitAtSource_)
, keepAlive(keepAlive)
, previousWindowPixmapLock(std::move(previousWindowPixmapLock_))
Expand Down
5 changes: 2 additions & 3 deletions como/render/effect/interface/anidata_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class FullScreenEffectLock
private:
Q_DISABLE_COPY(FullScreenEffectLock)
};
typedef QSharedPointer<FullScreenEffectLock> FullScreenEffectLockPtr;

/**
* References the previous window pixmap to prevent discarding.
Expand All @@ -61,7 +60,7 @@ class COMO_EXPORT AniData
int delay,
const FPx2& from,
bool waitAtSource,
FullScreenEffectLockPtr = FullScreenEffectLockPtr(),
std::shared_ptr<FullScreenEffectLock> const& fullScreenEffectLock = nullptr,
bool keepAlive = true,
PreviousWindowPixmapLockPtr previousWindowPixmapLock = {},
GLShader* shader = nullptr);
Expand All @@ -82,7 +81,7 @@ class COMO_EXPORT AniData
uint meta;
qint64 startTime;
qint64 frozenTime;
QSharedPointer<FullScreenEffectLock> fullScreenEffectLock;
std::shared_ptr<FullScreenEffectLock> fullScreenEffectLock;
bool waitAtSource;
bool keepAlive;
EffectWindowDeletedRef deletedRef;
Expand Down
Loading