diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9f1bf11c9..1f91afdc5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -141,7 +141,7 @@ jobs: architecture: 'x64' - name: Install Python packages run: | - python -m pip install wheel setuptools cpplint pylint + python -m pip install wheel setuptools cmakelint cpplint pylint - name: Run lint run: | python3 tests/ci_build/lint_cpp.py xgboost cpp R-package/src @@ -150,3 +150,5 @@ jobs: --exclude_path python-package/xgboost/dmlc-core python-package/xgboost/include \ python-package/xgboost/lib python-package/xgboost/rabit \ python-package/xgboost/src + + sh ./tests/ci_build/lint_cmake.sh || true diff --git a/tests/ci_build/lint_cmake.sh b/tests/ci_build/lint_cmake.sh new file mode 100644 index 000000000..d67ecd084 --- /dev/null +++ b/tests/ci_build/lint_cmake.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +cmake_files=$( + find . -name CMakeLists.txt -o -path "./cmake/*.cmake" \ + | grep -v dmlc-core \ + | grep -v gputreeshap +) +cmakelint \ + --linelength=120 \ + --filter=-convention/filename,-package/stdargs,-readability/wonkycase \ + ${cmake_files} \ +|| exit 1