From 2a24e2a42dbbfbf1483e9112a999ac805c94885e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Thu, 14 Nov 2024 10:47:22 +0100 Subject: [PATCH] iwyu.yml: also run with libc++ [skip ci] (#6743) --- .github/workflows/iwyu.yml | 49 ++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 71d83a24ef0..a326f3553e3 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -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' }} @@ -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: | @@ -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++ @@ -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' }} @@ -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: @@ -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 @@ -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