From f21df9d815d37c1434114d74cec0eaab6b838e4a Mon Sep 17 00:00:00 2001 From: Alexander Sherikov Date: Sun, 21 Jul 2024 20:03:52 +0400 Subject: [PATCH] Use ccws to run scan build on ws packages --- .github/workflows/head_2.yml | 347 ++++++++++-------- include/ariles2/visitors/read.h | 2 + tests/CMakeLists.txt | 3 +- tests/api_v2/fixtures/013_write_namevalue.h | 1 + .../{better_enum.h => better_enum.h.hide} | 0 5 files changed, 191 insertions(+), 162 deletions(-) rename tests/common/{better_enum.h => better_enum.h.hide} (100%) diff --git a/.github/workflows/head_2.yml b/.github/workflows/head_2.yml index e8e4d296..5602c7c2 100644 --- a/.github/workflows/head_2.yml +++ b/.github/workflows/head_2.yml @@ -8,169 +8,194 @@ env: CATKIN_OPTIONS: $GITHUB_WORKSPACE/catkin.options jobs: - jammy_deb_packages: + # jammy_deb_packages: + # runs-on: ubuntu-22.04 + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo make install-deps + # - run: $APT fakeroot devscripts build-essential + # - run: | + # make deb-build DEB_TARGET=jammy + # make deb-install DEB_TARGET=jammy + # # make cmake_dependency # requires ROS + # + # + # focal_deb_packages: + # runs-on: ubuntu-20.04 + # + # env: + # ROS_DISTRO: noetic + # ROS_HOSTNAME: localhost + # ROS_CI_DESKTOP: focal + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP + # - run: sudo make install-deps + # - run: $APT fakeroot devscripts build-essential + # - run: | + # source /opt/ros/$ROS_DISTRO/setup.bash + # make deb-build DEB_TARGET=focal + # make deb-install DEB_TARGET=focal + # make cmake_dependency + # + # + # clang_noros: + # runs-on: ubuntu-22.04 + # steps: + # - uses: actions/checkout@v4 + # - run: sudo apt update + # - run: sudo make install-deps + # - run: make build-tests TYPE=Debug OPTIONS=noros TARGETS="all" TC=clang ARGS=-V + # + # + # jammy_gcc_noros: + # runs-on: ubuntu-22.04 + # steps: + # - uses: actions/checkout@v4 + # - run: sudo apt update + # - run: sudo make install-deps + # - run: make build-tests TYPE=Debug OPTIONS=noros TARGETS="all" TC=gcc ARGS=-V + # + # jammy_gcc_ros: + # runs-on: ubuntu-22.04 + # + # env: + # ROS_DISTRO: humble + # ROS_CI_DESKTOP: jammy + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP + # - run: sudo make install-deps + # - run: | + # source /opt/ros/$ROS_DISTRO/setup.bash + # make build-tests TYPE=Debug OPTIONS=ros2 TARGETS="all" TC=gcc ARGS=-V + # + # + # focal_gcc_noros: + # runs-on: ubuntu-20.04 + # steps: + # - uses: actions/checkout@v4 + # - run: sudo apt update + # - run: sudo make install-deps + # - run: make build-tests TYPE=Debug OPTIONS=noros TARGETS="all" TC=gcc ARGS=-V + # + # + # focal_clang_ros: + # runs-on: ubuntu-20.04 + # + # env: + # ROS_DISTRO: noetic + # ROS_HOSTNAME: localhost + # ROS_CI_DESKTOP: focal + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP + # - run: sudo make install-deps + # - run: | + # source /opt/ros/$ROS_DISTRO/setup.bash + # make build-tests TYPE=Debug OPTIONS=ros TARGETS="all" TC=clang ARGS=-V + # + # + # focal_gcc_ros: + # runs-on: ubuntu-20.04 + # + # env: + # ROS_DISTRO: noetic + # ROS_HOSTNAME: localhost + # ROS_CI_DESKTOP: focal + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP + # - run: sudo make install-deps + # - run: | + # source /opt/ros/$ROS_DISTRO/setup.bash + # make build-tests TYPE=Debug OPTIONS=ros TARGETS="all" TC=gcc ARGS=-V + # + # + # jammy_static_checks: + # runs-on: ubuntu-22.04 + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo apt update + # - run: $APT cppcheck + # - run: $APT python3-pip python3-setuptools + # - run: sudo pip3 install scspell3k + # - run: make cppcheck + # - run: make spell + # + # + # focal_gcc_ros_scanbuild: + # runs-on: ubuntu-20.04 + # + # env: + # ROS_DISTRO: noetic + # ROS_HOSTNAME: localhost + # ROS_CI_DESKTOP: focal + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP + # - run: sudo make install-deps + # - run: $APT clang-tools-12 clang-tidy-12 + # - run: | + # source /opt/ros/$ROS_DISTRO/setup.bash + # make clangcheck SCANBUILD=scan-build-12 OPTIONS=ros_tidy TC=gcc + # + # + # jammy_gcc_ros_scanbuild: + # runs-on: ubuntu-22.04 + # + # env: + # ROS_DISTRO: humble + # ROS_CI_DESKTOP: jammy + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP + # - run: sudo make install-deps + # - run: $APT clang-tools-15 clang-tidy-15 + # - run: | + # source /opt/ros/$ROS_DISTRO/setup.bash + # make clangcheck SCANBUILD=scan-build-15 OPTIONS=ros2_tidy TC=gcc + # + # + # jammy_gcc_noros_scanbuild: + # runs-on: ubuntu-22.04 + # + # steps: + # - uses: actions/checkout@v4 + # - run: sudo apt update + # - run: sudo make install-deps + # - run: $APT clang-tools-15 clang-tidy-15 + # - run: make clangcheck SCANBUILD=scan-build-15 OPTIONS=noros_tidy TC=gcc + # + jammy_ccws: runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - run: sudo make install-deps - - run: $APT fakeroot devscripts build-essential - - run: | - make deb-build DEB_TARGET=jammy - make deb-install DEB_TARGET=jammy - # make cmake_dependency # requires ROS - - - focal_deb_packages: - runs-on: ubuntu-20.04 - - env: - ROS_DISTRO: noetic - ROS_HOSTNAME: localhost - ROS_CI_DESKTOP: focal - - steps: - - uses: actions/checkout@v4 - - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP - - run: sudo make install-deps - - run: $APT fakeroot devscripts build-essential - - run: | - source /opt/ros/$ROS_DISTRO/setup.bash - make deb-build DEB_TARGET=focal - make deb-install DEB_TARGET=focal - make cmake_dependency - - - clang_noros: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - run: sudo apt update - - run: sudo make install-deps - - run: make build-tests TYPE=Debug OPTIONS=noros TARGETS="all" TC=clang ARGS=-V - - - jammy_gcc_noros: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - run: sudo apt update - - run: sudo make install-deps - - run: make build-tests TYPE=Debug OPTIONS=noros TARGETS="all" TC=gcc ARGS=-V - - jammy_gcc_ros: - runs-on: ubuntu-22.04 - - env: - ROS_DISTRO: humble - ROS_CI_DESKTOP: jammy - - steps: - - uses: actions/checkout@v4 - - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP - - run: sudo make install-deps - - run: | - source /opt/ros/$ROS_DISTRO/setup.bash - make build-tests TYPE=Debug OPTIONS=ros2 TARGETS="all" TC=gcc ARGS=-V - - - focal_gcc_noros: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 - - run: sudo apt update - - run: sudo make install-deps - - run: make build-tests TYPE=Debug OPTIONS=noros TARGETS="all" TC=gcc ARGS=-V - - - focal_clang_ros: - runs-on: ubuntu-20.04 - - env: - ROS_DISTRO: noetic - ROS_HOSTNAME: localhost - ROS_CI_DESKTOP: focal - - steps: - - uses: actions/checkout@v4 - - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP - - run: sudo make install-deps - - run: | - source /opt/ros/$ROS_DISTRO/setup.bash - make build-tests TYPE=Debug OPTIONS=ros TARGETS="all" TC=clang ARGS=-V - - - focal_gcc_ros: - runs-on: ubuntu-20.04 - - env: - ROS_DISTRO: noetic - ROS_HOSTNAME: localhost - ROS_CI_DESKTOP: focal - steps: - uses: actions/checkout@v4 - - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP - - run: sudo make install-deps - - run: | - source /opt/ros/$ROS_DISTRO/setup.bash - make build-tests TYPE=Debug OPTIONS=ros TARGETS="all" TC=gcc ARGS=-V - - - jammy_static_checks: - runs-on: ubuntu-22.04 - - steps: + with: + repository: asherikov/ccws - uses: actions/checkout@v4 - - run: sudo apt update - - run: $APT cppcheck - - run: $APT python3-pip python3-setuptools - - run: sudo pip3 install scspell3k - - run: make cppcheck - - run: make spell - - - focal_gcc_ros_scanbuild: - runs-on: ubuntu-20.04 - - env: - ROS_DISTRO: noetic - ROS_HOSTNAME: localhost - ROS_CI_DESKTOP: focal + with: + ref: pkg_ws_2 + path: src/ariles_ws + - run: cd src/ariles_ws; make update VERSION=${GITHUB_SHA}; rm -Rf ariles2_rosparam_ws demo + - run: make bp_install_build BUILD_PROFILE=static_checks + - run: make BUILD_PROFILE=static_checks + - run: make bp_install_build BUILD_PROFILE=scan_build + - run: make dep_install PKG=ariles2_core_ws + - run: make dep_install PKG=ariles2_graphviz_ws + - run: make dep_install PKG=ariles2_namevalue2_ws + - run: make dep_install PKG=ariles2_octave_ws + - run: make dep_install PKG=ariles2_pugixml_ws + - run: make dep_install PKG=ariles2_rapidjson_ws + - run: make dep_install PKG=ariles2_ros2param_ws + - run: make dep_install PKG=ariles2_yamlcpp_ws + - run: make _ws BUILD_PROFILE=scan_build - steps: - - uses: actions/checkout@v4 - - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP - - run: sudo make install-deps - - run: $APT clang-tools-12 clang-tidy-12 - - run: | - source /opt/ros/$ROS_DISTRO/setup.bash - make clangcheck SCANBUILD=scan-build-12 OPTIONS=ros_tidy TC=gcc - - - jammy_gcc_ros_scanbuild: - runs-on: ubuntu-22.04 - - env: - ROS_DISTRO: humble - ROS_CI_DESKTOP: jammy - - steps: - - uses: actions/checkout@v4 - - run: sudo make install-ros ROS_DISTRO=$ROS_DISTRO UBUNTU_DISTRO=$ROS_CI_DESKTOP - - run: sudo make install-deps - - run: $APT clang-tools-15 clang-tidy-15 - - run: | - source /opt/ros/$ROS_DISTRO/setup.bash - make clangcheck SCANBUILD=scan-build-15 OPTIONS=ros2_tidy TC=gcc - - - jammy_gcc_noros_scanbuild: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - run: sudo apt update - - run: sudo make install-deps - - run: $APT clang-tools-15 clang-tidy-15 - - run: make clangcheck SCANBUILD=scan-build-15 OPTIONS=noros_tidy TC=gcc diff --git a/include/ariles2/visitors/read.h b/include/ariles2/visitors/read.h index 634da691..5bbb474f 100644 --- a/include/ariles2/visitors/read.h +++ b/include/ariles2/visitors/read.h @@ -307,6 +307,7 @@ namespace ariles2 CPPUT_ASSERT(this->startMapEntry("data"), "Missing 'data' in a matrix entry."); + // cppcheck-suppress unreadVariable const std::size_t vec_len = this->startVector(); CPPUT_ASSERT(cols * rows == vec_len, "Inconsistent matrix size."); } @@ -330,6 +331,7 @@ namespace ariles2 if (not param.flat_matrices_ and 0 != row_index) { this->startArrayElement(); + // cppcheck-suppress unreadVariable const std::size_t vec_len = this->startVector(); CPPUT_ASSERT(cols == vec_len, "Inconsistent matrix row length."); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1319685a..3d0814be 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,7 @@ find_package(Boost REQUIRED unit_test_framework timer random system) include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) -include_directories(SYSTEM "${CMAKE_CURRENT_LIST_DIR}/common/") +include_directories(SYSTEM "${PROJECT_BINARY_DIR}/tests/3rdparty") +configure_file("${CMAKE_CURRENT_LIST_DIR}/common/better_enum.h.hide" "${PROJECT_BINARY_DIR}/tests/3rdparty/better_enum.h" COPYONLY) list(APPEND ARILES_TESTING_LIBRARIES "${Boost_LIBRARIES}") diff --git a/tests/api_v2/fixtures/013_write_namevalue.h b/tests/api_v2/fixtures/013_write_namevalue.h index f8663539..cd128d0a 100644 --- a/tests/api_v2/fixtures/013_write_namevalue.h +++ b/tests/api_v2/fixtures/013_write_namevalue.h @@ -150,6 +150,7 @@ namespace ariles_tests BOOST_CHECK_EQUAL(writer.template get().index_, name_value_pairs.size()); BOOST_CHECK_EQUAL(name_value_pairs_back.size(), name_value_pairs.size()); + // cppcheck-suppress unsignedLessThanZero for (std::size_t i = 0; i < name_value_pairs.size(); ++i) { BOOST_CHECK_EQUAL(name_value_pairs[i].first, ""); diff --git a/tests/common/better_enum.h b/tests/common/better_enum.h.hide similarity index 100% rename from tests/common/better_enum.h rename to tests/common/better_enum.h.hide