File tree Expand file tree Collapse file tree 1 file changed +26
-7
lines changed
Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Original file line number Diff line number Diff line change 1717# .github/workflows/tools_build.yml
1818# .github/workflows/ubuntu_build.yml
1919
20- set -e
20+ set -euo pipefail
2121
22- CLANG_FORMAT_TOOL=" clang-format-14" # for super-linter v6 action
23- echo " clang-format check"
24- find . -path ./build -prune -o -regex ' .*\.\(cpp\|hpp\|cc\|c\|h\)' ! -name ' pymtl_wrap.c' \
25- ! -name ' vmlinux.h' -exec ${CLANG_FORMAT_TOOL} --verbose -i {} +
22+ CLANG_FORMAT_TOOL=${CLANG_FORMAT_TOOL:- clang-format-14} # for super-linter v6 action
23+ echo " clang-format check (git-tracked and non-ignored files only)"
2624
27- black python/
28- isort python/
25+ mapfile -t CLANG_FORMAT_FILES < <(
26+ git ls-files --cached --others --exclude-standard \
27+ -- ' *.cpp' -- ' *.hpp' -- ' *.cc' -- ' *.c' -- ' *.h' \
28+ ' :!:pymtl_wrap.c' ' :!:vmlinux.h'
29+ )
30+
31+ if (( ${# CLANG_FORMAT_FILES[@]} )) ; then
32+ # Run clang-format in parallel batches, avoiding git-ignored files.
33+ printf ' %s\0' " ${CLANG_FORMAT_FILES[@]} " |
34+ xargs -0 -n32 -P" $( nproc) " " ${CLANG_FORMAT_TOOL} " -i
35+ fi
36+
37+ if command -v black > /dev/null 2>&1 ; then
38+ black python/
39+ else
40+ echo " black not found, skipping"
41+ fi
42+
43+ if command -v isort > /dev/null 2>&1 ; then
44+ isort python/
45+ else
46+ echo " isort not found, skipping"
47+ fi
You can’t perform that action at this time.
0 commit comments