iwyu.yml: use Qt 6.7.0 for include-what-you-use
#219
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: [pull_request, push] | |
permissions: | |
contents: read | |
jobs: | |
iwyu: | |
strategy: | |
matrix: | |
image: ["archlinux:latest"] # "opensuse/tumbleweed:latest" / "fedora:latest" / "debian:unstable" / "archlinux:latest" | |
runs-on: ubuntu-22.04 | |
if: ${{ github.repository_owner == 'danmar' }} | |
container: | |
image: ${{ matrix.image }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install missing software on debian/ubuntu | |
if: contains(matrix.image, 'debian') | |
run: | | |
apt-get update | |
apt-get install -y cmake clang make libpcre3-dev | |
apt-get install -y qt6-base-dev qt6-tools-dev qt6-charts-dev | |
apt-get install -y wget iwyu | |
ln -s x86_64-linux-gnu/qt6 /usr/include/qt | |
- name: Install missing software on archlinux | |
if: contains(matrix.image, 'archlinux') | |
run: | | |
set -x | |
pacman -Sy | |
pacman -S cmake make clang pcre --noconfirm | |
pacman -S qt6-base qt6-tools qt6-charts --noconfirm | |
pacman -S wget --noconfirm | |
pacman-key --init | |
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com | |
pacman-key --lsign-key 3056513887B78AEB | |
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm | |
echo "[chaotic-aur]" >> /etc/pacman.conf | |
echo "Include = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf | |
pacman -Sy | |
pacman -S include-what-you-use --noconfirm | |
ln -s iwyu-tool /usr/sbin/iwyu_tool | |
ln -s qt6 /usr/include/qt | |
- name: Install missing software on Fedora | |
if: contains(matrix.image, 'fedora') | |
run: | | |
dnf install -y cmake clang pcre-devel | |
dnf install -y qt6-qtbase-devel qt6-qttools-devel qt6-qtcharts-devel | |
dnf install -y wget iwyu | |
ln -s iwyu_tool.py /usr/bin/iwyu_tool | |
ln -s qt6 /usr/include/qt | |
- name: Install missing software on OpenSUSE | |
if: contains(matrix.image, 'opensuse') | |
run: | | |
zypper install -y cmake clang pcre-devel | |
zypper install -y qt6-base-common-devel qt6-core-devel qt6-gui-devel qt6-widgets-devel qt6-printsupport-devel qt6-linguist-devel qt6-help-devel qt6-charts-devel qt6-test-devel | |
zypper install -y wget include-what-you-use-tools | |
ln -s iwyu_tool.py /usr/bin/iwyu_tool | |
ln -s qt6 /usr/include/qt | |
- 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 | |
env: | |
CC: clang | |
CXX: clang++ | |
- 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/qt/ > qt.imp | |
- name: iwyu_tool | |
if: false | |
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 -Xiwyu --mapping_file=$PWD/qt.imp > iwyu.log | |
- uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
name: Compilation Database | |
path: ./cmake.output/compile_commands.json | |
- uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
name: Qt Mappings | |
path: ./qt.imp | |
- uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
name: Logs (include-what-you-use) | |
path: ./*.log | |
clang-include-cleaner: | |
runs-on: ubuntu-22.04 | |
if: false | |
env: | |
QT_VERSION: 6.7.0 | |
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: | | |
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14 | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 18 | |
sudo apt-get install -y clang-tools-18 | |
- 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 -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 | |
env: | |
CC: clang-18 | |
CXX: clang++-18 | |
- 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 $PWD/gui -maxdepth 1 -name "*.cpp" | xargs -t -n 1 clang-include-cleaner-18 --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 |