-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH Actions: Enable local and remote clang-tidy scan on Linux (#579)
- Loading branch information
1 parent
b5a1e83
commit a642000
Showing
8 changed files
with
837 additions
and
7 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
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,72 @@ | ||
name: Run clang-tidy | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
clang-tidy-scan: | ||
runs-on: ubuntu-20.04 | ||
continue-on-error: true | ||
|
||
steps: | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install ninja-build doxygen graphviz libcurl4-openssl-dev libprotobuf-dev libprotoc-dev protobuf-compiler libhdf5-dev qt5-default | ||
sudo apt-get install clang-tidy | ||
- name: Display version info | ||
run: | | ||
echo $(g++ --version) | ||
echo $(clang --version) | ||
echo $(cmake --version) | ||
echo $(clang-tidy --version) | ||
# https://github.com/actions/download-artifact | ||
- name: Download the built directory | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ecal-dir | ||
|
||
# replace the working directory | ||
- name: Extract the tarball archive | ||
run: mv ecal.tar.gz ../. && cd .. && rm -rf ecal && tar -xzf ecal.tar.gz && cd ecal | ||
|
||
# https://github.com/Ana06/get-changed-files | ||
- name: Detect the changeset | ||
id: changed_files | ||
uses: Ana06/get-changed-files@v2.1.0 | ||
|
||
# see: ./build.sh --help | ||
- name: Run clang-tidy on the changeset | ||
id: suffix | ||
run: | | ||
build_linux/clang-tidy/build.sh -a -b ../../../_build -f ${{ steps.changed_files.outputs.added_modified }} | ||
# https://github.com/actions/upload-artifact | ||
# If make or clang-tidy is never called, artifact upload will fail (no log files) with just a warning. | ||
- name: Archive logs as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: clang_tidy_log_${{ steps.suffix.outputs.timestamp }} | ||
path: ~/work/ecal/_build/clang_tidy_log_*.txt | ||
if-no-files-found: warn | ||
|
||
- name: Detect number of clang-tidy warnings | ||
id: num_warnings | ||
run: | | ||
NUM_WARNINGS=0 | ||
NUM_LOG_FILES=$(ls ~/work/ecal/_build/clang_tidy_log_*.txt 2> /dev/null | wc -l) | ||
if [[ ${NUM_LOG_FILES} -gt 0 ]] | ||
then | ||
NUM_WARNINGS=$(grep -oE "\w+\.\w+:\w+:\w+:\s?warning:\s?.*" -- ~/work/ecal/_build/clang_tidy_log_*.txt | wc -l) | ||
fi | ||
echo "::set-output name=value::${NUM_WARNINGS}" | ||
# https://github.com/actions/github-script | ||
- name: Check clang-tidy warnings | ||
if: ${{ steps.num_warnings.outputs.value > 0 }} | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
core.setFailed('number of clang-tidy warnings: ${{ steps.num_warnings.outputs.value}}') |
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 |
---|---|---|
|
@@ -45,3 +45,6 @@ doc/extensions/_autogen | |
.idea | ||
cmake-build-* | ||
|
||
# clang-tidy | ||
/.clang-tidy | ||
log_*.txt |
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
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,19 @@ | ||
--- | ||
Checks: "*, | ||
-abseil-*, | ||
-altera-*, | ||
-android-*, | ||
-fuchsia-*, | ||
-google-*, | ||
-llvm*, | ||
-modernize-use-trailing-return-type, | ||
-zircon-*, | ||
-readability-else-after-return, | ||
-readability-static-accessed-through-instance, | ||
-readability-avoid-const-params-in-decls, | ||
-cppcoreguidelines-non-private-member-variables-in-classes, | ||
-misc-non-private-member-variables-in-classes, | ||
" | ||
WarningsAsErrors: '' | ||
HeaderFilterRegex: '' | ||
FormatStyle: none |
Oops, something went wrong.