2022-02-01 17:19:19 +01:00
|
|
|
# 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
|
|
|
|
|
2023-12-05 10:26:24 +01:00
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * 0'
|
|
|
|
workflow_dispatch:
|
2022-02-01 17:19:19 +01:00
|
|
|
|
2022-08-26 23:25:07 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-02-01 17:19:19 +01:00
|
|
|
jobs:
|
2023-03-04 08:53:19 +01:00
|
|
|
iwyu:
|
2022-02-01 17:19:19 +01:00
|
|
|
|
2023-08-02 14:49:48 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
image: ["fedora:latest"] # "debian:unstable" / "archlinux:latest"
|
|
|
|
|
2022-05-31 19:55:57 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-02-01 17:19:19 +01:00
|
|
|
|
|
|
|
container:
|
2023-08-02 10:36:17 +02:00
|
|
|
image: "fedora:latest"
|
2022-02-01 17:19:19 +01:00
|
|
|
|
|
|
|
steps:
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-01 17:19:19 +01:00
|
|
|
|
|
|
|
# TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image
|
2023-04-08 16:08:47 +02:00
|
|
|
- name: Install missing software on debian/ubuntu
|
2023-08-02 14:49:48 +02:00
|
|
|
if: contains(matrix.image, 'debian')
|
2022-02-01 17:19:19 +01:00
|
|
|
run: |
|
|
|
|
apt-get update
|
2022-04-11 07:30:55 +02:00
|
|
|
apt-get install -y cmake g++ make libpcre3-dev
|
2022-02-01 17:19:19 +01:00
|
|
|
apt-get install -y qtbase5-dev qttools5-dev libqt5charts5-dev
|
|
|
|
apt-get install -y wget iwyu
|
2023-04-08 16:08:47 +02:00
|
|
|
ln -s ../x86_64-linux-gnu/qt5 /usr/include/qt
|
|
|
|
|
|
|
|
- name: Install missing software on archlinux
|
2023-08-02 14:49:48 +02:00
|
|
|
if: contains(matrix.image, 'archlinux')
|
2023-04-08 16:08:47 +02:00
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
pacman -Sy
|
|
|
|
pacman -S cmake make gcc qt5-base qt5-tools qt5-charts pcre wget --noconfirm
|
|
|
|
pacman-key --init
|
2023-08-02 14:49:48 +02:00
|
|
|
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
|
2023-08-02 10:36:17 +02:00
|
|
|
pacman-key --lsign-key 3056513887B78AEB
|
2023-04-08 16:08:47 +02:00
|
|
|
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
|
2022-02-01 17:19:19 +01:00
|
|
|
|
2023-08-02 10:36:17 +02:00
|
|
|
# TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image
|
|
|
|
- name: Install missing software on Fedora
|
2023-08-02 14:49:48 +02:00
|
|
|
if: contains(matrix.image, 'fedora')
|
2023-08-02 10:36:17 +02:00
|
|
|
run: |
|
|
|
|
dnf install -y cmake gcc-c++ qt5-qtbase-devel qt5-linguist qt5-qttools-devel qt5-qtcharts-devel pcre-devel
|
|
|
|
dnf install -y wget iwyu
|
|
|
|
ln -s iwyu_tool.py /usr/bin/iwyu_tool
|
|
|
|
ln -s qt5 /usr/include/qt
|
|
|
|
|
2023-10-26 14:55:59 +02:00
|
|
|
# TODO: switch to Qt 6 after we enabled the Qt mappings again
|
2022-02-01 17:19:19 +01:00
|
|
|
- name: Prepare CMake
|
|
|
|
run: |
|
2023-04-08 16:08:47 +02:00
|
|
|
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=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
|
2022-02-01 17:19:19 +01:00
|
|
|
|
|
|
|
- name: Prepare CMake dependencies
|
|
|
|
run: |
|
|
|
|
# make sure the precompiled headers exist
|
2023-03-04 08:53:19 +01:00
|
|
|
#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
|
2022-02-01 17:19:19 +01:00
|
|
|
# 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
|
2023-03-02 21:50:14 +01:00
|
|
|
make -C cmake.output triage-build-ui-deps
|
2022-02-01 17:19:19 +01:00
|
|
|
|
|
|
|
- name: Build Qt mappings
|
|
|
|
run: |
|
|
|
|
wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-qt.py
|
2023-04-08 16:08:47 +02:00
|
|
|
python3 iwyu-mapgen-qt.py /usr/include/qt/ > qt5.imp
|
2022-02-01 17:19:19 +01:00
|
|
|
|
|
|
|
- name: iwyu_tool
|
|
|
|
run: |
|
2023-04-08 16:08:47 +02:00
|
|
|
PWD=$(pwd)
|
2023-11-13 23:24:06 +01:00
|
|
|
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/qt5.imp -I/usr/lib/clang/17/include > iwyu.log
|
2022-02-01 17:19:19 +01:00
|
|
|
|
2023-03-02 21:50:14 +01:00
|
|
|
- uses: actions/upload-artifact@v3
|
2023-04-08 16:08:47 +02:00
|
|
|
if: success() || failure()
|
2023-03-02 21:50:14 +01:00
|
|
|
with:
|
|
|
|
name: Compilation Database
|
|
|
|
path: ./cmake.output/compile_commands.json
|
|
|
|
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
2023-04-08 16:08:47 +02:00
|
|
|
if: success() || failure()
|
2022-02-01 17:19:19 +01:00
|
|
|
with:
|
|
|
|
name: Qt Mappings
|
|
|
|
path: ./qt5.imp
|
|
|
|
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
2023-04-08 16:08:47 +02:00
|
|
|
if: success() || failure()
|
2022-02-01 17:19:19 +01:00
|
|
|
with:
|
2023-03-04 08:53:19 +01:00
|
|
|
name: Logs (include-what-you-use)
|
2022-02-01 17:19:19 +01:00
|
|
|
path: ./*.log
|
2023-03-04 08:53:19 +01:00
|
|
|
|
|
|
|
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: |
|
2023-08-01 22:56:44 +02:00
|
|
|
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
|
2023-03-04 08:53:19 +01:00
|
|
|
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
|