scan GUI sources with clang-tidy in CI (#3233)
* build UI dependencies before running clang-tidy * clang-tidy.yml: enabled GUI sources and build some dependencies for clang-tidy * work around missing dependency for Qt install step
This commit is contained in:
parent
df59b07ba1
commit
54d621555d
|
@ -21,23 +21,24 @@ jobs:
|
||||||
apt-get install -y cmake g++ make
|
apt-get install -y cmake g++ make
|
||||||
apt-get install -y z3 libz3-dev
|
apt-get install -y z3 libz3-dev
|
||||||
apt-get install -y libpcre3-dev
|
apt-get install -y libpcre3-dev
|
||||||
|
apt-get install -y libffi7 # work around missing dependency for Qt install step
|
||||||
apt-get install -y software-properties-common
|
apt-get install -y software-properties-common
|
||||||
add-apt-repository universe
|
add-apt-repository universe
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y clang-tidy-13
|
apt-get install -y clang-tidy-13
|
||||||
|
|
||||||
# uses "sudo" internally which is not available on docker by default
|
- name: Install Qt
|
||||||
#- name: Install Qt
|
uses: jurplel/install-qt-action@v2
|
||||||
# uses: jurplel/install-qt-action@v2
|
with:
|
||||||
# with:
|
install-deps: 'nosudo'
|
||||||
# modules: 'qtcharts'
|
version: '5.15.2'
|
||||||
|
modules: 'qtcharts'
|
||||||
|
|
||||||
- name: Prepare CMake
|
- name: Prepare CMake
|
||||||
run: |
|
run: |
|
||||||
mkdir cmake.output
|
mkdir cmake.output
|
||||||
cd cmake.output
|
cd cmake.output
|
||||||
# cannot include GUI since we need to generate the ui_*.h files first
|
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On ..
|
||||||
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off ..
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
- name: Clang-Tidy
|
- name: Clang-Tidy
|
||||||
|
@ -45,4 +46,5 @@ jobs:
|
||||||
# make sure the precompiled headers exist
|
# make sure the precompiled headers exist
|
||||||
make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx
|
make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx
|
||||||
make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx
|
make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx
|
||||||
|
make -C cmake.output autogen
|
||||||
cmake --build cmake.output --target run-clang-tidy 2> /dev/null
|
cmake --build cmake.output --target run-clang-tidy 2> /dev/null
|
||||||
|
|
|
@ -12,4 +12,10 @@ message(STATUS "RUN_CLANG_TIDY=${RUN_CLANG_TIDY}")
|
||||||
if (RUN_CLANG_TIDY)
|
if (RUN_CLANG_TIDY)
|
||||||
# disable all compiler warnings since we are just interested in the tidy ones
|
# disable all compiler warnings since we are just interested in the tidy ones
|
||||||
add_custom_target(run-clang-tidy ${RUN_CLANG_TIDY} -p=${CMAKE_BINARY_DIR} -j ${NPROC} -extra-arg=-w -quiet)
|
add_custom_target(run-clang-tidy ${RUN_CLANG_TIDY} -p=${CMAKE_BINARY_DIR} -j ${NPROC} -extra-arg=-w -quiet)
|
||||||
|
if (BUILD_GUI)
|
||||||
|
add_dependencies(run-clang-tidy gui-build-deps)
|
||||||
|
if (BUILD_TESTS)
|
||||||
|
add_dependencies(run-clang-tidy triage-build-ui-deps)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
|
@ -15,12 +15,15 @@ if (BUILD_GUI)
|
||||||
QT5_WRAP_UI(uis_hdrs ${uis})
|
QT5_WRAP_UI(uis_hdrs ${uis})
|
||||||
QT5_ADD_RESOURCES(resources "gui.qrc")
|
QT5_ADD_RESOURCES(resources "gui.qrc")
|
||||||
QT5_ADD_TRANSLATION(qms ${tss})
|
QT5_ADD_TRANSLATION(qms ${tss})
|
||||||
list(APPEND cppcheck-gui_SOURCES ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
list(APPEND cppcheck-gui-deps ${hdrs} ${uis_hdrs} ${resources} ${qms} )
|
||||||
|
add_custom_target(gui-build-deps SOURCES ${cppcheck-gui-deps})
|
||||||
|
|
||||||
|
list(APPEND cppcheck-gui_SOURCES ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
||||||
if(USE_BUNDLED_TINYXML2)
|
if(USE_BUNDLED_TINYXML2)
|
||||||
list(APPEND cppcheck-gui_SOURCES $<TARGET_OBJECTS:tinyxml2_objs>)
|
list(APPEND cppcheck-gui_SOURCES $<TARGET_OBJECTS:tinyxml2_objs>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(cppcheck-gui ${cppcheck-gui_SOURCES})
|
add_executable(cppcheck-gui ${cppcheck-gui-deps} ${cppcheck-gui_SOURCES})
|
||||||
set_target_properties(cppcheck-gui PROPERTIES AUTOMOC ON)
|
set_target_properties(cppcheck-gui PROPERTIES AUTOMOC ON)
|
||||||
target_include_directories(cppcheck-gui PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
target_include_directories(cppcheck-gui PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
||||||
if(USE_BUNDLED_TINYXML2)
|
if(USE_BUNDLED_TINYXML2)
|
||||||
|
|
|
@ -12,6 +12,7 @@ if (BUILD_GUI AND BUILD_TESTS)
|
||||||
file(GLOB uis "*.ui")
|
file(GLOB uis "*.ui")
|
||||||
qt5_wrap_ui(uis_hdrs ${uis})
|
qt5_wrap_ui(uis_hdrs ${uis})
|
||||||
|
|
||||||
|
add_custom_target(triage-build-ui-deps SOURCES ${hdrs} ${uis_hdrs})
|
||||||
add_executable(
|
add_executable(
|
||||||
triage
|
triage
|
||||||
${hdrs}
|
${hdrs}
|
||||||
|
|
Loading…
Reference in New Issue