-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (77 loc) · 2.62 KB
/
static_check.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Static Check
on: [push, workflow_dispatch]
env:
BUILD_TYPE: Release
jobs:
configure:
name: Get Compile Commands
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Upload Compile Commands
uses: actions/upload-artifact@v3
with:
name: compile_commands
path: ${{github.workspace}}/build/compile_commands.json
cppcheck:
name: CppCheck
needs: configure
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download Compile Commands
uses: actions/download-artifact@v3
with:
name: compile_commands
- name: Install CppCheck
run: |
sudo apt-get update
sudo apt-get install -y cppcheck
- name: Run CppCheck
shell: bash
# File test/test_simple_calc.cpp is ignored
run: |
cppcheck --project=${{github.workspace}}/compile_commands.json \
--std=c++17 \
--output-file=${{github.workspace}}/cppcheck-report.txt \
--suppress=preprocessorErrorDirective:${{github.workspace}}/catch2/catch.hpp .
- name: Upload CppCheck Result
uses: actions/upload-artifact@v3
with:
name: cppcheck_report
path: ${{github.workspace}}/cppcheck-report.txt
clang-tidy:
name: Clang Tidy
needs: configure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download Compile Commands
uses: actions/download-artifact@v3
with:
name: compile_commands
- name: Create Build Folder
run: cmake -E make_directory ${{github.workspace}}/build
- name: Install Clang Tidy
run: |
sudo apt-get update
sudo apt-get install -y clang-tidy
sudo apt-get install -y clang-tools
- name: Run Clang Tidy
shell: bash
working-directory: ${{github.workspace}}/build
run: |
run-clang-tidy -checks='cppcoreguidelines-*,performance-*,readibility-*,modernize-*,-modernize-use-trailing-return-type,misc-*,clang-analyzer-*' \
-export-fixes ${{github.workspace}}/clang-tidy-fixes.yaml
- name: Upload Clang Tidy Result
uses: actions/upload-artifact@v3
with:
name: clang_tidy_fixes
path: ${{github.workspace}}/clang-tidy-fixes.yaml