CI: Added clang-format and clang-tidy

This commit is contained in:
Ivan-lis 2024-10-18 07:38:35 +00:00
parent 65cae2727f
commit 89f3165551

View file

@ -88,6 +88,21 @@ jobs:
ls -la /home/LLVM-19.1.0/bin/
export PATH="/home/LLVM-19.1.0/bin:${PATH}"
- name: Check clang-format
run: |
export PATH="/home/LLVM-19.1.0/bin:${PATH}"
cd ${{ github.workspace }}
find -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.c" -o -name "*.cpp" \) > repo_sources_to_check.txt
export REPO_FILES=$(cat repo_sources_to_check.txt)
printf "\nList of files to be checked:\n"
echo "::group::files to be checked"
for FILE in $REPO_FILES; do printf "\t ${{ github.workspace }}/$FILE \n"; done
echo "::endgroup::"
for FILE in $REPO_FILES; do clang-format -i ${{ github.workspace }}/$FILE --dry-run --Werror; done
echo "No clang-format violations detected!"
- name: Clang build with -fsanitize=address
environment:
CC: /home/LLVM-19.1.0/bin/clang
@ -111,6 +126,13 @@ jobs:
cd ${{ github.workspace }}/build_clang
ASAN_SYMBOLIZER_PATH=/home/LLVM-19.1.0/bin/llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests
- name: Check clang-tidy
run: |
export PATH="/home/LLVM-19.1.0/bin:${PATH}"
wget https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
python run-clang-tidy.py -use-color -exclude-header-filter .*build.* -header-filter .hpp -p ${{ github.workspace }}/build_clang/ -config-file ${{ github.workspace }}/.clang-tidy ${{ github.workspace }}/examples ${{ github.workspace }}/library/ ${{ github.workspace }}/src/
echo "::warning::TODO Fix warnings and add '-warnings-as-errors' flags to report clang-tidy errors"
- name: GCC build
environment:
CC: /usr/sbin/gcc