Skip to content

Commit 3c1da1d

Browse files
authored
Add clang-tidy in clang images (#95)
1 parent 41ec7c1 commit 3c1da1d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.github/workflows/ubuntu.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ jobs:
7373
- release: noble
7474
compiler_name: clang
7575
compiler_version: 20
76+
- release: noble
77+
compiler_name: clang
78+
compiler_version: 21
7679
runs-on: ${{ matrix.architecture.runner }}
7780
permissions:
7881
packages: write

docker/ubuntu/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,25 @@ printf "%s\n" \
227227
"Acquire::AllowInsecureRepositories \"true\";" \
228228
"Acquire::AllowWeakRepositories \"true\";" \
229229
| tee /etc/apt/apt.conf.d/99llvm-allow-weak
230+
231+
# Add LLVM repository for versions above 20 because it is not available in the default repo
232+
if [[ "${CLANG_VERSION}" -gt 20 ]]; then
233+
apt-get update
234+
apt-get install -y --no-install-recommends lsb-release software-properties-common gnupg
235+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
236+
DISTRO_CODENAME=$(lsb_release -cs)
237+
echo "deb http://apt.llvm.org/${DISTRO_CODENAME}/ llvm-toolchain-${DISTRO_CODENAME}-${CLANG_VERSION} main" \
238+
| tee /etc/apt/sources.list.d/llvm.list
239+
apt-get clean
240+
rm -rf /var/lib/apt/lists/*
241+
fi
242+
230243
apt-get update
231244
apt-get install -y --no-install-recommends --allow-unauthenticated \
232245
clang-${CLANG_VERSION} \
233246
libclang-rt-${CLANG_VERSION}-dev \
234247
llvm-${CLANG_VERSION} \
248+
clang-tidy-${CLANG_VERSION} \
235249
gcc \
236250
g++
237251
apt-get clean
@@ -245,6 +259,10 @@ update-alternatives \
245259
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION}
246260
update-alternatives \
247261
--install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${CLANG_VERSION} 100
262+
update-alternatives \
263+
--install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${CLANG_VERSION} 100
264+
update-alternatives \
265+
--install /usr/bin/run-clang-tidy run-clang-tidy /usr/bin/run-clang-tidy-${CLANG_VERSION} 100
248266
update-alternatives --auto cc
249267
update-alternatives --auto c++
250268
update-alternatives --auto clang

0 commit comments

Comments
 (0)