diff --git a/.github/workflows/clangtidy.yml b/.github/workflows/clangtidy.yml index 1fed159..91b249c 100644 --- a/.github/workflows/clangtidy.yml +++ b/.github/workflows/clangtidy.yml @@ -21,7 +21,7 @@ jobs: - name: Install clang-tidy run: | - sudo apt get install -y clang-tidy + sudo apt install -y clang-tidy - name: Build and generate compile_commands.json run: | @@ -33,11 +33,18 @@ jobs: - name: Run clang-tidy run: | - git diff -U0 origin/${{ github.base_ref }}...HEAD \ + git diff -U0 origin/${{ github.base_ref }}...HEAD | \ clang-tidy-diff -p1 -path build -export-fixes build/Release/clang-tidy-fixes.yml - name: Post clang-tidy comments - uses: ZedThree/clang-tidy-review@v0.20.1 + #uses: ZedThree/clang-tidy-review@v0.20.1 + uses: stsoe/clang-tidy-review@6d2aee59f56cf41f32baa4123cc636fff8ef4eb7 with: - clang_tidy_fixes: build/Release/clang-tidy-fixes.yml - github_token: ${{ secrets.GITHUB_TOKEN }} + build_dir: build/Release + # disable default checks and rely on closest .clangtidy + clang_tidy_checks: '' + token: ${{ secrets.GITHUB_TOKEN }} + + # If there are any comments, fail the check + - if: steps.review.outputs.total_comments > 0 + run: exit 1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 86b8ec5..36de04c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,9 +2,5 @@ if(POLICY CMP0167) cmake_policy(SET CMP0167 NEW) endif() -find_package(Boost REQUIRED) -message("-- Boost_INCLUDE_DIRS=${Boost_INCLUDE_DIRS}") - add_executable(main hello.cpp) -target_include_directories(main PRIVATE ${Boost_INCLUDE_DIRS}) install(TARGETS main) diff --git a/src/hello.cpp b/src/hello.cpp index 0b4a159..1953908 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -1,10 +1,28 @@ #include #include -#include +class X +{ + std::string m_string; +public: + X(const std::string& str) : m_string(str) {} + + std::string + get_string() + { + return m_string; + } +}; + +std::string hello() +{ + std::string const str = "hello"; + X x(str); + return x.get_string(); +} int main() { - std::cout << "hello" << std::endl; + std::cout << hello() << '\n'; return 0; }