-
Notifications
You must be signed in to change notification settings - Fork 13
61 lines (58 loc) · 2.38 KB
/
static_code_analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: cpp-static-analysis
on:
pull_request:
push:
branches: [main, master]
# paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**.cxx', '**.hxx', '**.cc']
env:
DAY_OF_WEEK: Monday
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install cppcheck
run: sudo apt install cppcheck
# - name: Install llvm
# run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- name: Install llvm
run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
# - name: Install g++
# run: sudo apt update && sudo apt install g++ gcc && sudo apt upgrade
- name: Install standard library headers for clang and clang tools
run: sudo apt install clang-tidy-18 clang-format-18 libc++-18-dev
- name: Install the newest ninja
run: sudo wget -qO /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip && sudo gunzip /usr/local/bin/ninja.gz && sudo chmod a+x /usr/local/bin/ninja
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Configure
run: pip install cpplint
- name: Build project
run: ./scripts/make_debug.sh
- name: Run clang-format on all module files
run: |
if find ./algebra2 ./discrete_math/ -iname '*.cxx' -o -iname '*.ixx' | xargs clang-format-18 --Werror --dry-run; then
echo "clang-format-result=0" >> $GITHUB_OUTPUT
else
echo "clang-format-result=1" >> $GITHUB_OUTPUT
fi;
shell: bash
id: run_clang_format
- name: Run clang-tidy on all module files
run: |
if find ./algebra2 ./discrete_math/ -iname '*.cxx' -o -iname '*.ixx' | xargs clang-tidy-18 -p ./build/debug/ --extra-arg=-std=c++26; then
echo "clang-tidy-result=0" >> $GITHUB_OUTPUT
else
echo "clang-tidy-result=1" >> $GITHUB_OUTPUT
fi;
shell: bash
id: run_clang_tidy
- name: clang-format check
if: steps.run_clang_format.outputs.clang-format-result > 0
run: echo "Some of your c++ files are not formatted according to the .clang-format file" && exit 1
- name: clang-tidy check
if: steps.run_clang_tidy.outputs.clang-tidy-result > 0
run: echo "You failed to fulfill some of requirements posed in the .clang-tidy file" && exit 1