-
Notifications
You must be signed in to change notification settings - Fork 77
152 lines (136 loc) · 4.13 KB
/
static-analysis-pr.yml
File metadata and controls
152 lines (136 loc) · 4.13 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Static analysis
on:
pull_request:
paths:
- '**/*.cpp'
- '**/*.hpp'
- '**/*.c'
- '**/*.h'
- '**/CMakeLists.txt'
- '**/*.cmake'
- '**/.clang-tidy'
- '.github/workflows/static-analysis-pr.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: >-
${{ github.ref != 'refs/heads/master' &&
github.event_name != 'merge_group' &&
!startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
permissions:
contents: read
packages: read
jobs:
clang-tidy:
runs-on: ubuntu-24.04
container:
image: ghcr.io/learning-process/ppc-ubuntu:1.1
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-clang
create-symlink: true
max-size: 1G
- name: CMake configure
run: >
cmake -S . -B build -G Ninja
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
env:
CC: clang-21
CXX: clang++-21
- name: Build project
run: |
cmake --build build --parallel -- --quiet
env:
CC: clang-21
CXX: clang++-21
- name: Show ccache stats
run: ccache --show-stats
- name: Run clang-tidy
uses: aobolensk/clang-tidy-action@1685ada95cfee180d12944c3401ea33580d1d4e9
with:
exclude: "3rdparty build"
clang_tidy_version: "21"
clang-tidy-for-gcc-build:
needs:
- clang-tidy
runs-on: ubuntu-24.04
container:
image: ghcr.io/learning-process/ppc-ubuntu:1.1
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-gcc
create-symlink: true
max-size: 1G
- name: CMake configure
run: >
cmake -S . -B build -G Ninja
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
env:
CC: gcc-14
CXX: g++-14
- name: Build project
run: |
cmake --build build --parallel -- --quiet
env:
CC: gcc-14
CXX: g++-14
- name: Show ccache stats
run: ccache --show-stats
- name: Run clang-tidy
uses: aobolensk/clang-tidy-action@1685ada95cfee180d12944c3401ea33580d1d4e9
with:
exclude: "3rdparty build docs_venv .git .pytest_cache .ruff_cache xml"
clang_tidy_version: "21"
nolint-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Search for linter suppression markers
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: |
set -euo pipefail
CHANGED_FILES="$(git diff --name-only "$BASE_SHA"..."$HEAD_SHA" -- 'tasks/')"
if [ -z "$CHANGED_FILES" ]; then
echo "No changed files in tasks directory."
exit 0
fi
for file in $CHANGED_FILES; do
if grep -q "NOLINT" "$file"; then
echo "::error::Found 'NOLINT' in $file."
exit 1
fi
if grep -Eq 'IWYU[[:space:]]+pragma' "$file"; then
echo "::error::Found 'IWYU pragma' in $file."
exit 1
fi
if grep -q "LCOV_EXCL_START" "$file"; then
echo "::error::Found 'LCOV_EXCL_START' in $file."
exit 1
fi
if grep -q "LCOV_EXCL_STOP" "$file"; then
echo "::error::Found 'LCOV_EXCL_STOP' in $file."
exit 1
fi
done
echo "No linter suppression markers found in changed files."