-
Notifications
You must be signed in to change notification settings - Fork 70
131 lines (124 loc) · 4.12 KB
/
check-codestyle.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Codestyle
on: [pull_request]
jobs:
clang-format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Pull clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format-12
- name: Check formatting
run: |
formatterOutput=$( git diff -U0 origin/$GITHUB_BASE_REF...HEAD | clang-format-diff-12 -p 1)
if [ "$formatterOutput" != "" ]
then
echo ":x: :x: :x:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`c++" >> $GITHUB_STEP_SUMMARY
echo "$formatterOutput" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "$formatterOutput"
exit 1
fi
echo "$formatterOutput"
echo "### $formatterOutput :heavy_check_mark:" >> $GITHUB_STEP_SUMMARY
clang-tidy-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install gcc-10 g++-10 cmake build-essential
- name: Cache Boost
uses: actions/cache@v3
id: cache-boost
with:
path: ${{github.workspace}}/lib/boost
key: ${{ runner.os }}-boost-78
- name: Cache googletest
uses: actions/cache@v3
id: cache-googletest
with:
path: ${{github.workspace}}/lib/googletest
key: ${{ runner.os }}-googletest
- name: Cache easyloggingpp
uses: actions/cache@v3
id: cache-easyloggingpp
with:
path: ${{github.workspace}}/lib/easyloggingpp
key: ${{ runner.os }}-easyloggingpp
- name: Cache better-enums
uses: actions/cache@v3
id: cache-better-enums
with:
path: ${{github.workspace}}/lib/better-enums
key: ${{ runner.os }}better-enums
- name: Cache pybind11
uses: actions/cache@v3
id: cache-pybind11
with:
path: ${{github.workspace}}/lib/pybind11
key: ${{ runner.os }}-pybind11
- name: Install Boost
run: |
wget -O boost_1_78_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.gz/download
tar xzvf boost_1_78_0.tar.gz
cd boost_1_78_0
./bootstrap.sh --prefix=${{github.workspace}}/lib/boost
./b2
sudo ./b2 install
if: steps.cache-boost.outputs.cache-hit != 'true'
- name: Download googletest
run: |
mkdir -p lib
sudo chown -R $USER lib
cd lib
git clone https://github.com/google/googletest/ --branch release-1.12.1
if: steps.cache-googletest.outputs.cache-hit != 'true'
- name: Download easyloggingpp
run: |
mkdir -p lib
sudo chown -R $USER lib
cd lib
git clone https://github.com/amrayn/easyloggingpp/ --branch v9.97.0
if: steps.cache-easyloggingpp.outputs.cache-hit != 'true'
- name: Download better-enums
run: |
mkdir -p lib
sudo chown -R $USER lib
cd lib
git clone https://github.com/aantron/better-enums.git --branch 0.11.3
if: steps.cache-better-enums.outputs.cache-hit != 'true'
- name: Download pybind11
run: |
mkdir -p lib
sudo chown -R $USER lib
cd lib
git clone https://github.com/pybind/pybind11.git --branch v2.10
if: steps.cache-pybind11.outputs.cache-hit != 'true'
- name: Generate compile_commands.json
run: |
cmake -DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10 \
-DBOOST_ROOT=${{github.workspace}}/lib/boost \
-DCMAKE_BUILD_TYPE=Debug \
-Dgtest_disable_pthreads=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
. -B ${{github.workspace}}/build
- uses: ZedThree/[email protected]
id: review
with:
build_dir: build
config_file: '.clang-tidy'
lgtm_comment_body: ''
split_workflow: true
- uses: actions/upload-artifact@v3
with:
name: clang-tidy-review
path: |
clang-tidy-review-output.json
clang-tidy-review-metadata.json