forked from Exawind/amr-wind
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (99 loc) · 3.18 KB
/
lint.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
name: AMR-Wind Lint
on:
push:
branches: [main]
paths:
- 'cmake/**'
- 'amr-wind/**'
- 'submods/**'
- 'test/**'
- 'unit_tests/**'
- 'CMakeLists.txt'
- '.github/workflows/lint.yml'
pull_request:
branches: [main]
paths:
- 'cmake/**'
- 'amr-wind/**'
- 'submods/**'
- 'test/**'
- 'unit_tests/**'
- 'CMakeLists.txt'
- '.github/workflows/lint.yml'
jobs:
cppcheck:
runs-on: macos-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- uses: actions/checkout@v2
with:
submodules: true
- name: Dependencies
run: brew install cppcheck
- name: Configure
run: |
echo "NPROCS=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
cmake \
-Bbuild-cppcheck \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_TESTS:BOOL=ON \
-DAMR_WIND_TEST_WITH_FCOMPARE:BOOL=OFF \
-DAMR_WIND_ENABLE_MASA:BOOL=OFF \
-DAMR_WIND_ENABLE_CPPCHECK:BOOL=ON \
${{github.workspace}}
- name: Check
working-directory: build-cppcheck
run: make cppcheck-ci
- name: Full report
working-directory: build-cppcheck
run: cat cppcheck/cppcheck-full-report.txt
- name: Short report
working-directory: build-cppcheck
run: |
echo "::add-matcher::.github/problem-matchers/cppcheck.json"
cat cppcheck-ci-report.txt
clang-tidy:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}
- uses: actions/checkout@v2
with:
submodules: true
- name: Dependencies
run: |
sudo apt-get install -y clang-tidy-9
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-9 100
- name: Configure
run: |
echo "NPROCS=$(nproc)" >> $GITHUB_ENV
cmake \
-Bbuild-clang-tidy \
-DCMAKE_CXX_COMPILER:STRING=clang++ \
-DCMAKE_C_COMPILER:STRING=clang \
-DAMR_WIND_ENABLE_MPI:BOOL=OFF \
-DAMR_WIND_ENABLE_TESTS:BOOL=ON \
-DAMR_WIND_TEST_WITH_FCOMPARE:BOOL=OFF \
-DAMR_WIND_ENABLE_MASA:BOOL=OFF \
-DAMR_WIND_ENABLE_ALL_WARNINGS:BOOL=OFF \
-DAMR_WIND_ENABLE_CLANG_TIDY:BOOL=ON \
${{github.workspace}}
- name: Check
working-directory: build-clang-tidy
run: |
cmake --build . --parallel ${{env.NPROCS}} 2> clang-tidy-full-report.txt
cat clang-tidy-full-report.txt | grep "warning:" | grep -v "submods" | sort | uniq | sort -nr | \
awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > clang-tidy-ci-report.txt
- name: Full report
working-directory: build-clang-tidy
run: cat clang-tidy-full-report.txt
- name: Short report
working-directory: build-clang-tidy
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
cat clang-tidy-ci-report.txt