forked from KCL-BMEIS/niftyreg
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (55 loc) · 2.49 KB
/
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
name: Code Analysis
on: [pull_request]
jobs:
Code-Analysis:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install Cppcheck
run: |
sudo apt-get update && sudo apt-get install libpcre3-dev
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
git checkout 2.13.x
sudo make -j4 MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install
- name: Install Python dependencies
run: pip3 install --upgrade setuptools urllib3 chardet pyOpenSSL pygithub
# - name: Install CUDA Toolkit
# uses: Jimver/[email protected]
# with:
# method: network
# use-github-cache: false
# use-local-cache: false
- name: Configure NiftyReg
run: |
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_ALL_DEP=ON \
-DCHECK_GPU=OFF \
-DUSE_CUDA=OFF \
-DUSE_OPENCL=OFF \
-DUSE_SSE=ON \
-DUSE_OPENMP=ON \
-DBUILD_TESTING=OFF \
-DWITH_COVERAGE=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
..
- name: Code Analysis
env:
COMMENT_TITLE: Code Analysis Results
GITHUB_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
REPORT_PR_CHANGES_ONLY: false
run: |
analysis_file="analysis.txt"
cppcheck_params="--enable=warning --check-level=exhaustive --suppress=internalError --suppress=internalAstError"
cppcheck -j4 $cppcheck_params --project=build/compile_commands.json --output-file=$analysis_file
# Since cppcheck does not support OpenCL and CUDA, we need to check these files separately
find reg-lib/cl/. -name "*.cl" -print0 | while IFS= read -r -d '' file; do cppcheck "$file" $cppcheck_params --language=c++ 2>> $analysis_file; done
find reg-lib/cuda/. -name "*.cu" -print0 | while IFS= read -r -d '' file; do cppcheck "$file" $cppcheck_params --language=c++ 2>> $analysis_file; done
cat $analysis_file
python3 ${{ github.workspace }}/.github/code_analysis.py -cc $analysis_file -o false -fk false