# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners name: include-what-you-use on: workflow_dispatch permissions: contents: read jobs: iwyu: runs-on: ubuntu-22.04 container: image: "debian:unstable" # use latest debian image to get latest include-what-you-get steps: - uses: actions/checkout@v3 # TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image - name: Install missing software run: | apt-get update apt-get install -y cmake g++ make libpcre3-dev apt-get install -y qtbase5-dev qttools5-dev libqt5charts5-dev apt-get install -y wget iwyu - 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 -DBUILD_TESTS=On -DBUILD_GUI=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 - name: Prepare CMake dependencies run: | # make sure the precompiled headers exist #make -C cmake.output/cli cmake_pch.hxx.pch #make -C cmake.output/gui cmake_pch.hxx.pch #make -C cmake.output/lib cmake_pch.hxx.pch #make -C cmake.output/test cmake_pch.hxx.pch # make sure the auto-generated GUI sources exist make -C cmake.output autogen # make sure the auto-generated GUI dependencies exist make -C cmake.output gui-build-deps make -C cmake.output triage-build-ui-deps - name: Build Qt mappings run: | wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-qt.py python3 iwyu-mapgen-qt.py /usr/include/x86_64-linux-gnu/qt5/ > qt5.imp # TODO: the mapping file causes a massive slowdown so we cannot use it at the moment. # add "-Xiwyu --mapping_file=qt5.imp" at the end of the whole command if we can use them. - name: iwyu_tool run: | # do not fail for now so the output is being saved iwyu_tool -p cmake.output -j $(nproc) -- -w > iwyu.log || true - uses: actions/upload-artifact@v3 with: name: Compilation Database path: ./cmake.output/compile_commands.json - uses: actions/upload-artifact@v3 with: name: Qt Mappings path: ./qt5.imp - uses: actions/upload-artifact@v3 with: name: Logs (include-what-you-use) path: ./*.log clang-include-cleaner: runs-on: ubuntu-22.04 env: QT_VERSION: 5.15.2 steps: - uses: actions/checkout@v3 - name: Install missing software run: | sudo apt-get update sudo apt-get install -y cmake make sudo apt-get install -y libpcre3-dev sudo apt-get install -y libffi7 # work around missing dependency for Qt install step - name: Install clang run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 17 sudo apt-get install -y clang-tools-17 - name: Install Qt ${{ env.QT_VERSION }} uses: jurplel/install-qt-action@v3 with: version: ${{ env.QT_VERSION }} modules: 'qtcharts' cache: true - 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 -DBUILD_TESTS=On -DBUILD_GUI=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 env: CC: clang-17 CXX: clang++-17 - name: Prepare CMake dependencies run: | # make sure the precompiled headers exist #make -C cmake.output/cli cmake_pch.hxx.pch #make -C cmake.output/gui cmake_pch.hxx.pch #make -C cmake.output/lib cmake_pch.hxx.pch #make -C cmake.output/test cmake_pch.hxx.pch # make sure the auto-generated GUI sources exist make -C cmake.output autogen # make sure the auto-generated GUI dependencies exist make -C cmake.output gui-build-deps - name: clang-include-cleaner run: | # TODO: run multi-threaded find $PWD/cli $PWD/lib $PWD/test -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-17 --print=changes --extra-arg=-w -p cmake.output > clang-include-cleaner.log 2>&1 - uses: actions/upload-artifact@v3 with: name: Logs (clang-include-cleaner) path: ./*.log