-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add GitHub action for clang-tidy
Signed-off-by: Jared Van Bortel <[email protected]>
- Loading branch information
1 parent
3320094
commit 319932b
Showing
2 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# vim: set ft=yaml: | ||
HeaderFilterRegex: '/gpt4all-(backend|chat)/(src|include)/' | ||
Checks: | ||
- 'bugprone-*' | ||
- 'cert-*' | ||
- 'clang-analyzer-*' | ||
- 'cppcoreguidelines-*' | ||
- 'google-*' | ||
- 'misc-*' | ||
- 'modernize-*' | ||
- 'performance-*' | ||
- 'portability-*' | ||
- 'readability-*' | ||
- '-*-avoid-c-arrays' | ||
- '-*-macro-to-enum' | ||
- '-*-magic-numbers' | ||
- '-*-narrowing-conversions' | ||
- '-*-non-private-member-variables-in-classes' | ||
- '-*-use-default-member-init' | ||
- '-*readability-braces-around-statements' | ||
- '-bugprone-assignment-in-if-condition' | ||
- '-bugprone-branch-clone' | ||
- '-bugprone-easily-swappable-parameters' | ||
- '-bugprone-implicit-widening-of-multiplication-result' | ||
- '-bugprone-inc-dec-in-conditions' | ||
- '-bugprone-suspicious-string-compare' | ||
- '-bugprone-switch-missing-default-case' | ||
- '-cert-dcl03-c' | ||
- '-cert-err33-c' | ||
- '-cert-err58-cpp' | ||
- '-clang-analyzer-core.CallAndMessage' | ||
- '-clang-analyzer-deadcode.DeadStores' | ||
- '-clang-analyzer-optin.performance.Padding' | ||
- '-clang-diagnostic-missing-include-dirs' | ||
- '-cppcoreguidelines-avoid-do-while' | ||
- '-cppcoreguidelines-avoid-goto' | ||
- '-cppcoreguidelines-avoid-non-const-global-variables' | ||
- '-cppcoreguidelines-explicit-virtual-functions' | ||
- '-cppcoreguidelines-init-variables' | ||
- '-cppcoreguidelines-macro-usage' | ||
- '-cppcoreguidelines-no-malloc' | ||
- '-cppcoreguidelines-noexcept-move-operations' | ||
- '-cppcoreguidelines-owning-memory' | ||
- '-cppcoreguidelines-prefer-member-initializer' | ||
- '-cppcoreguidelines-pro-bounds-array-to-pointer-decay' | ||
- '-cppcoreguidelines-pro-bounds-pointer-arithmetic' | ||
- '-cppcoreguidelines-pro-type-const-cast' | ||
- '-cppcoreguidelines-pro-type-cstyle-cast' | ||
- '-cppcoreguidelines-pro-type-member-init' | ||
- '-cppcoreguidelines-pro-type-reinterpret-cast' | ||
- '-cppcoreguidelines-pro-type-static-cast-downcast' | ||
- '-cppcoreguidelines-pro-type-vararg' | ||
- '-cppcoreguidelines-rvalue-reference-param-not-moved' | ||
- '-cppcoreguidelines-special-member-functions' | ||
- '-cppcoreguidelines-virtual-class-destructor' | ||
- '-google-build-using-namespace' | ||
- '-google-default-arguments' | ||
- '-google-explicit-constructor' | ||
- '-google-global-names-in-headers' | ||
- '-google-readability-casting' | ||
- '-google-readability-namespace-comments' | ||
- '-google-readability-todo' | ||
- '-google-runtime-int' | ||
- '-misc-const-correctness' | ||
- '-misc-include-cleaner' | ||
- '-misc-no-recursion' | ||
- '-misc-static-assert' | ||
- '-misc-unused-parameters' | ||
- '-misc-use-anonymous-namespace' | ||
- '-misc-use-internal-linkage' | ||
- '-modernize-avoid-bind' | ||
- '-modernize-deprecated-headers' | ||
- '-modernize-loop-convert' | ||
- '-modernize-raw-string-literal' | ||
- '-modernize-return-braced-init-list' | ||
- '-modernize-use-auto' | ||
- '-modernize-use-designated-initializers' | ||
- '-modernize-use-equals-default' | ||
- '-modernize-use-nodiscard' | ||
- '-modernize-use-override' | ||
- '-modernize-use-ranges' | ||
- '-modernize-use-std-print' | ||
- '-modernize-use-trailing-return-type' | ||
- '-modernize-use-using' | ||
- '-performance-avoid-endl' | ||
- '-performance-enum-size' | ||
- '-performance-faster-string-find' | ||
- '-performance-for-range-copy' | ||
- '-performance-implicit-conversion-in-loop' | ||
- '-performance-move-const-arg' | ||
- '-performance-noexcept-move-constructor' | ||
- '-performance-unnecessary-copy-initialization' | ||
- '-performance-unnecessary-value-param' | ||
- '-readability-avoid-const-params-in-decls' | ||
- '-readability-avoid-nested-conditional-operator' | ||
- '-readability-avoid-return-with-void-value' | ||
- '-readability-avoid-unconditional-preprocessor-if' | ||
- '-readability-const-return-type' | ||
- '-readability-container-size-empty' | ||
- '-readability-convert-member-functions-to-static' | ||
- '-readability-else-after-return' | ||
- '-readability-function-cognitive-complexity' | ||
- '-readability-identifier-length' | ||
- '-readability-implicit-bool-conversion' | ||
- '-readability-inconsistent-declaration-parameter-name' | ||
- '-readability-math-missing-parentheses' | ||
- '-readability-named-parameter' | ||
- '-readability-non-const-parameter' | ||
- '-readability-qualified-auto' | ||
- '-readability-redundant-access-specifiers' | ||
- '-readability-redundant-inline-specifier' | ||
- '-readability-redundant-member-init' | ||
- '-readability-redundant-string-init' | ||
- '-readability-simplify-boolean-expr' | ||
- '-readability-static-accessed-through-instance' | ||
- '-readability-suspicious-call-argument' | ||
- '-readability-uppercase-literal-suffix' | ||
- '-readability-use-anyofallof' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: cpp-linter | ||
|
||
on: | ||
pull_request: | ||
paths: ['**.c', '**.cpp', '**.h', '**.inl', '**CMakeLists.txt', '**.cmake'] | ||
push: | ||
branches: [main] | ||
paths: ['**.c', '**.cpp', '**.h', '**.inl', '**CMakeLists.txt', '**.cmake'] | ||
|
||
jobs: | ||
cpp-linter: | ||
name: Clazy | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
- name: Install dependencies | ||
run: | | ||
wget -qO- 'https://apt.llvm.org/llvm-snapshot.gpg.key' | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc >/dev/null | ||
sudo add-apt-repository -y 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | ||
sudo apt-get update | ||
sudo apt-get install clang-18 clang-format-18 clang-tidy-18 cmake libopengl-dev libxkbcommon-dev | ||
- name: Install Qt | ||
env: | ||
QT_EMAIL: ${{ secrets.QT_EMAIL }} | ||
QT_PASSWORD: ${{ secrets.QT_PASSWORD }} | ||
run: | | ||
wget 'https://qt.mirror.constant.com/archive/online_installers/4.8/qt-online-installer-linux-x64-4.8.0.run' | ||
chmod +x qt-online-installer-linux-x64-4.8.0.run | ||
./qt-online-installer-linux-x64-4.8.0.run --no-force-installations --no-default-installations --no-size-checking --default-answer --accept-licenses --confirm-command --accept-obligations --email "$QT_EMAIL" --password "$QT_PASSWORD" install qt.qt6.680.gcc_64 qt.qt6.680.addons.qtpdf qt.qt6.680.addons.qthttpserver | ||
- name: Configure | ||
run: | | ||
sed -i '/file(DOWNLOAD/,+4 s/^/#/' CMakeLists.txt | ||
cmake -S gpt4all-chat -B gpt4all-chat/build \ | ||
-DCMAKE_C_COMPILER=clang-18 \ | ||
-DCMAKE_CXX_COMPILER=clang++-18 \ | ||
-DLLMODEL_CUDA=OFF \ | ||
-DLLMODEL_KOMPUTE=OFF | ||
- uses: cpp-linter/cpp-linter-action@v2 | ||
id: linter | ||
env: | ||
with: | ||
style: '' # no clang-format | ||
extensions: 'c,cpp,h,inl' | ||
tidy-checks: '' # use .clang-tidy config | ||
database: gpt4all-chat/build | ||
version: 18 | ||
- name: Fail Fast | ||
if: steps.linter.outputs.clang-tidy-checks-failed > 0 | ||
run: exit 1 |