-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (69 loc) · 2.37 KB
/
style_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
# Copyright (c) 2020 Fangjun Kuang (csukuangfj@gmail.com)
# See ../../LICENSE for clarification regarding multiple authors
name: style_check
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade flake8
pip install cpplint==1.4.5
- name: Run flake8
shell: bash
working-directory: ${{github.workspace}}
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install cppcheck
run: |
cd /tmp
git clone --depth 1 https://github.com/danmar/cppcheck.git
cd cppcheck
mkdir build
cd build
cmake ..
make -j
sudo make install
- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake -DCMAKE_CXX_CPPLINT=cpplint $GITHUB_WORKSPACE
- name: Check style with cpplint
shell: bash
working-directory: ${{github.workspace}}
run: ./scripts/check_style_cpplint.sh ${{runner.workspace}}/build 1
- name: Run cppcheck
shell: bash
working-directory: ${{github.workspace}}
run: ./scripts/run_cppcheck.sh ${{runner.workspace}}/build
- name: Install clang-tidy
run: |
sudo apt-get install clang-tidy-9
- name: Run clang-tidy
shell: bash
working-directory: ${{github.workspace}}
run: |
clang-tidy-9 --quiet -p ${{runner.workspace}}/build k2/csrc/*.cc k2/python/csrc/*.cc