From ea22ccd679c7374c48eec6fcbd756995b3c7f516 Mon Sep 17 00:00:00 2001 From: Kenneth Jia <48558845+kenneth-jia@users.noreply.github.com> Date: Mon, 1 Jul 2024 18:06:55 +0800 Subject: [PATCH] Fix CI failures --- .clang-tidy | 9 +++++++++ .github/workflows/kafka_api_ci_tests.yml | 20 ++++++++++--------- .../workflows/kafka_api_demo_conan_build.yml | 2 +- scripts/start-local-kafka-cluster.py | 2 +- tests/integration/TestKafkaConsumer.cc | 2 -- tests/robustness/TestAdminClient.cc | 2 ++ tests/unit/TestBrokerMetadata.cc | 5 +++++ tests/utils/TestUtility.h | 2 +- 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 71c2b9b31..011097f2e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -4,6 +4,7 @@ Checks: "*,\ -llvmlibc-restrict-system-libc-headers,\ -llvmlibc-callee-namespace,\ -llvmlibc-implementation-in-namespace,\ + -llvmlibc-inline-function-decl,\ -altera-*,\ -fuchsia-*,\ -google-readability-namespace-comments,\ @@ -14,6 +15,7 @@ Checks: "*,\ -modernize-deprecated-headers,\ -modernize-use-trailing-return-type,\ -modernize-concat-nested-namespaces,\ + -modernize-type-traits,\ -hicpp-special-member-functions,\ -hicpp-vararg,\ -hicpp-no-malloc,\ @@ -36,15 +38,22 @@ Checks: "*,\ -cppcoreguidelines-pro-type-union-access,\ -misc-non-private-member-variables-in-classes,\ -misc-no-recursion,\ + -misc-include-cleaner,\ -readability-magic-numbers,\ -readability-implicit-bool-conversion,\ -readability-braces-around-statements,\ -readability-isolate-declaration,\ -readability-identifier-length,\ -readability-function-cognitive-complexity,\ + -readability-avoid-nested-conditional-operator,\ + -bugprone-empty-catch,\ -bugprone-unused-return-value,\ -bugprone-easily-swappable-parameters,\ -bugprone-exception-escape,\ + -bugprone-optional-value-conversion,\ -cert-err58-cpp,\ + -performance-avoid-endl,\ + -performance-enum-size,\ -clang-analyzer-optin.performance.Padding" + diff --git a/.github/workflows/kafka_api_ci_tests.yml b/.github/workflows/kafka_api_ci_tests.yml index 1ca2a5e40..2bf35b6d7 100644 --- a/.github/workflows/kafka_api_ci_tests.yml +++ b/.github/workflows/kafka_api_ci_tests.yml @@ -300,15 +300,17 @@ jobs: # Install googletest vcpkg install gtest - cp -v "C:\VCPKG\INSTALLED\x86-windows\lib\manual-link\gtest_main*" "C:\VCPKG\INSTALLED\x86-windows\lib\" - cp -v "C:\VCPKG\INSTALLED\x86-windows\lib\manual-link\gtest_main*" "C:\VCPKG\INSTALLED\x86-windows\lib\" + + cp -v "C:\VCPKG\INSTALLED\x64-windows\lib\manual-link\gtest_main*" "C:\VCPKG\INSTALLED\x64-windows\lib\" + cp -v "C:\VCPKG\INSTALLED\x64-windows\lib\manual-link\gtest_main*" "C:\VCPKG\INSTALLED\x64-windows\lib\" # Install boost headers/libraries vcpkg install boost-optional vcpkg install boost-algorithm vcpkg install boost-program-options - cp -v "C:\VCPKG\INSTALLED\x86-windows\lib\boost_program_options-vc140-mt.lib" "C:\VCPKG\INSTALLED\x86-windows\lib\boost_program_options.lib" + ls "C:\VCPKG\INSTALLED\x64-windows\lib" + cp -v "C:\VCPKG\INSTALLED\x64-windows\lib\boost_program_options-vc144-mt-x64-1_85.lib" "C:\VCPKG\INSTALLED\x64-windows\lib\boost_program_options.lib" # Install rapidjson vcpkg install rapidjson @@ -319,13 +321,13 @@ jobs: run: | cd $Env:BUILD_SUB_DIR - $Env:GTEST_ROOT='C:\VCPKG\INSTALLED\x86-windows\' - $Env:BOOST_ROOT='C:\VCPKG\INSTALLED\x86-windows\' - $Env:LIBRDKAFKA_INCLUDE_DIR='C:\VCPKG\INSTALLED\x86-windows\include\' - $Env:LIBRDKAFKA_LIBRARY_DIR='C:\VCPKG\INSTALLED\x86-windows\lib\' - $Env:RAPIDJSON_INCLUDE_DIRS='C:\VCPKG\INSTALLED\x86-windows\include\' + $Env:GTEST_ROOT='C:\VCPKG\INSTALLED\x64-windows\' + $Env:BOOST_ROOT='C:\VCPKG\INSTALLED\x64-windows\' + $Env:LIBRDKAFKA_INCLUDE_DIR='C:\VCPKG\INSTALLED\x64-windows\include\' + $Env:LIBRDKAFKA_LIBRARY_DIR='C:\VCPKG\INSTALLED\x64-windows\lib\' + $Env:RAPIDJSON_INCLUDE_DIRS='C:\VCPKG\INSTALLED\x64-windows\include\' - cmake -B ./ -A Win32 -S ../.. "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" + cmake -B ./ -A x64 -S ../.. "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" - name: Build run: | diff --git a/.github/workflows/kafka_api_demo_conan_build.yml b/.github/workflows/kafka_api_demo_conan_build.yml index 8d13a0cd4..ea3014fa1 100644 --- a/.github/workflows/kafka_api_demo_conan_build.yml +++ b/.github/workflows/kafka_api_demo_conan_build.yml @@ -28,7 +28,7 @@ jobs: - name: Prepare run: | - pip3 install conan==1.59.0 + pip3 install conan==1.64.1 - name: Build (non-windows) if: ${{!contains(matrix.os, 'windows')}} diff --git a/scripts/start-local-kafka-cluster.py b/scripts/start-local-kafka-cluster.py index 6856460b3..a39c0dec7 100755 --- a/scripts/start-local-kafka-cluster.py +++ b/scripts/start-local-kafka-cluster.py @@ -157,7 +157,7 @@ def main(): cmd = 'lsof -nP -iTCP:{0} | grep LISTEN'.format(brokerPort) cmdCall = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) (out, err) = cmdCall.communicate(); - matched = re.search('[^\s-]+ +([0-9]+) +.*', out.decode('utf-8')) + matched = re.search(r'[^\s-]+ +([0-9]+) +.*', out.decode('utf-8')) if matched: kafkaBrokerPids.append(matched.group(1)) diff --git a/tests/integration/TestKafkaConsumer.cc b/tests/integration/TestKafkaConsumer.cc index 516454200..dc584dc8d 100644 --- a/tests/integration/TestKafkaConsumer.cc +++ b/tests/integration/TestKafkaConsumer.cc @@ -5,8 +5,6 @@ #include "gtest/gtest.h" -#include - #include #include #include diff --git a/tests/robustness/TestAdminClient.cc b/tests/robustness/TestAdminClient.cc index e38b775ff..4b7d06296 100755 --- a/tests/robustness/TestAdminClient.cc +++ b/tests/robustness/TestAdminClient.cc @@ -1,6 +1,8 @@ #include "../utils/TestUtility.h" #include "kafka/AdminClient.h" +#include "kafka/Types.h" +#include "kafka/Utility.h" #include "gtest/gtest.h" diff --git a/tests/unit/TestBrokerMetadata.cc b/tests/unit/TestBrokerMetadata.cc index 000e3bc0b..da1e66a26 100644 --- a/tests/unit/TestBrokerMetadata.cc +++ b/tests/unit/TestBrokerMetadata.cc @@ -1,7 +1,12 @@ #include "kafka/BrokerMetadata.h" +#include "kafka/Types.h" #include "gtest/gtest.h" +#include +#include +#include + TEST(BrokerMetadata, Node) { diff --git a/tests/utils/TestUtility.h b/tests/utils/TestUtility.h index 932ee8d56..dd6c49c28 100644 --- a/tests/utils/TestUtility.h +++ b/tests/utils/TestUtility.h @@ -208,7 +208,7 @@ CreateKafkaTopic(const kafka::Topic& topic, int numPartitions, int replicationFa class JoiningThread { public: template - explicit JoiningThread(F&& f, Args&&... args): _t(f, args...) {} + explicit JoiningThread(F&& f, Args&&... args): _t(std::forward(f), args...) {} ~JoiningThread() { if (_t.joinable()) _t.join(); } private: std::thread _t;