forked from IS-UMK/lemkis
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (80 loc) · 3.48 KB
/
static_code_analysis.yml
File metadata and controls
84 lines (80 loc) · 3.48 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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-19 clang-format-19 libc++-19-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 -f /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: Install TBB library
run: sudo apt install libtbb-dev
- name: Setup OpenMP headers
run: |
# Install specific OpenMP dev package for clang-19
sudo apt-get update
sudo apt-get install -y libomp-19-dev || sudo apt-get install -y libomp-dev
# Find omp.h
OMP_INCLUDE_PATH=$(find /usr -name "omp.h" | grep -v "android" | head -1 | xargs dirname)
echo "Found omp.h at: $OMP_INCLUDE_PATH"
# Make omp.h available to clang-19
sudo ln -sf $OMP_INCLUDE_PATH/omp.h /usr/include/omp.h || true
# Show debug info
ls -la /usr/include/omp.h || echo "Failed to create symlink"
- name: Setup correct OpenMP library path
run: |
# Find the system libomp
SYSTEM_LIBOMP=$(find /usr/lib -name "libomp.so*" | grep -v "android" | head -1)
echo "System OpenMP library: $SYSTEM_LIBOMP"
# Create symlink
sudo mkdir -p /usr/lib || true
sudo ln -sf $SYSTEM_LIBOMP /usr/lib/libomp.so
- name: Build project
run: ./scripts/make_debug.sh
- name: Run clang-format on all module files
run: |
if find ./concurency/student_projects -iname '*.cxx' -o -iname '*.ixx' -o -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format-19 --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 ./concurency/student_projects -iname '*.cxx' -o -iname '*.ixx' -o -iname '*.cpp' -o -iname '*.hpp' | xargs clang-tidy-19 -p ./build/debug/ --extra-arg=-std=c++26 --config-file=./.clang-tidy; 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