Skip to content

Commit deb66b2

Browse files
committed
CI: Add job to run clang-tidy.
1 parent 335d004 commit deb66b2

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

.clang-tidy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
Checks: >
3+
-clang-analyzer-security.insecureAPI.strcat,
4+
-clang-analyzer-security.insecureAPI.strcpy,
5+
modernize-shrink-to-fit,
6+
modernize-use-default-member-init,
7+
modernize-use-equals-default,
8+
modernize-use-equals-delete,
9+
modernize-use-override,
10+
performance-*
11+
HeaderFilterRegex: .*
12+
WarningsAsErrors: '*'
13+
...

.github/workflows/clang.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,34 @@ jobs:
3737
CXX: clang++
3838
run: |
3939
./scripts/run-ci.sh
40+
41+
tidy:
42+
env:
43+
WITH_GRAPHICS: 1
44+
WITH_X265: 1
45+
WITH_AOM: 1
46+
WITH_DAV1D: 1
47+
WITH_RAV1E: 1
48+
WITH_LIBDE265: 1
49+
CMAKE: 1
50+
CLANG_TIDY: 1
51+
runs-on: ubuntu-20.04
52+
steps:
53+
- uses: actions/checkout@v2
54+
55+
- name: Install dependencies
56+
run: |
57+
./scripts/install-ci-linux.sh
58+
sudo apt install clang-tidy-12
59+
60+
- name: Prepare CI
61+
run: |
62+
./scripts/prepare-ci.sh
63+
64+
- name: Run tests
65+
run: |
66+
./scripts/run-ci.sh
67+
68+
- name: Run clang-tidy
69+
run: |
70+
run-clang-tidy-12 -j$(nproc)

scripts/run-ci.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ if [ ! -z "$CMAKE" ]; then
133133
if [ "$WITH_RAV1E" = "1" ]; then
134134
CMAKE_OPTIONS="$CMAKE_OPTIONS -DUSE_LOCAL_RAV1E=1"
135135
fi
136+
if [ "$CLANG_TIDY" = "1" ]; then
137+
CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
138+
fi
136139

137140
cmake . $CMAKE_OPTIONS
138141
fi
@@ -141,7 +144,7 @@ if [ ! -z "$FUZZER" ] && [ "$CURRENT_OS" = "linux" ]; then
141144
export ASAN_SYMBOLIZER="$BUILD_ROOT/clang/bin/llvm-symbolizer"
142145
fi
143146

144-
if [ -z "$EMSCRIPTEN_VERSION" ] && [ -z "$CHECK_LICENSES" ] && [ -z "$TARBALL" ]; then
147+
if [ -z "$EMSCRIPTEN_VERSION" ] && [ -z "$CHECK_LICENSES" ] && [ -z "$TARBALL" ] && [ -z "$CLANG_TIDY" ]; then
145148
echo "Building libheif ..."
146149
make -j $(nproc)
147150
if [ "$CURRENT_OS" = "linux" ] && [ -z "$CMAKE" ] && [ -z "$MINGW" ] && [ -z "$FUZZER" ]; then

0 commit comments

Comments
 (0)