Skip to content

Commit 2a24e2a

Browse files
authored
iwyu.yml: also run with libc++ [skip ci] (danmar#6743)
1 parent bce5666 commit 2a24e2a

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

.github/workflows/iwyu.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ jobs:
1616
strategy:
1717
matrix:
1818
image: ["fedora:latest"] # "opensuse/tumbleweed:latest" / "fedora:latest" / "debian:unstable" / "archlinux:latest"
19+
stdlib: [libstdc++, libc++]
20+
include:
21+
- stdlib: libstdc++
22+
use_libcxx: Off
23+
- stdlib: libc++
24+
use_libcxx: On
25+
fail-fast: false
1926

2027
runs-on: ubuntu-22.04
2128
if: ${{ github.repository_owner == 'danmar' }}
@@ -65,6 +72,11 @@ jobs:
6572
dnf install -y iwyu
6673
ln -s iwyu_tool.py /usr/bin/iwyu_tool
6774
75+
- name: Install missing software on Fedora (libc++)
76+
if: contains(matrix.image, 'fedora') && matrix.stdlib == 'libc++'
77+
run: |
78+
dnf install -y libcxx-devel
79+
6880
- name: Install missing software on OpenSUSE
6981
if: contains(matrix.image, 'opensuse')
7082
run: |
@@ -86,7 +98,7 @@ jobs:
8698

8799
- name: Prepare CMake
88100
run: |
89-
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On
101+
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.use_libcxx }}
90102
env:
91103
CC: clang
92104
CXX: clang++
@@ -110,22 +122,33 @@ jobs:
110122
run: |
111123
PWD=$(pwd)
112124
# -isystem/usr/lib/clang/17/include
113-
iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments > iwyu.log
125+
# TODO: remove -stdlib= - it should have been taken from the compilation database
126+
iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -stdlib=${{ matrix.stdlib }} > iwyu.log
114127
115128
- uses: actions/upload-artifact@v4
116129
if: success() || failure()
117130
with:
118-
name: Compilation Database
131+
name: Compilation Database (include-what-you-use - ${{ matrix.stdlib }})
119132
path: ./cmake.output/compile_commands.json
120133

121134
- uses: actions/upload-artifact@v4
122135
if: success() || failure()
123136
with:
124-
name: Logs (include-what-you-use)
137+
name: Logs (include-what-you-use - ${{ matrix.stdlib }})
125138
path: ./*.log
126139

127140
clang-include-cleaner:
128141

142+
strategy:
143+
matrix:
144+
stdlib: [libstdc++, libc++]
145+
include:
146+
- stdlib: libstdc++
147+
use_libcxx: Off
148+
- stdlib: libc++
149+
use_libcxx: On
150+
fail-fast: false
151+
129152
runs-on: ubuntu-22.04
130153
if: ${{ github.repository_owner == 'danmar' }}
131154

@@ -150,6 +173,11 @@ jobs:
150173
sudo ./llvm.sh 19
151174
sudo apt-get install -y clang-tools-19
152175
176+
- name: Install libc++
177+
if: matrix.stdlib == 'libc++'
178+
run: |
179+
sudo apt-get install -y libc++-19-dev
180+
153181
- name: Install Qt ${{ env.QT_VERSION }}
154182
uses: jurplel/install-qt-action@v4
155183
with:
@@ -160,7 +188,7 @@ jobs:
160188

161189
- name: Prepare CMake
162190
run: |
163-
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On
191+
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On -DUSE_LIBCXX=${{ matrix.use_libcxx }}
164192
env:
165193
CC: clang-19
166194
CXX: clang++-19
@@ -180,9 +208,16 @@ jobs:
180208
- name: clang-include-cleaner
181209
run: |
182210
# TODO: run multi-threaded
183-
find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-19 --print=changes --extra-arg=-w -p cmake.output > clang-include-cleaner.log 2>&1
211+
find $PWD/cli $PWD/lib $PWD/test $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-19 --print=changes --extra-arg=-w --extra-arg=-stdlib=${{ matrix.stdlib }} -p cmake.output > clang-include-cleaner.log 2>&1
184212
185213
- uses: actions/upload-artifact@v4
214+
if: success() || failure()
215+
with:
216+
name: Compilation Database (clang-include-cleaner - ${{ matrix.stdlib }})
217+
path: ./cmake.output/compile_commands.json
218+
219+
- uses: actions/upload-artifact@v4
220+
if: success() || failure()
186221
with:
187-
name: Logs (clang-include-cleaner)
222+
name: Logs (clang-include-cleaner - ${{ matrix.stdlib }})
188223
path: ./*.log

0 commit comments

Comments
 (0)