Skip to content

Commit df0c9c9

Browse files
CI: Add clang-tidy action
This contains two invocations of clang-tidy. One as Github action that should also provide annotations and another one as part of our Docker.run script which is only run on Ubuntu-24.04 docker. Signed-off-by: Andreas Fuchs <andreas.fuchs@infineon.com>
1 parent 955cb29 commit df0c9c9

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.ci/docker.run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ fi
9595

9696
if [ "$SCANBUILD" == "yes" ]; then
9797
scan-build --status-bugs make -j
98+
elif [ "$CC" == "clang" -a "$DOCKER_IMAGE" == "ubuntu-24.04" ]; then
99+
make -j compile_commands.json
100+
run-clang-tidy -header-filter $PWD $(find src include -name '*.c' -o -name '*.h') 2>&1 | tee clang-tidy.log
101+
make -j clean
102+
make -j distcheck
98103
elif [ "$CC" == "clang" ]; then
99104
make -j distcheck
100105
else

.github/workflows/clang-tidy.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2023-2024 Infineon Technologies AG
2+
#
3+
# SPDX-License-Identifier: BSD-2-Clause
4+
5+
name: clang-tidy-check
6+
on: [push, pull_request]
7+
8+
jobs:
9+
clang-tidy-check:
10+
runs-on: ubuntu-latest
11+
container:
12+
image: ghcr.io/tpm2-software/ubuntu-24.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Generate compile_commands.json
18+
run: |
19+
git config --global --add safe.directory /__w/tpm2-tss/tpm2-tss
20+
./bootstrap
21+
./configure CC=clang --enable-unit --enable-integration
22+
make -j1 compile_commands.json
23+
- uses: ZehMatt/clang-tidy-annotations@v1.1.2
24+
with:
25+
only_affected_lines: false

0 commit comments

Comments
 (0)