Skip to content

Commit 1ede230

Browse files
authored
[CI] build iwyu (#3459)
1 parent d2e7289 commit 1ede230

File tree

5 files changed

+49
-14
lines changed

5 files changed

+49
-14
lines changed

.devcontainer/Dockerfile.dev

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ ENV GRPC_VERSION=${GRPC_VERSION}
2222
COPY ci /opt/ci
2323

2424
RUN apt update && apt install -y wget \
25-
ninja-build \
26-
libcurl4-openssl-dev \
27-
clang-tidy \
28-
shellcheck
25+
ninja-build \
26+
llvm-dev \
27+
libclang-dev \
28+
libcurl4-openssl-dev \
29+
clang-tidy \
30+
shellcheck
2931

3032
RUN cd /opt/ci && bash setup_cmake.sh
3133
RUN cd /opt/ci && bash setup_ci_environment.sh
34+
RUN cd /opt/ci && bash install_iwyu.sh
3235
RUN cd /opt && bash ci/setup_googletest.sh \
3336
&& bash ci/install_abseil.sh \
3437
&& bash ci/install_protobuf.sh \

.github/workflows/clang-tidy.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
sudo apt update -y
3232
sudo apt install -y --no-install-recommends --no-install-suggests \
3333
build-essential \
34-
iwyu \
3534
cmake \
3635
libssl-dev \
3736
libcurl4-openssl-dev \

.github/workflows/iwyu.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,23 @@ jobs:
2828
sudo apt update -y
2929
sudo apt install -y --no-install-recommends --no-install-suggests \
3030
build-essential \
31-
iwyu \
3231
ninja-build \
3332
libssl-dev \
3433
libcurl4-openssl-dev \
34+
libabsl-dev \
3535
libprotobuf-dev \
36+
libgrpc++-dev \
3637
protobuf-compiler \
38+
protobuf-compiler-grpc \
3739
libgmock-dev \
3840
libgtest-dev \
39-
libbenchmark-dev
41+
libbenchmark-dev \
42+
llvm-dev \
43+
libclang-dev
4044
sudo ./ci/setup_cmake.sh
41-
42-
43-
- name: setup grpc
45+
- name: Install include-what-you-use
4446
run: |
45-
sudo ./ci/setup_grpc.sh
46-
47+
sudo ./ci/install_iwyu.sh
4748
- name: Prepare CMake
4849
run: |
4950
TOPDIR=`pwd`
@@ -80,11 +81,13 @@ jobs:
8081
- name: count warnings
8182
run: |
8283
set +e
84+
echo "include-what-you-use version:"
85+
include-what-you-use --version
8386
cd build
8487
readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log`
8588
echo "include-what-you-use reported ${WARNING_COUNT} warning(s)"
8689
# Acceptable limit, to decrease over time down to 0
87-
readonly WARNING_LIMIT=0
90+
readonly WARNING_LIMIT=122
8891
# FAIL the build if WARNING_COUNT > WARNING_LIMIT
8992
if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then
9093
exit 1

ci/install_iwyu.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# Copyright The OpenTelemetry Authors
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -e
7+
8+
INSTALL_PREFIX="/usr/local"
9+
10+
LLVM_VERSION=$(llvm-config --version 2>/dev/null | cut -d. -f1)
11+
12+
if [ -z "$LLVM_VERSION" ]; then
13+
echo "Error: LLVM not found. Exiting."
14+
exit 1
15+
fi
16+
17+
echo "LLVM_VERSION=$LLVM_VERSION"
18+
echo "Installing IWYU..."
19+
20+
cd /tmp
21+
git clone --depth 1 --branch clang_$LLVM_VERSION https://github.com/include-what-you-use/include-what-you-use.git
22+
cd include-what-you-use
23+
mkdir -p build
24+
cd build
25+
26+
cmake -DCMAKE_PREFIX_PATH=/usr/lib/llvm-$LLVM_VERSION -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ..
27+
make -j$(nproc)
28+
make install
29+
30+
echo "IWYU install complete. Verifying installation..."
31+
include-what-you-use --version

ci/setup_ci_environment.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ apt-get install --no-install-recommends --no-install-suggests -y \
1212
git \
1313
valgrind \
1414
lcov \
15-
iwyu \
1615
pkg-config

0 commit comments

Comments
 (0)