Skip to content

Commit

Permalink
iwyu.yml: also run with libc++ [skip ci] (#6743)
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave authored Nov 14, 2024
1 parent bce5666 commit 2a24e2a
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
strategy:
matrix:
image: ["fedora:latest"] # "opensuse/tumbleweed:latest" / "fedora:latest" / "debian:unstable" / "archlinux:latest"
stdlib: [libstdc++, libc++]
include:
- stdlib: libstdc++
use_libcxx: Off
- stdlib: libc++
use_libcxx: On
fail-fast: false

runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'danmar' }}
Expand Down Expand Up @@ -65,6 +72,11 @@ jobs:
dnf install -y iwyu
ln -s iwyu_tool.py /usr/bin/iwyu_tool
- name: Install missing software on Fedora (libc++)
if: contains(matrix.image, 'fedora') && matrix.stdlib == 'libc++'
run: |
dnf install -y libcxx-devel
- name: Install missing software on OpenSUSE
if: contains(matrix.image, 'opensuse')
run: |
Expand All @@ -86,7 +98,7 @@ jobs:

- name: Prepare CMake
run: |
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
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 }}
env:
CC: clang
CXX: clang++
Expand All @@ -110,22 +122,33 @@ jobs:
run: |
PWD=$(pwd)
# -isystem/usr/lib/clang/17/include
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
# TODO: remove -stdlib= - it should have been taken from the compilation database
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
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Compilation Database
name: Compilation Database (include-what-you-use - ${{ matrix.stdlib }})
path: ./cmake.output/compile_commands.json

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Logs (include-what-you-use)
name: Logs (include-what-you-use - ${{ matrix.stdlib }})
path: ./*.log

clang-include-cleaner:

strategy:
matrix:
stdlib: [libstdc++, libc++]
include:
- stdlib: libstdc++
use_libcxx: Off
- stdlib: libc++
use_libcxx: On
fail-fast: false

runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'danmar' }}

Expand All @@ -150,6 +173,11 @@ jobs:
sudo ./llvm.sh 19
sudo apt-get install -y clang-tools-19
- name: Install libc++
if: matrix.stdlib == 'libc++'
run: |
sudo apt-get install -y libc++-19-dev
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v4
with:
Expand All @@ -160,7 +188,7 @@ jobs:

- name: Prepare CMake
run: |
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
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 }}
env:
CC: clang-19
CXX: clang++-19
Expand All @@ -180,9 +208,16 @@ jobs:
- name: clang-include-cleaner
run: |
# TODO: run multi-threaded
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
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
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Compilation Database (clang-include-cleaner - ${{ matrix.stdlib }})
path: ./cmake.output/compile_commands.json

- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Logs (clang-include-cleaner)
name: Logs (clang-include-cleaner - ${{ matrix.stdlib }})
path: ./*.log

0 comments on commit 2a24e2a

Please sign in to comment.