-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (57 loc) · 2.09 KB
/
modernize.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
name: Manual Modernize
on: workflow_dispatch
jobs:
autoformat:
name: Format with clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Execute formatter
run: |
export CPP_SRC_FILES=$(find ./lib -name "*.*" | grep -E "(\.cc$|\.cpp$|\.h$|\.hpp$)")
export CPP_SRC_FILES="$CPP_SRC_FILES $(find ./app -name "*.*" | grep -E "(\.cc$|\.cpp$|\.h$|\.hpp$)")"
export CPP_SRC_FILES="$CPP_SRC_FILES $(find ./test -name "*.*" | grep -E "(\.cc$|\.cpp$|\.h$|\.hpp$)")"
if [ -n "$CPP_SRC_FILES" ]; then clang-format --style=Google -i $CPP_SRC_FILES; fi;
- name: Commit changes
uses: Endbug/add-and-commit@v9
with:
default_author: github_actions
message: 'Auto Format'
add: '*.*'
clang-tidy:
name: Format with Clang Tidy
needs: autoformat
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Clang Tidy
run: |
sudo apt-get update
sudo apt-get install -y clang-tidy
sudo apt-get install -y clang-tools
- 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: Run Clang Tidy
shell: bash
working-directory: ${{github.workspace}}/build
run: |
run-clang-tidy -checks='cppcoreguidelines-*,performance-*,readibility-*,modernize-*,misc-*,clang-analyzer-*' \
-fix
- name: Remove build folder
shell: bash
run: rm -rf ${{github.workspace}}/build
- name: Commit changes
uses: Endbug/add-and-commit@v9
with:
default_author: github_actions
message: 'Auto Clang Tidy Fix'
add: '*.*'