From 17fc40e1ebb7c7c8f751fb62a609b69c0a9b73f2 Mon Sep 17 00:00:00 2001 From: silverqx Date: Sat, 4 Dec 2021 11:01:54 +0100 Subject: [PATCH] =?UTF-8?q?added=20clang-tidy=20github=20action=20?= =?UTF-8?q?=F0=9F=94=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .clang-tidy | 4 +- .github/workflows/analyzers.yml | 90 +++++++++++++++++++++++++++++++++ .github/workflows/linux.yml | 3 +- 3 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/analyzers.yml diff --git a/.clang-tidy b/.clang-tidy index 32d16d153..981a44990 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,6 @@ --- -Checks: '-*,bugprone-*,clang-*,concurrency-*,cppcoreguidelines-*,google-*,llvm-*,misc-*,modernize-*,performance-*,portability-*,readability-*,-bugprone-easily-swappable-parameters,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-c-copy-assignment-signature,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-google-default-arguments,-google-readability-braces-around-statements,-google-readability-function-size,-google-readability-todo,-llvm-header-guard,-misc-non-private-member-variables-in-classes,-modernize-use-nodiscard,-modernize-use-trailing-return-type,-performance-move-const-arg,-readability-braces-around-statements,-readability-convert-member-functions-to-static,-readability-magic-numbers' -WarningsAsErrors: '' +Checks: '-*,bugprone-*,clang-*,concurrency-*,cppcoreguidelines-*,google-*,llvm-*,misc-*,modernize-*,performance-*,portability-*,readability-*,-bugprone-easily-swappable-parameters,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-c-copy-assignment-signature,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-special-member-functions,-google-default-arguments,-google-readability-braces-around-statements,-google-readability-function-size,-google-readability-todo,-llvm-header-guard,-misc-non-private-member-variables-in-classes,-modernize-use-nodiscard,-modernize-use-trailing-return-type,-performance-move-const-arg,-readability-braces-around-statements,-readability-convert-member-functions-to-static,-readability-magic-numbers' +WarningsAsErrors: '*' HeaderFilterRegex: 'orm/.+\.(h|hpp)$' FormatStyle: none InheritParentConfig: false diff --git a/.github/workflows/analyzers.yml b/.github/workflows/analyzers.yml new file mode 100644 index 000000000..63e091830 --- /dev/null +++ b/.github/workflows/analyzers.yml @@ -0,0 +1,90 @@ +name: Analyzers + +on: + pull_request: + push: + branches: + - main + - gh-actions + +jobs: + + clang-tidy: + name: clang-tidy + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + - name: add-apt-repository gcc 11 and Qt 5.15.2 + run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo add-apt-repository -y ppa:beineri/opt-qt-5.15.2-focal + + - name: add-apt-repository Clang 13 + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository -y "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" + + - name: apt update + run: | + sudo apt update + + - name: apt install clang-13, lld, g++-11, clang-tidy-13, Qt 5.15.2 base, and ccache + run: | + sudo apt install -y clang-13 lld g++-11 clang-tidy-13 qt515base ccache + + - name: ninja install latest version + uses: seanmiddleditch/gha-setup-ninja@master + with: + destination: ${{ runner.workspace }}/../ninja-build + + - name: TinyORM create build folder (clang13-cmake-debug) + run: | + mkdir -p ../TinyORM-builds-cmake/build-clang13-cmake-debug + + - name: ccache setup 🕺 + uses: Chocobo1/setup-ccache-action@v1 + with: + install_ccache: false + update_packager_index: false + ccache_options: | + compression = false + max_size = 3G + + - name: vcpkg set-up environment + run: | + echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV + echo 'VCPKG_OVERLAY_TRIPLETS=${{ github.workspace }}/.github/resources/vcpkg-custom-triplets' \ + >> $GITHUB_ENV + echo 'VCPKG_DEFAULT_TRIPLET=x64-linux-dynamic' >> $GITHUB_ENV + echo 'VCPKG_MAX_CONCURRENCY=2' >> $GITHUB_ENV + + - name: TinyORM cmake configure (clang13-cmake-debug) + run: >- + source .github/resources/qt5env.sh + + cmake + -S . + -B ../TinyORM-builds-cmake/build-clang13-cmake-debug + -G Ninja + -D CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache + -D CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++-13 + -D CMAKE_TOOLCHAIN_FILE:FILEPATH="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + -D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON + -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON + -D CMAKE_BUILD_TYPE:BOOL=Debug + -D VERBOSE_CONFIGURE:BOOL=ON + -D MATCH_EQUAL_EXPORTED_BUILDTREE:BOOL=OFF + -D MYSQL_PING:BOOL=ON + -D BUILD_TESTS:BOOL=ON + + - name: TinyORM cmake build ✨ (clang13-cmake-debug) + run: | + source .github/resources/qt5env.sh + cmake --build ../TinyORM-builds-cmake/build-clang13-cmake-debug --target all --parallel 2 + + - name: TinyORM execute clang-tidy 🔥 + working-directory: ../TinyORM-builds-cmake/build-clang13-cmake-debug + run: run-clang-tidy-13 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3970c7feb..b1ba7a519 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -179,7 +179,8 @@ jobs: -S . -B ../TinyORM-builds-cmake/build-${{ matrix.compiler.key }}-cmake-debug -G Ninja - -D CMAKE_CXX_COMPILER:FILEPATH="${{ env.ccache_symlinks_path }}/${{ matrix.compiler.command }}" + -D CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache + -D CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/${{ matrix.compiler.command }} -D CMAKE_TOOLCHAIN_FILE:FILEPATH="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON -D CMAKE_BUILD_TYPE:BOOL=Debug