Skip to content

Commit

Permalink
Enable cpplint in CI (#2233)
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <sighingnow@gmail.com>
  • Loading branch information
sighingnow committed Nov 22, 2022
1 parent 330fe14 commit f524550
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ jobs:
sudo curl -L https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-22538c65/clang-format-8_linux-amd64 --output /usr/bin/clang-format
sudo chmod +x /usr/bin/clang-format
# run format
# collect the source files
cd analytical_engine/
find ./apps ./benchmarks ./core ./frame ./misc ./test -name "*.h" | xargs clang-format -i --style=file
find ./apps ./benchmarks ./core ./frame ./misc ./test -name "*.cc" | xargs clang-format -i --style=file
files=$(find ./apps ./benchmarks ./core ./frame ./misc ./test \( -name "*.h" -o -name "*.cc" \))
# run format
clang-format -i --style=file $(echo $files)
# validate format
function prepend() { while read line; do echo "${1}${line}"; done; }
Expand All @@ -117,6 +119,22 @@ jobs:
exit -1
fi
# validate cpplint
function ec() { [[ "$1" == "-h" ]] && { shift && eval $* > /dev/null 2>&1; ec=$?; echo $ec; } || eval $*; ec=$?; }
# run cpplint
ec ./misc/cpplint.py $(echo $files)
if [[ "$ec" != "0" ]]; then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| cpplint failures found! Run: "
echo "|"
echo "| make gsa_cpplint"
echo "|"
echo "| to fix this error."
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit -1
fi
- name: Python Format and Lint Check
run: |
echo "Checking formatting for $GITHUB_REPOSITORY"
Expand Down

0 comments on commit f524550

Please sign in to comment.