-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: Add custom GitHub Actions job to run clang-tidy #5235
CI: Add custom GitHub Actions job to run clang-tidy #5235
Conversation
Hmm. I tried adding
|
ci/run_clang_tidy.sh
Outdated
cmake -DGPU_ARCHS=70 \ | ||
-DBLAS_LIBRARIES=${CONDA_PREFIX}/lib/libopenblas.so.0 \ | ||
.. | ||
make -j treelite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to build treelite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, no, we do not actually build anything to run clang-tidy, but we do have to invoke CMake to create the compile command database. That's why I added a --nobuild
option to our build script in 2c28995 . I assume that the previous targets where an attempt at reducing the build time, but I think not building anything is the better (and faster) approach.
8a94377
to
d12d082
Compare
Needed by default unless the --nolibcumltest option is provided to the build.sh script.
5e44948
to
ac4bb40
Compare
Tagging @wphicks who previously expressed interest in this PR. |
build.sh
Outdated
@@ -46,6 +46,7 @@ HELP="$0 [<target> ...] [<flag> ...] | |||
--codecov - Enable code coverage support by compiling with Cython linetracing | |||
and profiling enabled (WARNING: Impacts performance) | |||
--ccache - Use ccache to cache previous compilations | |||
--nobuild - Invoke CMake without actually building |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another name might be --configure-only
. Just a proposal, no strong feelings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I prefer --no-build
over --nobuild
, if we choose to keep the current name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me, too, but this was more consistent with the other option names. Regardless, I changed it to --configure-only
now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dependencies.yaml
Outdated
packages: | ||
- clang==15.0.7 | ||
- clang-tools==15.0.7 | ||
- make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use ninja
instead? Tends to be faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpp/scripts/run-clang-tidy.py
Outdated
@@ -239,7 +265,7 @@ def main(): | |||
if not os.path.exists(".git"): | |||
raise Exception("This needs to always be run from the root of repo") | |||
# Check whether clang-tidy exists | |||
if shutil.which("clang-tidy") is not None: | |||
if shutil.which("clang-tidy") is None: | |||
print("clang-tidy not found. Exiting...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe raise an exception here instead? It seems to me that a silent pass could be problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One quick request
ci/run_clang_tidy.sh
Outdated
@@ -0,0 +1,22 @@ | |||
#!/bin/bash | |||
# Copyright (c) 2020-2023, NVIDIA CORPORATION. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright (c) 2020-2023, NVIDIA CORPORATION. | |
# Copyright (c) 2023, NVIDIA CORPORATION. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to submit this comment in the prior review
ci/run_clang_tidy.sh
Outdated
|
||
rapids-logger "Run clang-tidy" | ||
|
||
python cpp/scripts/run-clang-tidy.py -ignore '[.]cu$|_deps|examples/kmeans/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get a section in https://github.com/rapidsai/cuml/blob/branch-23.08/CONTRIBUTING.md#code-formatting that quickly describes how to run this locally for devs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in c4e6565 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving ops-codeowner
file changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very nice! Nothing further to add beyond what other reviewers have mentioned.
To make it easier for developers to reproducibly run it.
Adds dedicated conda environment.
/merge |
Follow-up from #4983 ; should be merged after that.